SA-MP Forums Archive
Help With Cuff and Uncuff Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help With Cuff and Uncuff Command (/showthread.php?tid=114532)



Help With Cuff and Uncuff Command - hector_williams - 19.12.2009

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;
	}



Re: Help With Cuff and Uncuff Command - LarzI - 19.12.2009

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


Re: Help With Cuff and Uncuff Command - hector_williams - 19.12.2009

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;
}


Re: Help With Cuff and Uncuff Command - LarzI - 19.12.2009

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


Re: Help With Cuff and Uncuff Command - Steven82 - 15.03.2010

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



Re: Help With Cuff and Uncuff Command - Deat_Itself - 15.03.2010

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;
	}



Re: Help With Cuff and Uncuff Command - Steven82 - 17.03.2010

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;
	}