Cuffing Command
#1

this applying the cuffs but not the animation and when you uncuff then cuffs don't go

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))
{
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];
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
GetPlayerName(playerid, name, sizeof(name));name.
new target[MAX_PLAYER_NAME];
GetPlayerName(targetid, target, sizeof(target))
format(str, sizeof(str), "INFO: You have cuffed %s!",target);
SendClientMessage(playerid, 0xE01B1B, str);
format(str, sizeof(str), "WARNING: You have been cuffed by %s!",name);
SendClientMessage(targetid, 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);
//this will set players hand backwards.
}
}
return 1;
}

CMD:uncuff(playerid, params[])//sfcs cmd.
{
new targetid;//this defines the id of the player you want to cuff((playerid id your id and the target id that I defined it the id of the player you want to cuff))
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /uncuff [Part of Name/Player ID]");
if(IsPlayerConnected(targetid))
{
new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
{
if(!SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000))return SendClientMessage(playerid,-1,"ERROR: The player is not cuffed!");//this will check that if the player is not cuffed and you are trying to apply this cmd,this will send him a error message.
SetPlayerSpecialAction(targetid,SPECIAL_ACTION_NONE);
new str[512];//this it the define for the string you will format further.((str means string.You can also change it to string but this seems to be easy.))
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new target[MAX_PLAYER_NAME];//this is the variable you created to store the name of the player you want to cuff.
GetPlayerName(targetid, target, sizeof(target));
format(str, sizeof(str), "INFO: You have uncuffed %s!",target);
SendClientMessage(playerid, 0xE01B1B, str);
format(str, sizeof(str), "WARNING: You have been uncuffed by %s!",name);//explained bellow.
SendClientMessage(targetid, 0xE01B1B, str);
if(PlayerInfo[playerid][pLeader] >= 1)
{
format(str, sizeof(str), "[Radio] %s Has Uncuffed %s",name,target);
SendClientMessage(targetid, 0xE01B1B, str);
}
if(PlayerInfo[playerid][pRank] >= 1)
{
format(str, sizeof(str), "[Radio] %s Has Uncuffed %s",name,target);
SendClientMessage(targetid, 0xE01B1B, str);
}
}
}
return 1;
}
Reply
#2

Don't know if this will work but try.

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))
{
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];
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
GetPlayerName(playerid, name, sizeof(name));
new target[MAX_PLAYER_NAME];
GetPlayerName(targetid, target, sizeof(target));
format(str, sizeof(str), "INFO: You have cuffed %s!",target);
SendClientMessage(playerid, 0xE01B1B, str);
format(str, sizeof(str), "WARNING: You have been cuffed by %s!",name);
SendClientMessage(targetid, 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);
//this will set players hand backwards.
}
}
return 1;
}

CMD:uncuff(playerid, params[])//sfcs cmd.
{
new targetid;//this defines the id of the player you want to cuff((playerid id your id and the target id that I defined it the id of the player you want to cuff))
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /uncuff [Part of Name/Player ID]");
if(IsPlayerConnected(targetid))
{
new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
{
if(!SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000))return SendClientMessage(playerid,-1,"ERROR: The player is not cuffed!");//this will check that if the player is not cuffed and you are trying to apply this cmd,this will send him a error message.
SetPlayerSpecialAction(targetid,SPECIAL_ACTION_NONE);
new str[512];//this it the define for the string you will format further.((str means string.You can also change it to string but this seems to be easy.))
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new target[MAX_PLAYER_NAME];//this is the variable you created to store the name of the player you want to cuff.
GetPlayerName(targetid, target, sizeof(target));
format(str, sizeof(str), "INFO: You have uncuffed %s!",target);
SendClientMessage(playerid, 0xE01B1B, str);
format(str, sizeof(str), "WARNING: You have been uncuffed by %s!",name);//explained bellow.
SendClientMessage(targetid, 0xE01B1B, str);
if(PlayerInfo[playerid][pLeader] >= 1)
{
format(str, sizeof(str), "[Radio] %s Has Uncuffed %s",name,target);
SendClientMessage(targetid, 0xE01B1B, str);
}
if(PlayerInfo[playerid][pRank] >= 1)
{
format(str, sizeof(str), "[Radio] %s Has Uncuffed %s",name,target);
SendClientMessage(targetid, 0xE01B1B, str);
}
}
}
return 1;
}
EDIT: Changed the code abit.
EDIT: Edited code to make it work without errors.
Reply
#3

Bump Nope
Reply
#4

add this

pawn Код:
RemovePlayerAttachedObject(giveplayerid,0);
Reply
#5

