Need help with error 017: undefined symbol "i"
#1

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!
Reply
#2

u need include foreach
Reply
#3

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);
        // ......
        }
Reply
#4

Still got the same error.. Nothing changed! And yes I have included foreach!
Reply
#5

Do you have include foreach??
Reply
#6

Did you read my topic! AS I SAID YES IT'S INCLUDED AND THIS FUNCTION ISN'T USING FOREACH!
Reply
#7

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.
Reply
#8

Okay thanks.. Just yeah it could be it Big thanks for that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)