Help With Cuff and Uncuff Command
#1

Hi, I have a cuff and uncuff command, it works but instead of cuffing the player ID it only cuffs the person who uses the command.
Im new the scripting so if you know how to fix it, it would be benificial to help explain to my why it went wrong.
Thanks
here is the script
Код:
	if(!strcmp(cmd,"/cuff",true))
	if(gTeam[playerid] == 2 || IsACop(playerid))
	{
		cmd=strtok(cmdtext,idx);
		if(!strlen(cmd)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /cuff playerid");
		giveplayerid = ReturnUser(tmp);
		if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
		TogglePlayerControllable(playerid,0);
		GameTextForPlayer(playerid, "~y~ You have been Cuffed!",2500,3);
		return true;
	}
	if(!strcmp(cmd,"/uncuff",true))
	if(gTeam[playerid] == 2 || IsACop(playerid))
	{
		cmd=strtok(cmdtext,idx);
		if(!strlen(cmd)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /uncuff playerid");
		giveplayerid = ReturnUser(tmp);
		if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
		TogglePlayerControllable(playerid,1);
		GameTextForPlayer(playerid, "~y~ You have been Uncuffed!",2500,3);
		return true;
	}
Reply
#2

pawn Код:
if(!strcmp(cmd,"/cuff",true))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid))
    {
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /cuff playerid");
        giveplayerid = ReturnUser(tmp);
        if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
        TogglePlayerControllable(giveplayerid,0);
        GameTextForPlayer(giveplayerid, "~y~ You have been Cuffed!",2500,3);
    }
    return true;
    }
pawn Код:
if(!strcmp(cmd,"/uncuff",true))
    {  
    if(gTeam[playerid] == 2 || IsACop(playerid))
    {
        tmp=strtok(cmdtext,idx);
        if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /uncuff playerid");
        giveplayerid = ReturnUser(tmp);
        if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
        TogglePlayerControllable(giveplayerid,1);
        GameTextForPlayer(giveplayerid, "~y~ You have been Uncuffed!",2500,3);
    }
I cba to fix the indentation
Reply
#3

I figured it was something like that, thanks
i think you forgot
a return value
if(!strcmp(cmd,"/uncuff",true))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp=strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /uncuff playerid");
giveplayerid = ReturnUser(tmp);
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
TogglePlayerControllable(giveplayerid,1);
GameTextForPlayer(giveplayerid, "~y~ You have been Uncuffed!",2500,3);
}
return true;
}
Reply
#4

Oh sorry, was abit fast there.
Yeah I forgot to add
pawn Код:
return true;
}
Silly me
Reply
#5

Would it be possible to not make the commands with a team but make with a skin id?
Reply
#6

Quote:
Originally Posted by Steven82
Would it be possible to not make the commands with a team but make with a skin id?
yeah its possible


if(GetPlayerSkin(playerid) == 293)//293 is a skin

an e.g
Код:
if(!strcmp(cmd,"/cuff",true))
	{
	if(GetPlayerSkin(playerid) == 293) || IsACop(playerid))
	{
		tmp=strtok(cmdtext,idx);
		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /cuff playerid");
		giveplayerid = ReturnUser(tmp);
		if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
		TogglePlayerControllable(giveplayerid,0);
		GameTextForPlayer(giveplayerid, "~y~ You have been Cuffed!",2500,3);
	}
	return true;
	}
Reply
#7

I just got like 6 error when using this code.

Код:
if(!strcmp(cmd,"/cuff",true))
	{
	if(GetPlayerSkin(playerid) == 293) || IsACop(playerid))
	{
		tmp=strtok(cmdtext,idx);
		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /cuff playerid");
		giveplayerid = ReturnUser(tmp);
		if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
		TogglePlayerControllable(giveplayerid,0);
		GameTextForPlayer(giveplayerid, "~y~ You have been Cuffed!",2500,3);
	}
	return true;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)