errors in /staff command
#1

Hey guys, I've added a new /Staff command, here it is:

Код:
CMD:staff(playerid, params[])
{
   new count = 0, string[256];
   SendClientMessage(playerid, 0xFF0000FF,"Current online helpers:");
   for(new i = 0; i < MAX_PLAYERS; i ++)
   {
	  if(IsPlayerConnected(i))
	  {
		  if(pInfo[i][Adminlevel] == 1)
		  {
             format(string, sizeof(string),"Admin Rank 1:[%d] %s", i, PlayerName(i));
             SendClientMessage(playerid, 0xFF0000FF, string);
             count++;
		  }
		  if(pInfo[i][Adminlevel] == 2)
		  {
             format(string, sizeof(string),"Admin Rank 2:[%d] %s", i, PlayerName(i));
             SendClientMessage(playerid, 0xFF0000FF, string);
             count++;
		  }
		  if(pInfo[i][Adminlevel] == 3)
		  {
             format(string, sizeof(string),"Admin Rank 3:[%d] %s", i, PlayerName(i));
             SendClientMessage(playerid, 0xFF0000FF, string);
             count++;
		  }
		  if(pInfo[i][Adminlevel] == 4)
		  {
             format(string, sizeof(string),"Admin Rank 4:[%d] %s", i, PlayerName(i));
             SendClientMessage(playerid, 0xFF0000FF, string);
             count++;
		  }
		  if(pInfo[i][Adminlevel] == 5)
		  {
             format(string, sizeof(string),"Senior Admin:[%d] %s", i, PlayerName(i));
             SendClientMessage(playerid, 0xFF0000FF, string);
             count++;
		  }
		  if(pInfo[i][Adminlevel] == 6)
		  {
             format(string, sizeof(string),"Head Admin:[%d] %s", i, PlayerName(i));
             SendClientMessage(playerid, 0xFF0000FF, string);
             count++;
		  }
      }
   }
   if(count == 0)
   {
		  SendClientMessage(playerid, 0xFF0000FF,"No vips are online right now!");
   }
   return 1;
}
And I'm getting these errors:

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1107) : error 017: undefined symbol "PlayerName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1113) : error 017: undefined symbol "PlayerName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1119) : error 017: undefined symbol "PlayerName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1125) : error 017: undefined symbol "PlayerName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1131) : error 017: undefined symbol "PlayerName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1137) : error 017: undefined symbol "PlayerName"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Please help! thanks
Reply
#2

When you use PlayerName, you must be sure that you have stock defined for what that is.

Use this somewhere you want in your script, alone:

pawn Код:
stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Good luck
Reply
#3

Thanks! But I have one more problem. it's not about this command, its about my /goto command, it works fine, but it shows no messages, and people that are not admins can use it, when I set it for only admins to use it!
Reply
#4

Show code via PM and i will try my best
Reply
#5

Quote:

When you use PlayerName, you must be sure that you have stock defined for what that is.

I think you mean function. You can do it three ways:
pawn Код:
PlayerName(playerid)

stock PlayerName(playerid)

forward PlayerName(playerid);
public PlayerName(playerid)
I encourage to use the first method unless you plan on using CallLocal/RemoteFunction or unless you're making an include or an FS. Stock is only useful if using the function is optional and/or you don't plan on using it. However, if you have a stock function in your gamemode because you don't plan using it, why even have it in the first place?
Reply
#6

Quote:
Originally Posted by LarzI
Посмотреть сообщение
I think you mean function. You can do it three ways:
pawn Код:
PlayerName(playerid)

stock PlayerName(playerid)

forward PlayerName(playerid);
public PlayerName(playerid)
I encourage to use the first method unless you plan on using CallLocal/RemoteFunction or unless you're making an include or an FS. Stock is only useful if using the function is optional and/or you don't plan on using it. However, if you have a stock function in your gamemode because you don't plan using it, why even have it in the first place?
Sorry, i meant function, yes.

But, this case is pretty free, because if you use PlayerName regularly in your scripts, a stock can be useful for him. And, yes, i agree with you LarzI, i should have told him that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)