i need some way to protect the player from pressing the button twice so that he doesnt get extra frags(score)
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Push the button"
#define VERSION "1.0"
#define AUTHOR "rufee"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Use, "func_button", "hamUse");
}
public hamUse(ent,id)
{
new iPlayers[32];
new iNum;
new szTarget[32]
pev(ent, pev_target, szTarget, 31)
if ( equal(szTarget, "ct_target")) {
if(get_user_team(id) == 2){
client_print(id, print_chat, "[Push the button]You can't push your own button!")
}
else
{
get_players( iPlayers , iNum ,"ae" ,"CT" );
for( new i = 0; i < iNum ; i++){
set_user_frags(iPlayers[i],get_user_frags(iPlayers[i])+1);
user_kill(iPlayers[i])
}
set_user_frags(id,get_user_frags(id)+1)
client_print(id, print_chat, "[Push the button]You pushed the button!")
}
}
if ( equal(szTarget, "t_target")) {
if(get_user_team(id) == 1){
client_print(id, print_chat, "[Push the button]You can't push your own button!")
}
else
{
get_players( iPlayers , iNum ,"ae" ,"TERRORIST" );
for( new i = 0; i < iNum ; i++){
set_user_frags(iPlayers[i],get_user_frags(iPlayers[i])+1)
user_kill(iPlayers[i])
}
set_user_frags(id,get_user_frags(id)+1)
client_print(id, print_chat, "[Push the button]You pushed the button!")
}
}
}
__________________