SA-MP Forums Archive
Undefined symbol... Please help me out - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Undefined symbol... Please help me out (/showthread.php?tid=358560)



Undefined symbol... Please help me out - Scrillex - 10.07.2012

Код:
if (IsPlayerConnected(i)) GetPlayerName(i, roleplayname, MAX_PLAYER_NAME);
Код:
error 017: undefined symbol "i"
Please help me out


Re: Undefined symbol... Please help me out - [A]ndrei - 10.07.2012

pawn Код:
new i [MAX_PLAYERS]
try that not tested to lazy to test.............


Re: Undefined symbol... Please help me out - DaRkM - 10.07.2012

is this in a for loop?
for(new i = 0; i < MAX_PLAYERS; i++)

Please provide the surrounding lines.

That line is used when the playerid is unknown (looping through 1-500 [or w/e defined] to check everyone).
Replace "i" with "playerid" if this is just someone doing a command that has to do with themself. for example a command that returns that users name.


Re: Undefined symbol... Please help me out - Scrillex - 10.07.2012

Full code
Quote:

new name[MAX_PLAYER_NAME], roleplayname[MAX_PLAYER_NAME] = "Will_Smith", goodbyemessage[108];
GetPlayerName(playerid, name, sizeof(name));
if (!IsRPName(name)) // you can control the max underlines, e.g if you allow max. 1 underlines, write this: if (!IsRPName(name, 1))
{
for (new i = 0; i < MAX_PLAYERS; i++) if (IsPlayerConnected(i)) break; // find a player who is online (and hasn't got kicked from the server -> has got a RolePlay name
if (IsPlayerConnected(i)) GetPlayerName(i, roleplayname, MAX_PLAYER_NAME); // if there was an online player, it's name will be the suggested roleplay name
format (goodbyemessage, sizeof(goodbyemessage), "* %s was kicked, come back with a roleplay name such as %s", name, roleplayname);
SendClientMessageToAll(-1, goodbyemessage);
return Kick(playerid);
}




Re: Undefined symbol... Please help me out - Scrillex - 10.07.2012

Hmm something is wrong can easy connect without rp name....