30.01.2013, 10:15
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
my code for uncuff
thank you for your help !
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) ==0 || strcmp(cmd, "/cuff", true) == 0)
//if(strcmp(cmd, "/menotter", true) == 0 || strcmp(cmd, "/men", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /menotter [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, "You can not handcuff a policeman!");
return 1;
}
if(PlayerCuffed[giveplayerid] == 2)
{
SendClientMessage(playerid, COLOR_GREY, "Player already handcuffed!");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can not handcuff yourself!"); return 1; }
if(GetPlayerState(giveplayerid) != GetPlayerState(playerid)) { SendClientMessage(playerid, COLOR_GREY, "This player must be outside the vehicle (or you must be outside)"); return 1; }
if(GetPlayerState(playerid) == 1)
{
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You were handcuffed by %s, until a police officer handcuff you.", sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have handcuffs %s, until a police officer handcuff you.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " %s handcuffed to %s, ", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Menotter", 2500, 3);
TogglePlayerControllable(giveplayerid, 0);
PlayerCuffed[giveplayerid] = 0;
PlayerCuffedTime[giveplayerid] = 99999999999999;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "This player is not in your car, or you are not the driver!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That player is not near you!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "This player is not connected!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Vous n'кtes pas policier!");
}
}
return 1;
}
PHP код:
if(strcmp(cmd, "/uncuff", true) == 0 || strcmp(cmd, "/demenotter", true) == 0 || strcmp(cmd, "/demenoter", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /demenotter [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Vous ne pouvez pas vous demenotter vous mкme!"); return 1; }
if(PlayerCuffed[giveplayerid] == 2)
{
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Vous avez йtй demenottй par %s.", sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "Vous avez dйmenottй %s.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
GameTextForPlayer(giveplayerid, "~g~Demenotter", 2500, 3);
TogglePlayerControllable(giveplayerid, 1);
PlayerCuffed[giveplayerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Ce joueur n'est pas menottй!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Ce joueur n'est pas prиs de vous!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Ce joueur n'est pas connectй!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Vous n'кtes pas policier!");
}
}//not connected
return 1;
thank you for your help !