Using an array (enumerator and specifically a string) in a ternary operator causes the compiler to crash
#1

Instead of repeating myself when kicking a player, I've added a few parameters to my kick function and I'm now sending the message in the function's body.

PHP код:
KickEx(playerid, const reason[], kickerid INVALID_PLAYER_ID
I am using a custom function to send tagged messages (i.e: "[Error] message", where [Error] is the tag) but it's basically the same as 'ChatMsg' as seen in Southclaw's Scavenge&Survive: https://github.com/Southclaw/Scaveng...ls/message.pwn

Now all this has been irrelevant to the actual problem, which is the following line:
PHP код:
SendTaggedMessageToPlayer(playeridTYPE_ADMIN"%p has been kicked by the server by %s, reason: %s"playerid, ((kickerid == INVALID_PLAYER_ID) ? ("The Server") : (Player[kickerid][epd_Username])), reason); 
I've managed to dismantle the code to find the culprit and I was able to break it down to:
PHP код:
((kickerid == INVALID_PLAYER_ID) ? ("The Server") : (Player[kickerid][epd_Username])) 
Specifically to:
PHP код:
Player[kickerid][epd_Username
Replacing it with a literal string, fixes the problem, but is not the solution I seek:
PHP код:
((kickerid == INVALID_PLAYER_ID) ? ("The Server") : ("")) 
Is my code invalid or is this a compiler bug(/restriction?)?

By the way, epd_Username is declared as:
PHP код:
epd_Username[MAX_PLAYER_NAME
And I'm using it in OnPlayerConnect:
PHP код:
GetPlayerName(playeridPlayer[playerid][epd_Username], MAX_PLAYER_NAME); 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)