Quote:
Originally Posted by Kreation
Why post if you don't know.
|
The same goes for you.
@funstyle: You need to make few small changes:
PHP Code:
#define MAX_SLAPS 5
new g_slap_cnt[33]
public cmdSlap(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE)
if (!player || ++g_slap_cnt[player] > MAX_SLAPS)
return PLUGIN_HANDLED
new spower[32], authid[32], name2[32], authid2[32], name[32]
read_argv(2, spower, 31)
new damage = str_to_num(spower)
user_slap(player, damage)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(player, authid2, 31)
get_user_name(player, name2, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, damage, name2, get_user_userid(player), authid2)
show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, damage);
console_print(id, "[AMXX] %L", id, "CLIENT_SLAPED", name2, damage)
return PLUGIN_HANDLED
}
But you also need to reset g_slap_cnt[id] somewhere.
You can do this (you will be able to slap player only 5 times until he disconnects):
PHP Code:
public client_connect(id)
g_slap_cnt[id] = 0
or this (you will be able to slap player 5 times after every spawn):
PHP Code:
#include <hamsandwich>
public plugin_init(){
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
}
public player_spawn(id){
if(!is_user_alive(id))
return
g_slap_cnt[id] = 0
}
__________________