Raised This Month: $ Target: $400
 0% 

Problem changing team to SPEC


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-17-2010 , 09:18   Problem changing team to SPEC
Reply With Quote #1

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).
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 08-17-2010 at 09:21.
Alucard^ is offline
Send a message via Skype™ to Alucard^
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-17-2010 , 09:32   Re: Problem changing team to SPEC
Reply With Quote #2

You don't block Ham_Kill anywhere ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-17-2010 , 09:41   Re: Problem changing team to SPEC
Reply With Quote #3

You mean Ham_Killed right? Well, no.. i am not blocking Ham_Killed.. only this:

Code:
public HookHamKilled(id) {     if(!get_pcvar_num(p_Enable) )         return HAM_IGNORED;         if(get_pcvar_num(p_Respawn) && RespawnActive[id])         set_task(TASK_DORESPAWN, "DoRespawn", id);         return HAM_IGNORED; } ... public Respawn(id) {     if(is_user_connected(id) && (cs_get_user_team(id) == CS_TEAM_T || cs_get_user_team(id) == CS_TEAM_CT) )     {         ExecuteHam(Ham_CS_RoundRespawn, id);                 if(AutoGocheck[id] && gCheckpointCount[id])             ActiveOptions(id, 2);                 set_task(TASK_GIVEITEMS, "GiveItems", id);         set_task(TASK_GIVEWEAPS, "GiveWeapons", id);     } }

EDIT:

Well, i found it the problem, but not how to solve it ><

The problem is in another plugin, here:

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN  "Auto Join & Block Menus" #define AUTHOR  "Exolent" #define VERSION "0.0.1" enum {     TEAM_NONE = 0,     TEAM_T,     TEAM_CT,     TEAM_SPEC,         MAX_TEAMS }; new const g_cTeamChars[MAX_TEAMS] = {     'U',     'T',     'C',     'S' }; new const FIRST_JOIN_MSG[] = "#Team_Select"; new const FIRST_JOIN_MSG_SPEC[] = "#Team_Select_Spect"; new const INGAME_JOIN_MSG[] =   "#IG_Team_Select"; new const INGAME_JOIN_MSG_SPEC[] = "#IG_Team_Select_Spect"; new const VGUI_JOIN_TEAM_NUM =  2; new g_iTeam[33]; new g_iPlayers[MAX_TEAMS]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);         register_event("TeamInfo", "event_TeamInfo", "a");         register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");     register_message(get_user_msgid("ShowMenu"), "message_ShowMenu"); } public event_TeamInfo() {     new id = read_data(1);     new sTeam[32], iTeam;     read_data(2, sTeam, sizeof(sTeam) - 1);     for(new i = 0; i < MAX_TEAMS; i++)     {         if(g_cTeamChars[i] == sTeam[0])         {             iTeam = i;             break;         }     }         if(g_iTeam[id] != iTeam)     {         g_iPlayers[g_iTeam[id]]--;         g_iTeam[id] = iTeam;         g_iPlayers[iTeam]++;     } } public message_ShowMenu(iMsgid, iDest, id) {     static szMenuChannel[sizeof(FIRST_JOIN_MSG_SPEC)];     get_msg_arg_string(4, szMenuChannel, charsmax(szMenuChannel) );         if(equal(szMenuChannel, FIRST_JOIN_MSG) || equal(szMenuChannel, FIRST_JOIN_MSG_SPEC) )     {         if(ShouldAutojoin(id) )         {             set_autojoin_task(id, iMsgid)             return PLUGIN_HANDLED;         }     }     else if(equal(szMenuChannel, INGAME_JOIN_MSG) || equal(szMenuChannel, INGAME_JOIN_MSG_SPEC) )     {         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; } public message_VGUIMenu(iMsgid, iDest, id) {     if(get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)         return PLUGIN_CONTINUE;         if(ShouldAutojoin(id) )     {         set_autojoin_task(id, iMsgid);         return PLUGIN_HANDLED;     }         return PLUGIN_HANDLED; } public task_Autojoin(iParam[], id) {     new iMsgBlock = get_msg_block(iParam[0]);     set_msg_block(iParam[0], BLOCK_SET);         new const SPEC[] = "3";     engclient_cmd(id, "jointeam", SPEC);         set_msg_block(iParam[0], iMsgBlock); } stock set_autojoin_task(id, iMsgid) {     new iParam[2];     iParam[0] = iMsgid;     set_task(0.1, "task_Autojoin", id, iParam, sizeof(iParam) ); } stock bool:ShouldAutojoin(id) {     return (is_user_connected(id) && !(TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id) ); }

The code is from Exolent plugin Team Join Management...
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 08-17-2010 at 10:15.
Alucard^ is offline
Send a message via Skype™ to Alucard^
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode