SA-MP Forums Archive
Error with displaying name on OnPlayerConnect - 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: Error with displaying name on OnPlayerConnect (/showthread.php?tid=551978)



Error with displaying name on OnPlayerConnect - EmilLykke - 22.12.2014

When a player connects, it only shows the last pieces of the name, not the whole entire name..


pawn Код:
new IP[16], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new amessage[256];
format(amessage, sizeof(amessage), "%s has connected to the server! ID: %d IP: %s", name[playerid], playerid, IP);
SendMessageToAdmins(amessage, COLOR_LIGHTRED);



Re: Error with displaying name on OnPlayerConnect - Infility - 22.12.2014

Код:
new IP[16], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new amessage[256];
format(amessage, sizeof(amessage), "%s has connected to the server! ID: %d IP: %s", name, playerid, IP);
SendMessageToAdmins(amessage, COLOR_LIGHTRED);



Re: Error with displaying name on OnPlayerConnect - Abagail - 22.12.2014

You are mis-using the cells. You just want to use "name" not "name[playerid]". Strings are made of cells; and you are trying to access a part of the string; therefore not the entire string.