PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#define PLUGIN "Marvel stuff"
#define VERSION "1.0"
#define AUTHOR "Skumek"
//A little config
#define COST 16000
#define FLASH_SPEED 310.0
#define DAMAGE_HULK 2.0
#define CATWOMAN_ARMOR 160
#define CATWOMAN_HP 160
#define IRONMAN_ARMOR 200
#define IRONMAN_HP 200
#define HP_RESTORE_ARMOUNT 1
#define AMOUNT_INVISIBLE 16
//Macros
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) (%1 |= (1 << (%2 & 31)));
#define UnSet_BitVar(%1,%2) (%1 &= ~(1 << (%2 & 31)));
#define MAX_NAME 7
new const g_Names[MAX_NAME][] = {
"The Hulk",
"Cat Woman",
"Iron Man",
"Dracula",
"Invisible Woman",
"Wolverine",
"Flash"
}
//Classes
new g_Hulk, g_CatWoman, g_IronMan, g_Vampire, g_Invisible, g_Wolverine, g_Flash
//Get 'em
new g_MaxPlayers
//Some stuffs
new g_MaxHealth[33]
public plugin_init() {
register_plugin( PLUGIN, VERSION, AUTHOR )
//Ham
RegisterHam(Ham_Spawn, "player", "fw_Spawn", 1)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
//Event
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
register_event( "TextMsg", "Event_RoundRestart", "a", "2&#Game_C", "2&#Game_w" )
register_event("DeathMsg", "DeathMessage", "a")
//Get em
g_MaxPlayers = get_maxplayers()
//Cmd
register_clcmd( "say /marvel", "Open_SkinMenu" )
register_clcmd( "sayteam /marvel", "Open_SkinMenu" )
}
public client_connect( id ) ResetAll( id )
public client_disconnect( id ) ResetAll( id )
public Event_RoundRestart( id ) ResetAll( id )
public Event_CurWeapon( id )
{
if( is_user_alive( id ))
{
if( Get_BitVar(g_Flash, id )) set_user_maxspeed( id, FLASH_SPEED)
else if( Get_BitVar(g_Wolverine, id )) set_task(1.0, "Regen_Health", 2152, _, _, "b")
else if( Get_BitVar(g_Invisible, id )) fm_set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, AMOUNT_INVISIBLE )
}
}
public fw_TakeDamage(Victim, Attacker, Float: Damage, DamageType)
{
if(!is_user_alive(Attacker))
return HAM_IGNORED;
if(Get_BitVar(g_Hulk, Attacker))
{
SetHamParamFloat(4, Damage * DAMAGE_HULK)
return HAM_HANDLED;
}
return HAM_IGNORED;
}
public fw_Spawn( id )
{
if(!is_user_alive(id))
return
new CsArmorType:ArmorType
g_MaxHealth[id] = get_user_health(id)
if(Get_BitVar(g_IronMan, id ))
{
cs_set_user_armor( id, IRONMAN_ARMOR, ArmorType )
set_user_health(id, IRONMAN_HP )
}
else if(Get_BitVar(g_CatWoman, id ))
{
cs_set_user_armor( id, CATWOMAN_ARMOR, ArmorType )
set_user_health( id, CATWOMAN_HP )
}
}
public Open_SkinMenu( id )
{
if(!is_user_alive( id ))
return PLUGIN_CONTINUE
static Title[ 64 ]
formatex( Title, charsmax( Title ), "Class Selection^n" )
static iMenu; iMenu = menu_create( Title, "MenuHandle_SkinMenu" )
new Num, NumStr[ 3 ]
for( new i = 0; i < MAX_NAME; i++ )
{
Num = i
num_to_str( Num, NumStr, charsmax( NumStr ) )
menu_additem( iMenu, g_Names[ Num ], NumStr, 0 )
}
menu_setprop( iMenu, MPROP_EXIT, MEXIT_ALL )
menu_display( id, iMenu )
return PLUGIN_HANDLED
}
public MenuHandle_SkinMenu( id, iMenu, iItem )
{
if( iItem == MENU_EXIT )
return PLUGIN_CONTINUE
if( !is_user_connected( id ) )
return PLUGIN_CONTINUE
if(cs_get_user_money(id) < 16000)
{
client_print(id, print_chat, "Sorry, you dont have enough money")
return PLUGIN_CONTINUE
}
new _Trash, Key[ 3 ]
menu_item_getinfo( iMenu, iItem, _Trash, Key, charsmax( Key ), "", 0, _Trash )
new KeyItem = str_to_num( Key )
if( is_user_alive( id ) )
{
switch( KeyItem )
{
case 0: Set_BitVar( g_Hulk, id )
case 1: Set_BitVar( g_CatWoman, id )
case 2: Set_BitVar( g_IronMan, id)
case 3: Set_BitVar( g_Vampire, id )
case 4: Set_BitVar( g_Invisible, id )
case 5: Set_BitVar( g_Wolverine, id )
case 6: Set_BitVar( g_Flash, id )
default: ResetAll(id)
}
cs_set_user_money(id, (cs_get_user_money(id) - COST))
client_print_color( id, 0, "You have chosen Class: ^4[%s]", g_Names[ KeyItem ] )
}
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
public Regen_Health()
{
static id, hp
for(id=1; id<=g_MaxPlayers; id++){
if(!is_user_alive(id))
continue
hp = get_user_health(id)
if(hp >= g_MaxHealth[id])
g_MaxHealth[id] = hp
else
set_user_health(id, hp+HP_RESTORE_ARMOUNT)
}
}
public DeathMessage()
{
new killer = read_data(1);
new victim = read_data(2);
if(Get_BitVar(g_Vampire, killer))
{
if(is_user_alive(killer) && get_user_team(killer) != get_user_team(victim))
{
DeathMsg(killer,victim,read_data(3));
}
}
}
public DeathMsg(kid, vid, hs)
set_user_health(kid, min(get_user_health(kid)+(hs?30:15),255));
public ResetAll( id )
{
UnSet_BitVar(g_Hulk, id)
UnSet_BitVar(g_CatWoman, id)
UnSet_BitVar(g_Flash, id)
UnSet_BitVar(g_Invisible, id)
UnSet_BitVar(g_IronMan, id)
UnSet_BitVar(g_CatWoman, id)
UnSet_BitVar(g_Wolverine, id)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1042\\ f0\\ fs16 \n\\ par }
*/