14.05.2013, 15:05
Hello players of SA-MP.
I would like some help with my /uncuff command.
When I try to use the command, the cuffs are still attached to the player.
I would like some help with my /uncuff command.
When I try to use the command, the cuffs are still attached to the player.
pawn Код:
command(cuff, playerid, params[])
{
new ID, string[64];
if(Factions[Player[playerid][Faction]][fType] == 1)
{
if(FactionDuty[playerid] == 0)return SendClientMessage(playerid, GREY, "You must be on Duty to perform this command.");
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, GREY, "Usage: /cuff [player id or name]");
if(IsPlayerConnected(ID))
{
if(ID != playerid)
{
if(GetDistanceBetweenPlayers(playerid, ID) < 4)
{
if(pCuffed[ID] == 0)
{
pCuffed[ID] = 1;
format(string, sizeof(string), "* %s has been hand-cuffed by %s. *", MaskName(ID), MaskName(playerid));
CloseMessage(playerid, ACTION, string);
SetPlayerSpecialAction(ID, SPECIAL_ACTION_CUFFED);
SetPlayerAttachedObject(ID, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
ClearAnimations(ID);
pTazed[ID] = 0;
}
else return SendClientMessage(playerid, WHITE, "That player is already cuffed.");
}
else return SendClientMessage(playerid, GREY, "You must be close to the player.");
}
else return SendClientMessage(playerid, WHITE, "You can't cuff your self.");
}
else return SendClientMessage(playerid, GREY, NotConnected);
}
else return SendClientMessage(playerid, WHITE, FactionOnly);
return 1;
}
pawn Код:
command(uncuff, playerid, params[])
{
new string[128], ID;
if(Factions[Player[playerid][Faction]][fType] == 1)
{
if(FactionDuty[playerid] == 0)return SendClientMessage(playerid, GREY, "You must be on Duty to perform this command.");
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, GREY, "Usage: /uncuff [player id or name]");
if(IsPlayerConnected(ID))
{
if(ID != playerid)
{
if(GetDistanceBetweenPlayers(playerid, ID) < 4)
{
if(pCuffed[ID] == 1)
{
pCuffed[ID] = 0;
format(string, sizeof(string), "* %s has been uncuffed by %s. *", MaskName(ID), MaskName(playerid));
CloseMessage(playerid, ACTION, string);
TogglePlayerControllable(ID, true);
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)if(IsPlayerAttachedObjectSlotUsed(playerid, ID)) RemovePlayerAttachedObject(ID, i);
SetPlayerSpecialAction(ID, SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(playerid,);
}
else return SendClientMessage(playerid, WHITE, "That player isn't cuffed.");
}
else return SendClientMessage(playerid, GREY, "You must be close to the player.");
}
else return SendClientMessage(playerid, WHITE, "You can't uncuff yourself.");
}
else return SendClientMessage(playerid, GREY, NotConnected);
}
else return SendClientMessage(playerid, WHITE, FactionOnly);
return 1;
}