Very simple. bool should be the best choice for this case.
PHP Code:
new bool:cmd_used[33]
Look for this line and add the red colored line
Code:
// zp_human [target]
public cmd_human(id, level, cid)
{
// Check for access flag - Make Human
if (!cmd_access(id, g_access_flag[ACCESS_MAKE_HUMAN], cid, 2))
return PLUGIN_HANDLED;
// Limit the use of cmd
if (cmd_used[id])
{
client_print(id, print_chat, "[ZP] You have already used this command!")
return PLUGIN_HANDLED;
}
// Retrieve arguments
static arg[32], player
read_argv(1, arg, charsmax(arg))
player = cmd_target(id, arg, (CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF))
// Invalid target
if (!player) return PLUGIN_HANDLED;
// Target not allowed to be human
if (!allowed_human(player))
{
client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
return PLUGIN_HANDLED;
}
command_human(id, player)
cmd_used[id] = true
return PLUGIN_HANDLED;
}
Note: I purposely made it only restricted using console cmd (which means admins can still use the command using ZP MENU so it would be great if you disable ZP MENU for normal admins)
============================================= ============================================= =
If you want to restrict the command from both MENU and Console CMD: (You dont need to edit the public cmd_human for this)
Code:
// Admin Command. zp_human
command_human(id, player)
{
// Limit the use of cmd
if (cmd_used[id])
{
client_print(id, print_chat, "[ZP] You have already used this command!")
return PLUGIN_HANDLED;
}
// Show activity?
switch (get_pcvar_num(cvar_showactivity))
{
case 1: client_print(0, print_chat, "ADMIN - %s %L", g_playername[player], LANG_PLAYER, "CMD_DISINFECT")
case 2: client_print(0, print_chat, "ADMIN %s - %s %L", g_playername[id], g_playername[player], LANG_PLAYER, "CMD_DISINFECT")
}
// Log to Zombie Plague log file?
if (get_pcvar_num(cvar_logcommands))
{
static logdata[100], authid[32], ip[16]
get_user_authid(id, authid, charsmax(authid))
get_user_ip(id, ip, charsmax(ip), 1)
formatex(logdata, charsmax(logdata), "ADMIN %s <%s><%s> - %s %L (Players: %d/%d)", g_playername[id], authid, ip, g_playername[player], LANG_SERVER,"CMD_DISINFECT", fnGetPlaying(), g_maxplayers)
log_to_file("zombie_plague_advance.log", logdata)
}
// Turn to human
humanme(player, 0, 0, 0)
cmd_used[id] = true
return PLUGIN_HANDLED;
}