cmd:cuff problem
#1

Hi Guys, i need your help again... When i try to /cuff someone it said "the player isnt restrained".... what does it mean? And i want to remove that... Here's the code.

Код:
CMD:cuff(playerid, params[])
{
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
	{
		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, "u", 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);
					ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
					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;
}
Do i just need to do like this?
Код:
/*else
				{
					SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!");
					return 1;
				}
			}*/
If not, what should i do? Thanks guys
Reply
#2

Try this

Код:
CMD:cuff(playerid, params[])
{
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
	{
		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, "u", 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);
					ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
					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;
}
Reply
#3

Alright thanks... Let me rep you
Reply
#4

Quote:
Originally Posted by PawelQ
Посмотреть сообщение
Try this

Код:
CMD:cuff(playerid, params[])
{
	if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
	{
		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, "u", 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);
					ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
					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;
}
You're missing a bracket.

}
/*else
Reply
#5

Thanks Bro i was getting this errors

Код:
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(733) : warning 215: expression has no effect
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(2502) : error 017: undefined symbol "RBT"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(2503) : error 017: undefined symbol "RBT"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3400) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3407) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3414) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3423) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3437) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3444) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3448) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3451) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3458) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3466) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3469) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3476) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3483) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3497) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3506) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3518) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3537) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3551) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3565) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3573) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3578) : error 017: undefined symbol "ProxDetector"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3699) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3822) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Asus\Documents\New Folders\gamemodes\PIRP.pwn(3823) : error 017: undefined symbol "GivePlayerCash"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
And i reload the page, then i read your post. And its working now Thanks very much bro... But hey, why do i can't give reputation to someone else?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)