give_point <名稱> <給予的數量>
複製程式
public plugin_init()
register_concmd("give_point", "cmd_give_point", ADMIN_KICK, "- give_point <name> <amount> : Give Point")
複製程式
public cmd_give_point(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new arg_name[4], arg_amount
read_argv(1, arg_name, 3)
read_argv(2, arg_amount, 3)
new target = cmd_target(id, arg_name, 2)
if (!target)
{
client_print(id, print_console, "Player not found")
return PLUGIN_HANDLED
}
g_point[target] += str_to_num(arg_amount)
return PLUGIN_HANDLED
}
如何把point儲存紀錄於
config資料夾裡的save_point.ini內
一個比較簡單的方法
但將會記錄在addons\amxmodx\logs\中的.log檔
複製程式
public cmd_give_point(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new arg_name[4], arg_amount
read_argv(1, arg_name, 3)
read_argv(2, arg_amount, 3)
new target = cmd_target(id, arg_name, 2)
if (!target)
{
client_print(id, print_console, "Player not found")
return PLUGIN_HANDLED
}
g_point[target] += str_to_num(arg_amount)
new name[32], name2[32]
get_user_name(id, name, 31)
get_user_name(target, name2, 31)
log_amx("[Give Point] Admin ^"%s^" gives %i point to ^"%s^""
, name, str_to_num(arg_amount), name2)
return PLUGIN_HANDLED
}