[Help] Handcuffs object
#1

Hello

I
have a problem whith my cuff code, when i tape /cuff + id the objet was present and the and the hands of the player was cuffed, but when i want to remove the cuff on the player nothing happened, the player stay handcuffed





my code for cuff


PHP код:
if(strcmp(cmd"/cuff"true)==0||strcmp(cmd"/cu"true) ==|| strcmp(cmd"/cuff"true) == 0
    
//if(strcmp(cmd, "/menotter", true) == 0 || strcmp(cmd, "/men", true) == 0) 
    

        if(
IsPlayerConnected(playerid)) 
        { 
            if(
gTeam[playerid] == || IsACop(playerid)) 
            { 
                
tmp strtok(cmdtextidx); 
                if(!
strlen(tmp)) { 
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /menotter [Playerid/PartOfName]"); 
                    return 
1
                } 
                
giveplayerid ReturnUser(tmp); 
                if(
IsPlayerConnected(giveplayerid)) 
                { 
                    if(
giveplayerid != INVALID_PLAYER_ID
                    { 
                     
                        if(
gTeam[giveplayerid] == || IsACop(giveplayerid)) 
                        { 
                            
SendClientMessage(playeridCOLOR_GREY"You can not handcuff a policeman!"); 
                            return 
1
                        } 
                        if(
PlayerCuffed[giveplayerid] == 2
                        { 
                            
SendClientMessage(playeridCOLOR_GREY"Player already handcuffed!"); 
                            return 
1
                        } 
                        if (
ProxDetectorS(8.0playeridgiveplayerid)) 
                        { 
                            if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"You can not handcuff yourself!"); return 1; } 
                            if(
GetPlayerState(giveplayerid) != GetPlayerState(playerid)) { SendClientMessage(playeridCOLOR_GREY"This player must be outside the vehicle (or you must be outside)"); return 1; } 
                            if(
GetPlayerState(playerid) == 1
                            { 
                           
SetPlayerSpecialAction(giveplayeridSPECIAL_ACTION_CUFFED); 
                           
                             
SetPlayerAttachedObject(giveplayerid0194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000); 
      
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer)); 
                                
GetPlayerName(playeridsendernamesizeof(sendername)); 
                                
format(stringsizeof(string), "You were handcuffed by %s, until a police officer handcuff you."sendername); 
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring); 
                                
format(stringsizeof(string), "You have handcuffs %s, until a police officer handcuff you."giveplayer); 
                                
SendClientMessage(playeridCOLOR_WHITEstring); 
                                
format(stringsizeof(string), " %s handcuffed to %s, "sendername ,giveplayer); 
                                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
                                
GameTextForPlayer(giveplayerid"~r~Menotter"25003); 
                                
TogglePlayerControllable(giveplayerid0); 
                                
PlayerCuffed[giveplayerid] = 0
                                
PlayerCuffedTime[giveplayerid] = 99999999999999
                            } 
                            else 
                            { 
                                
SendClientMessage(playeridCOLOR_GREY"This player is not in your car, or you are not the driver!"); 
                                return 
1
                            } 
                        } 
                        else 
                        { 
                            
SendClientMessage(playeridCOLOR_GREY"That player is not near you!"); 
                            return 
1
                        } 
                    } 
                } 
                else 
                { 
                    
SendClientMessage(playeridCOLOR_GREY"This player is not connected!"); 
                    return 
1
                } 
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREY"Vous n'кtes pas policier!"); 
            } 
        } 
        return 
1
    } 
my code for uncuff



