How do I fix this?
#2

few errors there :P
pawn Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/ban", true) == 0)
{
  if(PlayerInfo[playerid][PL1A] != 1) return SendClientMessage(playerid, color, "Not allowed to use this command!");
  new tmp[256];
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /ban [id]");
  new targetid = strval(tmp);
  if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, color, "Invalid ID");
  new str[128], name[24];
  GetPlayerName(targetid, name, MAX_PLAYER_NAME);
  format(str, sizeof str, "%s has been banned by an administrator!", name);
  SendClientMessageToAll(color, "============================");
  SendClientMessageToAll(color, str);
  SendClientMessageToAll(color, "============================");
  return 1;
}
Something like this.
NOTE: Requires strtok, can be found here: https://sampwiki.blast.hk/wiki/strtok
Reply


Messages In This Thread
How do I fix this? - by Mike Garber - 23.06.2009, 14:04
Re: How do I fix this? - by Grim_ - 23.06.2009, 14:10
Re: How do I fix this? - by Mike Garber - 23.06.2009, 14:25
Re: How do I fix this? - by Grim_ - 23.06.2009, 14:28
Re: How do I fix this? - by Mike Garber - 23.06.2009, 14:31
Re: How do I fix this? - by Grim_ - 23.06.2009, 14:32

Forum Jump:


Users browsing this thread: 3 Guest(s)