I need a /cuff and /uncuff command
#6

At the top:
Код:
new PlayerCuffed[MAX_PLAYERS];
new giveplayerid;
OnPlayerConnect:
Код:
PlayerCuffed[playerid] = 0;
Код:
	if(strcmp(cmd, "/cuff", true) == 0)
  	{
  	  new sendername[MAX_PLAYERS];
		new giveplayer[MAX_PLAYERS];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
	   	SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /cuff [playerid]");
	   	return 1;
		}
		giveplayerid = ReturnUser(tmp);
	 	if(IsPlayerConnected(giveplayerid))
		{
		  if(giveplayerid != INVALID_PLAYER_ID)
		  {
			  if(PlayerCuffed[giveplayerid] == 1)
			  {
			    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already cuffed.");
			    return 1;
			  }
				if (GetDistanceBetweenPlayers(playerid,suspect) < 5))
				{
				  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't cuff yourself!"); return 1; }
				  GetPlayerName(playerid, sendername, sizeof(sendername);
				  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer);
  				format(string, sizeof(string), "Cuffed by %s.", sendername);
					SendClientMessage(giveplayerid, COLOR_RED, string);
					format(string, sizeof(string), "%s successfully cuffed.", giveplayer);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just handcuffed");
					TogglePlayerControllable(giveplayerid, 0);
					PlayerCuffed[giveplayerid] = 1;
				}
				else
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!");
				  return 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
			  return 1;
			}
		}
		return 1;
	}
You can edit that however you like, but it will work.
Reply


Messages In This Thread
I need a /cuff and /uncuff command - by killdahobo99 - 27.07.2009, 23:40
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by killdahobo99 - 28.07.2009, 00:28
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by pepper - 28.07.2009, 00:29
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by killdahobo99 - 28.07.2009, 00:33
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by coole210 - 28.07.2009, 00:36
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by Kenny990 - 28.07.2009, 00:37
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by killdahobo99 - 28.07.2009, 00:38
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by coole210 - 28.07.2009, 00:40
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by killdahobo99 - 28.07.2009, 00:43
Re: >>>>>>HELP WILLING TO PAY<<<<<<< - by coole210 - 28.07.2009, 00:44

Forum Jump:


Users browsing this thread: 3 Guest(s)