I can cuff everyone
#1

Ok, so the prob i have cuff cmd

and /uncuff (didn't make yet!)

so all can cuff how can i make only police can? like if(IsPlayerPolice(playerid))

or
Reply
#2

When player enters the server as a police officer, set a variable equal to 1 or true and then check if it is true once the player does the command, if so continue going if not return a client message.
Reply
#3

Make a police class.
Reply
#4

pawn Код:
CMD:cuff(playerid,params[])
{
  new targetid;
  if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /cuff [Part of Name/Player ID]");
  if(IsPlayerConnected(targetid))
  if(playerid == 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't cuff yourself!");
  {
       new Float:x, Float:y, Float:z;
       GetPlayerPos(playerid, x,y,z);
       if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
       {
        new str[512];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name,sizeof(name));
        new target[MAX_PLAYER_NAME];
        GetPlayerName(targetid, target, sizeof(target));
        format(str, sizeof(str), "{ff0000}You cuffed %s!",target);
        SendClientMessage(playerid, 0xE01B1B, str);
        SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
        SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
        return 1;
       }
    }
  return 0;
}
Reply
#5

Код:
CMD:cuff(playerid, params[])
{
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pMember] == 6 && PlayerInfo[playerid][pRank] >= 3) || PlayerInfo[playerid][pMember] == 20)
	{
		if(GetPVarInt(playerid, "Injured") == 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
			return 1;
		}

		new string[128], giveplayerid;
		if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /cuff [playerid]");

		if(IsPlayerConnected(giveplayerid))
		{
			if (ProxDetectorS(8.0, playerid, giveplayerid))
			{
				if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!"); return 1; }
			//	if(PlayerCuffed[giveplayerid] == 1 || GetPlayerSpecialAction(giveplayerid) == SPECIAL_ACTION_HANDSUP)
			//	{
					format(string, sizeof(string), "* You have been handcuffed by %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
					format(string, sizeof(string), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid));
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					format(string, sizeof(string), "* %s handcuffs %s, tightening the cuffs securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
					TogglePlayerControllable(giveplayerid, 0);
					ClearAnimations(giveplayerid);
					SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
                    SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
					PlayerCuffed[giveplayerid] = 2;
					SetPVarInt(giveplayerid, "PlayerCuffed", 2);
					SetPVarInt(giveplayerid, "IsFrozen", 1);
					//Frozen[giveplayerid] = 1;
					PlayerCuffedTime[giveplayerid] = 300;
				}
			//	else
			//	{
			//		SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!");
			//		return 1;
			//	}
		//	}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
				return 1;
			}
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
			return 1;
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
	}
	return 1;
}
Please +rep me!

EDIT: You may need a tazer command + define some variables!
Reply
#6

Thanks, But i'd like to make my own command not to copy it from someone else!
Reply
#7

Quote:
Originally Posted by YanLanger
Посмотреть сообщение
pawn Код:
CMD:cuff(playerid,params[])
{
  new targetid;
  if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /cuff [Part of Name/Player ID]");
  if(IsPlayerConnected(targetid))
  if(playerid == 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't cuff yourself!");
  {
       new Float:x, Float:y, Float:z;
       GetPlayerPos(playerid, x,y,z);
       if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
       {
        new str[512];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name,sizeof(name));
        new target[MAX_PLAYER_NAME];
        GetPlayerName(targetid, target, sizeof(target));
        format(str, sizeof(str), "{ff0000}You cuffed %s!",target);
        SendClientMessage(playerid, 0xE01B1B, str);
        SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
        SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
        return 1;
       }
    }
  return 0;
}
You are on your way.
Just remember what I said above and add it to your code.
Reply
#8

Yep...................................Didn't understand it xD
Reply
#9

No one will help ?!?
Reply
#10

Well i don't know how good are you in scripting but if you know how you can try to allow just to cop skins to use command. Let me explain. If police skin id is 5 (it isn't just giving an example) you can allow just to skin 5 to use that command. Do you know how to do it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)