GetPlayerName & GetPlayerPing Errors - 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: GetPlayerName & GetPlayerPing Errors (
/showthread.php?tid=326619)
GetPlayerName & GetPlayerPing Errors -
Dennis_Smith - 18.03.2012
Alright. I'm getting a few errors for the same line. Not sure how to solve them. I'm trying to get this function to alert players on the server of high ping.
(Annoying function? yes i know but its a small server trololol.) I believe I'm handling the name variable wrong. I've included a_players and put this all under public pingchecktimer(playerid).
Code
Код:
237| if(GetPlayerPing(playerid) > 350)
238| GetPlayerName(playerid, pName, sizeof(pName[MAX_PLAYER_NAME]));
239| format(string,sizeof(string), "Warning: %s is playing with a high ping of %s.", pName, GetPlayerPing(playerid));
240| SendClientMessageToAll (0x550000FF, string);
Errors
Код:
C:\Users\Dennis\Desktop\SAMP\Servers\roleplay by me\gamemodes\roleplay.pwn(238) : error 017: undefined symbol "pName"
C:\Users\Dennis\Desktop\SAMP\Servers\roleplay by me\gamemodes\roleplay.pwn(238) : error 017: undefined symbol "pName"
C:\Users\Dennis\Desktop\SAMP\Servers\roleplay by me\gamemodes\roleplay.pwn(238) : error 029: invalid expression, assumed zero
C:\Users\Dennis\Desktop\SAMP\Servers\roleplay by me\gamemodes\roleplay.pwn(238) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
What do I need to do to define pName? And what is causing line 238 to be assumed zero?
Any help is appreciated!
Re: GetPlayerName & GetPlayerPing Errors -
ReneG - 18.03.2012
Replace
pawn Код:
GetPlayerName(playerid, pName, sizeof(pName[MAX_PLAYER_NAME]));
with
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(MAX_PLAYER_NAME));
Re: GetPlayerName & GetPlayerPing Errors -
Skribblez - 18.03.2012
Quote:
Originally Posted by VincentDunn
pawn Код:
new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(MAX_PLAYER_NAME));
|
i assume that you had a typo.
use this instead:
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
Re: GetPlayerName & GetPlayerPing Errors -
chrism11 - 18.03.2012
or use
Код:
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}