Need help with error 017: undefined symbol "i" -
TrueForYourSelf - 07.03.2013
Hello Dear SAMP Forum Members.
I need a little bit help.. I don't get why it's not working and showing this error..
So here is the code below I will show you where I have a error in it..
I hope You will help me out.
pawn Код:
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);
}
Error line:
pawn Код:
if (IsPlayerConnected(i)) GetPlayerName(i, roleplayname, MAX_PLAYER_NAME);
Here Is the error:
pawn Код:
error 017: undefined symbol "i"
With Respect TrueForYourSelf!
Re: Need help with error 017: undefined symbol "i" -
|MadDog| - 07.03.2013
u need include foreach
Re: Need help with error 017: undefined symbol "i" -
RajatPawar - 07.03.2013
pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++) if (!IsPlayerConnected(i)) break; // Weren't you checking the same things?
{
GetPlayerName(i, roleplayname, MAX_PLAYER_NAME);
// ......
}
Re: Need help with error 017: undefined symbol "i" -
TrueForYourSelf - 07.03.2013
Still got the same error.. Nothing changed! And yes I have included foreach!
Re: Need help with error 017: undefined symbol "i" -
|MadDog| - 07.03.2013
Do you have include foreach??
Re: Need help with error 017: undefined symbol "i" -
TrueForYourSelf - 07.03.2013
Did you read my topic! AS I SAID YES IT'S INCLUDED AND THIS FUNCTION ISN'T USING FOREACH!
Re: Need help with error 017: undefined symbol "i" -
mamorunl - 07.03.2013
Use brackets the right way. The 'if(IsPlayerConnected)' on the same line is only being executed by the for loop. Code given by Rajar is right, except that he missed the if statement on the same line.
Re: Need help with error 017: undefined symbol "i" -
TrueForYourSelf - 07.03.2013
Okay thanks..

Just yeah it could be it

Big thanks for that