Greetings,
Hope everybody is having a great time here.
Had to post this after a lot of searching and fixing didn't help.
Error :
PHP Code:
L 07/01/2018 - 22:26:11: Start of error session.
L 07/01/2018 - 22:26:11: Info (map "css_dust2") (file "addons/amxmodx/logs/error_20180701.log")
L 07/01/2018 - 22:26:11: [CSTRIKE] Invalid player 3
L 07/01/2018 - 22:26:11: [AMXX] Displaying debug trace (plugin "x_216.amxx", version "2.16")
L 07/01/2018 - 22:26:11: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 07/01/2018 - 22:26:11: [AMXX] [0] x_216.sma::HandleSay (line 517)
Code extracts :
PHP Code:
public HandleSay(id)
{
new Message[192], None[2][32], Chat[192], Alive[16];
read_args(Message, 191);
remove_quotes(Message);
formatex(None[0], 31, "");
formatex(None[1], 31, " ");
if(Message[0] == '@' || Message[0] == '!' || equal (Message, ""))
return PLUGIN_HANDLED;
if(!is_user_alive(id))
Alive = "*DEAD* ";
else
Alive = "";
if(!equali(Message, None[0]) && !equali(Message, None[1]))
{
if(Logined[id])
{
formatex(Chat, 191, "^1%s^4[%s] ^3%s^1 : %s", Alive, Ranks[CurrentRank[id]], Name[id], Message);
}
else
{
formatex(Chat, 191, "^1%s^4[Unranked] ^3%s^1 : %s", Alive, Name[id], Message);
}
//////// Line 517 Below ////////
switch(cs_get_user_team(id)) // Line 517 Here
//////// Line 517 Above ///////
{
case CS_TEAM_T: ColorChat(0, RED, Chat);
case CS_TEAM_CT: ColorChat(0, BLUE, Chat);
case CS_TEAM_SPECTATOR: ColorChat(0, GREY, Chat);
}
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
Tried adding a check : Failed.
PHP Code:
if(!is_user_connected(id))
{
Checking is_user_alive didn't make sense to me, and still for the 'sake of science', I tried it and it made the code wildly malfunction and blocked chat messages, as expected.
I'd love to get a fixed code and also learn how to fix these type of errors, especially with SayHandlers.
Lemme know if you need any additional information.
Kind Regards,
ZEDD
__________________