Adding
ADMIN_BAN in
register_clcmd won't do anything by itself. You also need to add this in the function's body:
Код за потвърждение: Избери целия код
public cmd_giveadrenaline(id, iLevel, iCid)
{
if(!cmd_access(id, iLevel, iCid, 3))
{
return PLUGIN_HANDLED
}
Where 3 is the number of arguments the command has: 1)
amx_giveadr, 2)
<player>, 3)
<amount>
Using
jctf_add_adrenaline in
client_print won't display anything because the function doesn't return a value.
Here's the full working code:
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <jctf>
#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH = 32
#endif
public plugin_init()
{
register_plugin("jCTF give adrenaline", "0.1", "amxx-bg")
register_clcmd("amx_giveadr", "cmd_giveadrenaline", ADMIN_BAN)
CC_SetPrefix("&x04[AMXX-BG]")
}
public cmd_giveadrenaline(id, iLevel, iCid)
{
if(!cmd_access(id, iLevel, iCid, 3))
{
return PLUGIN_HANDLED
}
new szPlayer[MAX_NAME_LENGTH]
read_argv(1, szPlayer, charsmax(szPlayer))
new iPlayer = cmd_target(id, szPlayer, CMDTARGET_ALLOW_SELF)
if(!iPlayer)
{
return PLUGIN_HANDLED
}
new szAmount[8]
read_argv(2, szAmount, charsmax(szAmount))
new iAmount = str_to_num(szAmount)
jctf_add_adrenaline(iPlayer, iAmount)
new szName[2][MAX_NAME_LENGTH]
get_user_name(id, szName[0], charsmax(szName[]))
get_user_name(iPlayer, szName[1], charsmax(szName[]))
CC_SendMessage(0, "ADMIN &x03%s &x01gave &x04%i adrenaline &x01to &x03%s", szName[0], iAmount, szName[1])
return PLUGIN_HANDLED
}