SA-MP Forums Archive
undefined symbol "PlayerName" - 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: undefined symbol "PlayerName" (/showthread.php?tid=526079)



undefined symbol "PlayerName" - Team_PRO - 15.07.2014

Код:
C:\Users\Matt\Desktop\mgdazam.pwn(648) : error 017: undefined symbol "PlayerName"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
format(string,sizeof(string),"6[IRC PM] From %s to %s(%d): %s",user,PlayerName(ID),ID,cmdreason);
Код:
IRCCMD:pm(botid, channel[], user[], host[], params[])
{
	if (IRC_IsVoice(botid, channel, user))
	{
		if (!isnull(params))
		{
			new string [128];
			new string2[128];
			new ID;
			new cmdreason[100];
		 	if(sscanf(params, "us[100]", ID, cmdreason))
		 	{
			 	format(string, sizeof(string), "USAGE: !pm (Player Name/ID) (Message)", ID);
			 	IRC_GroupSay(groupID, IRC_CHANNEL,string);
			 	return 1;
			}
			if(!IsPlayerConnected(ID))
			{
				format(string, sizeof(string), "2ERROR: \2;%d\2; is not an active ID.", ID);
			 	IRC_GroupSay(groupID, IRC_CHANNEL,string);
			 	return 1;
			}
		    format(string,sizeof(string),"6[IRC PM] From %s to %s(%d): %s",user,PlayerName(ID),ID,cmdreason);
			IRC_GroupSay(groupID, IRC_CHANNEL,string);
		    format(string2, sizeof(string2), "[IRC PM] %s: %s", user, cmdreason);
		    SendClientMessage(ID,0xFFFFFFFF,string2);
		    PlayerPlaySound(ID,1085,0.0,0.0,0.0);
		}
	}
   	return 1;
}



Re: undefined symbol "PlayerName" - Konstantinos - 15.07.2014

pawn Код:
// global:
new gPlayer_Name[MAX_PLAYERS][MAX_PLAYER_NAME];

#define PlayerName(%0) gPlayer_Name[%0]

// OnPlayerConnect:
GetPlayerName(playerid, gPlayer_Name[playerid], MAX_PLAYER_NAME);
instead of calling the GetPlayerName function over and over again (with a function).

Oh and make sure that the player is connected before using it otherwise it'll cause run time error 4: Array index out of bounds.


Re: undefined symbol "PlayerName" - rockhopper - 15.07.2014

Код:
IRCCMD:pm(botid, channel[], user[], host[], params[])
{
        new PlayerName[MAX_PLAYER_NAME];
	if (IRC_IsVoice(botid, channel, user))
	{
		if (!isnull(params))
		{......



Re: undefined symbol "PlayerName" - Team_PRO - 15.07.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
// global:
new gPlayer_Name[MAX_PLAYERS][MAX_PLAYER_NAME];

#define PlayerName(%0) gPlayer_Name[%0]

// OnPlayerConnect:
GetPlayerName(playerid, gPlayer_Name[playerid], MAX_PLAYER_NAME);
instead of calling the GetPlayerName function over and over again (with a function).

Oh and make sure that the player is connected before using it otherwise it'll cause run time error 4: Array index out of bounds.
Quote:
Originally Posted by rockhopper
Посмотреть сообщение
Код:
IRCCMD:pm(botid, channel[], user[], host[], params[])
{
        new PlayerName[MAX_PLAYER_NAME];
	if (IRC_IsVoice(botid, channel, user))
	{
		if (!isnull(params))
		{......
Thanks to both of you it worked