I have this code:
Code:
register_clcmd("say /class", "ChangeClass");
register_clcmd("say_team /class", "ChangeClass");
register_clcmd("say /xp", "ShowHud");
register_clcmd("say_team /xp", "ShowHud");
Code:
public ShowHud(id) {
set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0);
show_hudmessage(id, "Level: %i^nXP: %i^nClass: %s", PlayerLevel[id], PlayerXP[id], CLASSES[PlayerClass[id]]);
}
Code:
public ChangeClass(id) {
new menu = menu_create("Class Menu", "Class_Handle");
menu_additem(menu, "uno", "1", 0);
menu_additem(menu, "dos", "2", 0);
menu_additem(menu, "tres", "3", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_CONTINUE;
}
public Class_Handle(id, menu, item) {
if(item == MENU_EXIT)
menu_destroy(menu);
new szCommand[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, szCommand, 5, szName, 63, callback);
new i = str_to_num(szCommand);
if(PlayerClass[id] != i) {
PlayerClass[id] = i;
client_print(id,print_chat,"[%s] You are now a %s", PREFIX, CLASSES[i]);
} else
client_print(id,print_chat,"[%s] You are allready a %s", PREFIX, CLASSES[i]);
menu_destroy(menu);
return PLUGIN_CONTINUE;
}
BUT, the clcmds wont work. When i type either /class or /xp nothing happens. I have checked the code a million times without finding anything wrong. You guys have any idea?