Code:
public TeamSelectHandler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);
switch(str_to_num(data) )
{
case 1:
{
if(cs_get_user_team(id) == CS_TEAM_T)
{
client_print(id, print_center, "Ya te encuentras en este TEAM");
return PLUGIN_HANDLED;
}
else
{
cs_set_user_team(id, CS_TEAM_T);
if(get_pcvar_num(p_Respawn) )
set_task(0.3, "DoRespawn", id);
}
}
case 2:
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_center, "Ya te encuentras en este TEAM");
return PLUGIN_HANDLED;
}
else
{
cs_set_user_team(id, CS_TEAM_CT);
if(get_pcvar_num(p_Respawn) )
set_task(0.3, "DoRespawn", id);
}
}
case 3:
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
{
client_print(id, print_center, "Ya te encuentras de SPEC");
return PLUGIN_HANDLED;
}
else
{
if(is_user_alive(id) )
user_kill(id, 1);
cs_set_user_team(id, CS_TEAM_SPECTATOR);
}
}
}
client_print(id, print_chat, "Puedes acceder a este menu cuando quieras apretando la M");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
For some reason, that i don't know... when i select the SPEC option, i tranfer to SPECTATOR but i am still alive, why user_kill() is not working? Is a problem of this code or maybe the problem is another plugin/code?
PS: Don't look on optimizations that can be change on the code (for example, i think i should precache cs_get_user_team() but, thats doesn't matter now).
__________________