All pastes #793953 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-22 19:41 UTC
rendered paste body
	if(strcmp(cmd, "/shock", true) ==0)
	{
        new Float:health;
        
		if(IsPlayerConnected(playerid))
	    {
			if(gTeam[playerid] == 2 || IsACop(playerid))
			{
			    new suspect = GetClosestPlayer(playerid);
			    if(IsPlayerConnected(suspect))
				{
                    if(PlayerCuffed[suspect] > 0)
				    {
				        SendClientMessage(playerid, COLOR_GREY, "   Player already Cuffed !");
				        return 1;
				    }
				    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
					{
					    if(gTeam[suspect] == 2)
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Cannot Tazer Cops / FBI / National Guard !");
					        return 1;
					    }
					    if(IsPlayerInAnyVehicle(suspect))
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Suspect is in a Car, get him out first !");
					        return 1;
					    }
					    GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You were Shocked by %s for 5 seconds.", sendername);
						SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* You Shocked %s for 5 seconds.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* %s shoots with his Shocker at %s, and Shocked him.", sendername ,giveplayer);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						GameTextForPlayer(suspect, "~r~Shocked", 3500, 2);
						TogglePlayerControllable(suspect, 0);
						GetPlayerHealth(suspect, health);
						SetPlayerHealth(suspect, health - 25);
					 	ApplyAnimation(suspect, "CRACK", "crckdeth2", 4.299999, 1, 1, 1, 0, 15000);
						PlayerCuffed[suspect] = 1;
						PlayerCuffedTime[suspect] = 5;
		            }
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "   No-one near you!");
					    return 1;
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / FBI / National Guard !");
			}
		}//not connected
	    return 1;
	}
//-------------[Drag]------------------
	if(strcmp(cmd, "/drag", true) == 0)
 	{
		new vid;
		if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid]");
				return 1;
			}
			new playa = strval(tmp);
			if(playa == playerid)
			{
				SendClientMessage(playerid, COLOR_GREY, "* You cant drag yourself into a vehicle");
				return 1;
			}
			if(IsPlayerConnected(playa))
			{
				if(gTeam[playerid] == 2 || IsACop(playerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
				    	if(PlayerCuffed[playa])
					    {
							PutPlayerInVehicle(playa, vid, 1);
						}
						else { SendClientMessage(playerid, COLOR_GREY, "* Player must be cuffed befor you can drag him"); return 1; }
					}
					else
					{
					format(string, sizeof(string), "* %d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_GREY, string);
					}
				}
				else { SendClientMessage(playerid, COLOR_GREY, "* you are not allowed to use that command!"); }
			}
			else
			{
			SendClientMessage(playerid,COLOR_GREY,"* That player is offline!!");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/cuff", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(gTeam[playerid] == 2 || IsACop(playerid))
			{
			    tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
			    if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
				        if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
				        {
				            SendClientMessage(playerid, COLOR_GREY, "   You can't Cuff Cops !");
					        return 1;
				        }
					    if(PlayerCuffed[giveplayerid] > 0)
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Player already Cuffed !");
					        return 1;
					    }
						if (ProxDetectorS(8.0, playerid, giveplayerid))
						{
						    new car = GetPlayerVehicleID(playerid);
						    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; }
						    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(giveplayerid, car))
						    {
						        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
						        format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername);
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
								SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
								ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
								GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 2);
								TogglePlayerControllable(giveplayerid, 0);
								PlayerCuffed[giveplayerid] = 2;
								PlayerCuffedTime[giveplayerid] = 180;
						    }
						    else
						    {
						        SendClientMessage(playerid, COLOR_GREY, "   Player not in your Car, or your not the Driver !");
						        return 1;
						    }
						}
						else
						{
						    SendClientMessage(playerid, COLOR_GREY, "   That player is not near you !");
						    return 1;
						}
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
				    return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / FBI / National Guard !");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/uncuff", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(gTeam[playerid] == 2)
			{
			    tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [Playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
					    if (ProxDetectorS(8.0, playerid, giveplayerid))
						{
						    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Uncuff yourself!"); return 1; }
							if(PlayerCuffed[giveplayerid])
							{
							    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
							    format(string, sizeof(string), "* You were Uncuffed by %s.", sendername);
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* You Uncuffed %s.", giveplayer);
								SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
								TogglePlayerControllable(giveplayerid, 1);
								PlayerCuffed[giveplayerid] = 0;
							}
							else
							{
							    SendClientMessage(playerid, COLOR_GREY, "   That player isn't Tied up !");
							    return 1;
							}
						}
						else
						{
						    SendClientMessage(playerid, COLOR_GREY, "   That player is not near you !");
						    return 1;
						}
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
				    return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / FBI / National Guard !");
			}
		}//not connected
		return 1;
	}