An admin script problem
#1

Hi guys i have this code
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(register, 8, cmdtext);
  dcmd(login, 5, cmdtext);
  dcmd(logout, 6, cmdtext);
  dcmd(akill, 7, cmdtext);

  return 0;
}
Код:
dcmd_akill(playerid, params[])
{
  if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[AKILL])
  {
    new string[100];
    format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[AKILL]);
    return SendClientMessage(playerid, COLOUR_ORANGE, string);
  }
  else if(!strlen(params))
    return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /akill [id | name]");
  else
  {
	new id = (isNumeric(params)) ? strval(params) : GetPlayerId(params);
	if(IsPlayerConnected(id) && id != playerid)
	{
	  SetPlayerHealth(id, 0.0);
	  new string[150];
	  format(string, sizeof(string), "You have been admin-killed by administrator \'%s\'.", gPlayerInfo[playerid][PLAYER_NAME]);
	  SendClientMessage(id, COLOUR_ORANGE, string);
	  format(string, sizeof(string), "You have successfully admin-killed player \'%s\'.", gPlayerInfo[id][PLAYER_NAME]);
	  return SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
	}
	else
	  return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You can not admin-kill yourself or a disconnected player.");
  }
}
and i get this error
Код:
D:\samp03asvr_R4_win32\filterscripts\Adminscript.pwn(277) : error 017: undefined symbol "GetPlayerId"
how do i fix this issue?
Reply
#2

BUMP: i need to fix this
Reply
#3

Uhm, I suppose you could add this somewhere in your script

pawn Код:
stock GetPlayerId(name[])
{
  new tmp[24];
  for(new playerid;playerid<MAX_PLAYERS;playerid++)
  {
    GetPlayerName(playerid,tmp,24);
    if(strfind(tmp,name,true)>-1)return playerid;
  }
  return INVALID_PLAYER_ID;
}
Reply
#4

NVM Remove This
________
SHIP SALE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)