error help
#1

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;
}
Reply
#2

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).
Reply
#3

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

Thank you both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)