PHP код:
if(strcmp(cmd"/uncuff"true) == || strcmp(cmd"/demenotter"true) == || strcmp(cmd"/demenoter"true) == 0
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if(
gTeam[playerid] == 2
            { 
                
tmp strtok(cmdtextidx); 
                if(!
strlen(tmp)) { 
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /demenotter [Playerid/PartOfName]"); 
                    return 
1
                } 
                
giveplayerid ReturnUser(tmp); 
                if(
IsPlayerConnected(giveplayerid)) 
                { 
                    if(
giveplayerid != INVALID_PLAYER_ID
                    { 
                        if (
ProxDetectorS(8.0playeridgiveplayerid)) 
                        { 
                            if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"Vous ne pouvez pas vous demenotter vous mкme!"); return 1; } 
                            if(
PlayerCuffed[giveplayerid] == 2
                            { 
                             
                                  
SetPlayerSpecialAction(giveplayeridSPECIAL_ACTION_NONE); 
                         
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer)); 
                                
GetPlayerName(playeridsendernamesizeof(sendername)); 
                                
format(stringsizeof(string), "Vous avez йtй demenottй par %s."sendername); 
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring); 
                                
format(stringsizeof(string), "Vous avez dйmenottй %s."giveplayer); 
                                
SendClientMessage(playeridCOLOR_WHITEstring); 
                                
GameTextForPlayer(giveplayerid"~g~Demenotter"25003); 
                                
TogglePlayerControllable(giveplayerid1); 
                                
PlayerCuffed[giveplayerid] = 0
                            } 
                            else 
                            { 
                                
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas menottй!"); 
                                return 
1
                            } 
                        } 
                        else 
                        { 
                            
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas prиs de vous!"); 
                            return 
1
                        } 
                    } 
                } 
                else 
                { 
                    
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas connectй!"); 
                    return 
1
                } 
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREY"Vous n'кtes pas policier!"); 
            } 
        }
//not connected 
        
return 1

thank you for your help !
Reply
#2

You need to remove the attached object and reset the special action (set it to 0).

pawn Код:
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE ); //not sure if this is needed, honestly.
RemovePlayerAttachedObject( playerid, 0 );
Reply
#3

Quote:
Originally Posted by LarzI
Посмотреть сообщение
You need to remove the attached object and reset the special action (set it to 0).

pawn Код:
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE ); //not sure if this is needed, honestly.
RemovePlayerAttachedObject( playerid, 0 );
Still the same problem my code is wrong no ?

PHP код:
if(strcmp(cmd"/menotter"true)==0||strcmp(cmd"/cu"true) ==|| strcmp(cmd"/cuff"true) == 0)
    
//if(strcmp(cmd, "/menotter", true) == 0 || strcmp(cmd, "/men", true) == 0)
    
{
        if(
IsPlayerConnected(playerid))
        {
            if(
gTeam[playerid] == || IsACop(playerid))
            {
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp)) {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /menotter [Playerid/PartOfName]");
                    return 
1;
                }
                
giveplayerid ReturnUser(tmp);
                if(
IsPlayerConnected(giveplayerid))
                {
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(
gTeam[giveplayerid] == || IsACop(giveplayerid))
                        {
                            
SendClientMessage(playeridCOLOR_GREY"Vous ne pouvez pas menotter un policier!");
                            return 
1;
                        }
                        if(
PlayerCuffed[giveplayerid] == 2)
                        {
                            
SendClientMessage(playeridCOLOR_GREY"Joueur dйjа menottй!");
                            return 
1;
                        }
                        if (
ProxDetectorS(8.0playeridgiveplayerid))
                        {
                            if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"Vous ne pouvez pas vous menotte vous mкme!"); return 1; }
                            if(
GetPlayerState(giveplayerid) != GetPlayerState(playerid)) { SendClientMessage(playeridCOLOR_GREY"Ce joueur doit etre en dehors du vйhicule (ou vous devez etre en dehors)"); return 1; }
                            if(
GetPlayerState(playerid) == 1)
                            {
                            
                             
SetPlayerSpecialAction(giveplayeridSPECIAL_ACTION_CUFFED);
                             
SetPlayerAttachedObject(giveplayerid0194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                            
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                                
GetPlayerName(playeridsendernamesizeof(sendername));
                                
format(stringsizeof(string), "Vous avez йtй menottй par %s, jusqu'а ce qu'un policier vous dйmenotte."sendername);
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                                
format(stringsizeof(string), "Vous avez menottй %s, jusqu'a ce qu'un policier vous dйmenotte."giveplayer);
                                
SendClientMessage(playeridCOLOR_WHITEstring);
                                
format(stringsizeof(string), " %s а menottй %s, il ne poura allez nul part."sendername ,giveplayer);
                                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                
GameTextForPlayer(giveplayerid"~r~Menotter"25003);
                                
TogglePlayerControllable(giveplayerid0);
                                
PlayerCuffed[giveplayerid] = 2;
                                
PlayerCuffedTime[giveplayerid] = 99999999999999;
                            }
                            else
                            {
                                
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas dans votre voiture, ou vous n'кtes pas le conducteur!");
                                return 
1;
                            }
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas prиs de vous!");
                            return 
1;
                        }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas connectй!");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"Vous n'кtes pas policier!");
            }
        }
        return 
