Adding [Reason]
#4

Код:
if(!strcmp(cmd, "/suspect", true))
{
  // Checking to make sure the player is a cop
  if(gTeam[playerid] != TEAM_COPS)
  return SendClientMessage(playerid, 0xFF0000FF, "-> You are not a police officer.");
  
  // Obtaining the second argument
  tmp = strtok(cmdtext, index);
  
  // Checking the second argument
  if(!strlen(tmp))
  return SendClientMessage(playerid, 0xFF0000FF, "-> You must specify a player ID to suspect them.");

  new targetid = strval(tmp);

  // Checking if the player is valid and connected
  if(!IsPlayerConnected(targetid))
  return SendClientMessage(playerid, 0xFF0000FF, "-> You have either entered an invalid player ID");
  
  // Extracting the reason
  strdel(cmdtext, 0, 10 + strlen(tmp));

  // Checking the reason
  if(strlen(cmd) < 2)
  return SendClientMessage(playerid, 0xFF0000FF, "-> Please provide a reason to suspect the individual.");

  // Getting the player names
  new playername[MAX_PLAYER_NAME];
  new targetname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
  GetPlayerName(targetid, targetname, MAX_PLAYER_NAME);

  new string[128];
  format(string, 128, "-> Police Officer '%s'[ID:%d] has suspected '%s'[ID:%d] of: %s", playername, playerid, targetname, targetid, cmd);
  SendClientMessageToAll(0x0000FFFF, string);
  SendClientMessage(targetid, 0x0000FFFF, "-> You are now a police suspect and may be subject to arrest.");
    
  return 1;
}
Reply


Messages In This Thread
Adding [Reason] - by Hot - 21.05.2009, 22:08
Re: Adding [Reason] - by Jefff - 21.05.2009, 22:29
Re: Adding [Reason] - by Hot - 21.05.2009, 22:35
Re: Adding [Reason] - by NovaParadox - 21.05.2009, 22:43
Re: Adding [Reason] - by Badger(new) - 21.05.2009, 22:49
Re: Adding [Reason] - by NovaParadox - 21.05.2009, 23:06
Re: Adding [Reason] - by Badger(new) - 21.05.2009, 23:33

Forum Jump:


Users browsing this thread: 1 Guest(s)