Код:
CMD:cuff(playerid, params[])//This is will create you cmd so you can continue your codes.
{
	new targetid;//this defines the id of the player you want to cuff((playerid id your id and the target id that I defined it the id of the player you want to cuff))
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /cuff [Part of Name/Player ID]");
	for(new i = 0; i < MAX_PLAYERS; i++)
  	if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 280 || GetPlayerSkin(i) == 265 || GetPlayerSkin(i) == 266 ||GetPlayerSkin(i) == 267  || GetPlayerSkin(i) == 165 || GetPlayerSkin(i) == 286 || GetPlayerSkin(i) == 284 || GetPlayerSkin(i) == 166 || GetPlayerSkin(i) == 283)
    if(IsPlayerConnected(targetid))//this will check that if the player you want to cuff is connected to the server or not.
    {
    new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
    GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
    if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))//this will check that if the player you want to cuff is near you or not.
    {
    new str[512];//this it the define for the string you will format further.((str means string.You can also change it to string but this seems to be easy.))
    new name[MAX_PLAYER_NAME];//this is the variable you created to store the your name.
    GetPlayerName(playerid, name, sizeof(name));//this will get your name and store it in the variable you defines as name.
    new target[MAX_PLAYER_NAME];//this is the variable you created to store the name of the player you want to cuff.
    GetPlayerName(targetid, target, sizeof(target));//this will get the name of the person you want to cuff and will store it into a variable we defined as target.
 	format(str, sizeof(str), "You have cuffed %s!",target);//explained at the end of the tutorial.
    SendClientMessage(playerid, 0xE01B1B, str);//this will send the formated message to you that you created before.
    format(str, sizeof(str), "You have been cuffed by Officer %s!",name);//explained at the end of the tutorial.
    SendClientMessage(targetid, 0xE01B1B, str);//this will send the formated message to the player you cuffed.
    SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);//this will set the object cuffs at the hand of the player you want to cuff.
    SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);//this will set players hand backwards.
    return 1;
    }

	}
    return 1;
}

CMD:uncuff(playerid, params[])//sfcs cmd.
{

        new targetid;//this defines the id of the player you want to cuff((playerid id your id and the target id that I defined it the id of the player you want to cuff))
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /uncuff [Part of Name/Player ID]");
        if(IsPlayerConnected(targetid))//this will check that if the player you want to cuff is connected to the server or not.
        {
        new Float:x, Float:y, Float:z;//these are the defines of your x,y and z position.
        GetPlayerPos(playerid, x, y, z);//this will store your position to be used in the following codes.((this stores the your x,y, and z position in to the variables we created.))
        for(new i = 0; i < MAX_PLAYERS; i++)
  		if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 280 || GetPlayerSkin(i) == 265 || GetPlayerSkin(i) == 266 ||GetPlayerSkin(i) == 267  || GetPlayerSkin(i) == 165 || GetPlayerSkin(i) == 286 || GetPlayerSkin(i) == 284 || GetPlayerSkin(i) == 166 || GetPlayerSkin(i) == 283)
        if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))//this will check that if the player you want to cuff is near you or not.
        {
        if(!SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000))return SendClientMessage(playerid,-1,"ERROR: The player is not cuffed!");//this will check that if the player is not cuffed and you are trying to apply this cmd,this will send him a error message.
        RemovePlayerAttachedObject(targetid,0);
        SetPlayerSpecialAction(targetid,SPECIAL_ACTION_NONE);//this will remove the players cuffs and his arms will go normal.
        new str[512];//this it the define for the string you will format further.((str means string.You can also change it to string but this seems to be easy.))
        new name[MAX_PLAYER_NAME];//this is the variable you created to store the your name.
        GetPlayerName(playerid, name, sizeof(name));//this will get your name and store it in the variable you defines as name.
        new target[MAX_PLAYER_NAME];//this is the variable you created to store the name of the player you want to cuff.
        GetPlayerName(targetid, target, sizeof(target));//this will get the name of the person you want to cuff and will store it into a variable we defined as target.
		format(str, sizeof(str), "You have uncuffed %s!",target);//explained at the end of the tutorial.
        SendClientMessage(playerid, 0xE01B1B, str);//will send the formated message to you that you created above.
        format(str, sizeof(str), "You have been uncuffed by Officer %s!",name);//explained bellow.
        SendClientMessage(targetid, 0xE01B1B, str);//will send the formated message to the player you want to cuff that you created above.
        return 1;
        }

        }
        return 1;
}
I've also made it that only cops can cuff players, if you use it for a RP server.
Reply
#6

thanks for that ill remove it until i put mine in
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)