1;
    }
    if(
strcmp(cmd"/uncuff"true) == || strcmp(cmd"/demenotter"true) == || strcmp(cmd"/demenoter"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
gTeam[playerid] == 2)
            {
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp)) {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /demenotter [Playerid/PartOfName]");
                    return 
1;
                }
                
giveplayerid ReturnUser(tmp);
                if(
IsPlayerConnected(giveplayerid))
                {
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                        if (
ProxDetectorS(8.0playeridgiveplayerid))
                        {
                            if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"Vous ne pouvez pas vous demenotter vous mкme!"); return 1; }
                            if(
PlayerCuffed[giveplayerid] == 2)
                            {
                            
                                
RemovePlayerAttachedObjectplayerid);
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                                
GetPlayerName(playeridsendernamesizeof(sendername));
                                
format(stringsizeof(string), "Vous avez йtй demenottй par %s."sendername);
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                                
format(stringsizeof(string), "Vous avez dйmenottй %s."giveplayer);
                                
SendClientMessage(playeridCOLOR_WHITEstring);
                                
GameTextForPlayer(giveplayerid"~g~Demenotter"25003);
                                
TogglePlayerControllable(giveplayerid1);
                                
PlayerCuffed[giveplayerid] = 0;
                            }
                            else
                            {
                                
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas menottй!");
                                return 
1;
                            }
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas prиs de vous!");
                            return 
1;
                        }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas connectй!");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"Vous n'кtes pas policier!");
            }
        }
//not connected
        
return 1;
    } 
Reply
#4

Well yes, you need to use 'giveplayerid' in the RemoveAttachedPlayerObject function call. You're not going to remove it from yourself, but from the player you've selected.
Reply
#5

Ok dude, i must do what ? please
Reply
#6

I just told you
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
I just told you
I do not know how to implement :/
Reply
#8

Ah, you simply misunderstand completely. You've put
pawn Код:
RemovePlayerAttachedObject( playerid, 0 );
but that will remove it from the player doing the command, not the player you're uncuffing.
pawn Код:
RemovePlayerAttachedObject( giveplayerid, 0 );
This would be the correct code.
Reply
#9

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Ah, you simply misunderstand completely. You've put
pawn Код:
RemovePlayerAttachedObject( playerid, 0 );
but that will remove it from the player doing the command, not the player you're uncuffing.
pawn Код:
RemovePlayerAttachedObject( giveplayerid, 0 );
This would be the correct code.

PHP код:
if(strcmp(cmd"/uncuff"true) == || strcmp(cmd"/demenotter"true) == || strcmp(cmd"/demenoter"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
gTeam[playerid] == 2)
            {
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp)) {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /demenotter [Playerid/PartOfName]");
                    return 
1;
                }
                
giveplayerid ReturnUser(tmp);
                if(
IsPlayerConnected(giveplayerid))
                {
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                        if (
ProxDetectorS(8.0playeridgiveplayerid))
                        {
                            if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"Vous ne pouvez pas vous demenotter vous mкme!"); return 1; }
                            if(
PlayerCuffed[giveplayerid] == 2)
                            {
                            
                               [
B][COLOR="Red"RemovePlayerAttachedObjectgiveplayerid);[/COLOR][/B]
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                                
GetPlayerName(playeridsendernamesizeof(sendername));
                                
format(stringsizeof(string), "Vous avez йtй demenottй par %s."sendername);
                                
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                                
format(stringsizeof(string), "Vous avez dйmenottй %s."giveplayer);
                                
SendClientMessage(playeridCOLOR_WHITEstring);
                                
GameTextForPlayer(giveplayerid"~g~Demenotter"25003);
                                
TogglePlayerControllable(giveplayerid1);
                                
PlayerCuffed[giveplayerid] = 0;
                            }
                            else
                            {
                                
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas menottй!");
                                return 
1;
                            }
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas prиs de vous!");
                            return 
1;
                        }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Ce joueur n'est pas connectй!");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"Vous n'кtes pas policier!");
            }
        }
//not connected
        
return 1;
    } 
It does not work dude..
my code is wrong ?
Reply
#10

Well what doesn't work? Is he still holding his hands like he's cuffed? Is he still having the cuffs on his hands? I need a detailed report to help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)