Cuffed..
#1

I need to do, when player is cuffed it's can't use commands.. For example:
Код:
if(strcmp(cmdtext, "/pickup", true)==0)
	{
		SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
		return 1;
	}
Here is my array:
Код:
if(playerDB[id][cuffed])
I've tried everything, but nothing works.. Player can use this command still...
Reply
#2

TO block all commands, put this at top of onplayercommand

if(playerDB[playerid][cuffed]) return 1;


otherwise to add to individual commands:

Код:
if(strcmp(cmdtext, "/pickup", true)==0)
	{
        if(playerDB[playerid][cuffed]) return SendClientMessage(playerid,COLOR, "You cannot use this command while cuffed!");
		SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
		return 1;
	}
Reply
#3

It doesn't works.. When I type if(playerDB[playerid][cuffed]=true) than I can't use this command at all. Any ideas?
Reply
#4

Quote:
Originally Posted by lakierka
It doesn't works.. When I type if(playerDB[playerid][cuffed]=true) than I can't use this command at all. Any ideas?
1) youre trying to use it as a boolean (true/false) when its not
2) you need to use == in conditional (if/else) statements, not =

And I thought you DIDNT want them to use the command? I 'm confused.
Reply
#5

If I do like this:
Код:
if(strcmp(cmdtext, "/pickup", true)==0)
	{
        if(playerDB[playerid][cuffed]) return SendClientMessage(playerid,COLOR, "You cannot use this command while cuffed!");
		SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
		return 1;
	}
or this:
Код:
if(playerDB[playerid][cuffed]) return 1;
the player can use this command still. I just need disable the commands if player is cuffed.. So can anyone help me?
Reply
#6

perhaps that flag isnt getting set correctly when the player is actually cuffed?
Reply
#7

or maybe when he's testing the code he isn't with a cuffed person.
Reply
#8

I've tested with cuffed person. He can pick up hands and run away.. I don't konw what to do else.. I'll show you my cuff script:
Код:
if(!strcmp(cmdtext, "/cuff", true,4))
	{
 		if(playerDB[playerid][specialybe]!=1){SendClientMessage(playerid,Color,"* This command only for cops"); return 1;}
 		if(cmdtext[4]==0){SendClientMessage(playerid,melyna,"* Cuff/uncuff player: /cuff [partofname]"); return 1;}
 		new vardas[MAX_PLAYER_NAME];
 		strmid(vardas,cmdtext[5],0,MAX_PLAYER_NAME);
  	new id = GetPlayeridMid(vardas);
		if (id == INVALID_PLAYER_ID){ SendClientMessage(playerid, Color, "* Wrong name."); return 1;}
		if (id == playerid){ SendClientMessage(playerid, Color, "* You cant cuff/uncuff yourself"); return 1;}
		new Float:Coo[3];
		GetPlayerPos(id,Coo[0],Coo[1],Coo[2]);
		if(!PlayerToPoint(3, playerid, Coo[0],Coo[1],Coo[2])){SendClientMessage(playerid, Color, "* Player too far..."); return 1;}
		
		new msg[128],police[MAX_PLAYER_NAME];
		GetPlayerName(playerid,police,sizeof(police));
		GetPlayerName(id,vardas,sizeof(vardas));
		
		if(playerDB[id][cuffed])
		{
		  playerDB[id][cuffed]=false;
		  TogglePlayerControllable(id,false);
		  
		  format(msg,sizeof(msg),"You've cuffed %s.",vardas);
			SendClientMessage(playerid,Color,msg);
			
			format(msg,sizeof(msg),"You've been cuffed by%s.",police);
			SendClientMessage(id,Color,msg);
		  
		}else{
		  playerDB[id][cuffed]=true;
		  TogglePlayerControllable(id,true);

		  format(msg,sizeof(msg),"You've uncuffed %s.",vardas);
			SendClientMessage(playerid,Color,msg);

			format(msg,sizeof(msg),"You've been uncuffed by %s .",police);
			SendClientMessage(id,Color,msg);
		
		}
  		return 1;
 	}
I hope this will help for you to help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)