You need to give Arg2 a specified length. Some other minor fixes. Also, you should use cmd_access instead of:
Code:
if (!(get_user_flags(id)&ADMIN_KICK)) {
console_print(id,"No access to amx_health - Sorry.")
return PLUGIN_HANDLED
}
if (read_argc() == 0) {
console_print(id,"No user given.")
return PLUGIN_HANDLED
}
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "AMX Health"
#define VERSION "1.0"
#define AUTHOR "Sonic"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_health", "change_health", ADMIN_KICK, "admin changes a users health ")
}
public change_health(id){
if (!(get_user_flags(id)&ADMIN_KICK)) {
console_print(id,"No access to amx_health - Sorry.")
return PLUGIN_HANDLED
}
if (read_argc() == 0) {
console_print(id,"No user given.")
return PLUGIN_HANDLED
}
new user[32], uid, Arg2[4];
read_argv(1,user,32)
read_argv(2,Arg2,3)
new hp = str_to_num(Arg2)
uid = find_player("bh",user)
if (uid == 0) {
console_print(id,"Couldn't find user.")
return PLUGIN_HANDLED
}
set_user_health(uid, hp)
console_print(id,"User's health has been set to %i!")
return PLUGIN_HANDLED
}
__________________