Undefined symbol... Please help me out
#1

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

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

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

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);
}

Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)