error help - 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 help (
/showthread.php?tid=502679)
error help -
Mckarlis - 25.03.2014
Here is the error
Код:
C:\Users\Mckarlis\Desktop\TDM\gamemodes\TDM.pwn(594) : warning 217: loose indentation
C:\Users\Mckarlis\Desktop\TDM\gamemodes\TDM.pwn(1599) : error 017: undefined symbol "GetName"
C:\Users\Mckarlis\Desktop\TDM\gamemodes\TDM.pwn(3730) : warning 203: symbol is never used: "Forums"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Here is the code
Код:
CMD:pm(playerid, params[])
{
new id, message[256];
if(sscanf(params, "us[256]", id, message ) ) return SendClientMessage(playerid, -1, "Syntax: /pm [id] [message]");
if(!IsPlayerConnected(id) ) return SendClientMessage(playerid, -1, "Player is not connected");
new astring[256];
format(astring, sizeof(astring), "PM From %s: %s" , GetName(playerid), message);
SendClientMessage(id, COLOR_YELLOW, astring);
SendClientMessage(id, -1, "Message sent.");
return 1;
}
Re: error help -
Jstylezzz - 25.03.2014
pawn Код:
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
Wrote this quickly, should work. Just place it anywhere in your script, OUTSIDE any callbacks (outside any '{' '}' brackets).
Re: error help -
Konstantinos - 25.03.2014
By searching, you could've found a stock about GetName but since you didn't - I will give you a better option (and I'm saying this because if you use the above stock, it will call GetPlayerName over and over again).
pawn Код:
// global:
static
Player_Name[MAX_PLAYERS][21];
#define GetName(%0) Player_Name[%0]
// OnPlayerConnect:
GetPlayerName(playerid, Player_Name[playerid], 21);
About the warning 217: loose indentation ->
https://sampwiki.blast.hk/wiki/Errors_Li...se_indentation
About the last warning, use "Forums" somewhere or remove it.
Re: error help -
Mckarlis - 25.03.2014
Thank you both