PHP Code:
#include <amxmodx>
#include <engine>
#define PLUGIN "Spec Bonus HP"
#define VERSION "1.0"
#define AUTHOR "Shooting King"
new bool:g_bonusGiven[33];
new bool:g_bonusOver[33];
new pcvar_hp;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_clcmd( "say /givehp", "cmd_GiveHp" );
register_clcmd( "say_team /givehp", "cmd_GiveHp" );
pcvar_hp = register_cvar( "amx_sk_sbhp", "50" );
register_event( "HLTV", "event_NewRound", "a", "1=0", "2=0" );
}
public event_NewRound()
{
for( new i=1; i < 33; i++ )
{
g_bonusGiven[i] = false;
g_bonusOver[i] = false;
}
}
public client_putinserver(id)
{
g_bonusGiven[id] = false;
g_bonusOver[id] = false;
}
public cmd_GiveHp(id)
{
new iSpecMode = entity_get_int(id, EV_INT_iuser1);
if(iSpecMode == 0 || iSpecMode == 3)
{
client_print( id, print_chat, "You are not a Spectating a player." );
return PLUGIN_CONTINUE;
}
if(g_bonusOver[id])
{
client_print( id, print_chat, "You have already given hp to some other player this round. Try again next round" );
return PLUGIN_CONTINUE;
}
new iSpec = entity_get_int(id, EV_INT_iuser2);
if(g_bonusGiven[iSpec])
{
client_print( id, print_chat, "Bonus to this player has already been given by some other player." );
return PLUGIN_CONTINUE;
}
entity_set_float( iSpec, EV_FL_health, (entity_get_float(iSpec, EV_FL_health)+get_pcvar_float(pcvar_hp)));
g_bonusGiven[id] = true;
g_bonusOver[id] = true;
return PLUGIN_CONTINUE;
}
i want the name of player who get my bonus....
