Unknown Command
#6

Try this code, it's untested but should work.

pawn Код:
CMD:uncuff(playerid, params[])
{
    if(GetPlayerTeam(playerid) != TEAM_SWAT)
    if(GetPlayerTeam(playerid) != TEAM_CIA)
    if(GetPlayerTeam(playerid) != TEAM_COP)
    return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command!");
    new targetid;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /uncuff [id]");
    if(IsPlayerConnected(targetid))
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        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];
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            new target[MAX_PLAYER_NAME];
            GetPlayerName(targetid, target, sizeof(target));
            format(str, sizeof(str), "You removed %s's cuffs",target);
            SendClientMessage(playerid, 0xE01B1B, str);
            format(str, sizeof(str), "You have been uncuffed by %s",name);
            SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
        }
    }
    return 1;
}

CMD:cuff(playerid, params[])
{
    if(GetPlayerTeam(playerid) != TEAM_SWAT) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command!");
    if(GetPlayerTeam(playerid) != TEAM_CIA) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command!");
    if(GetPlayerTeam(playerid) != TEAM_COP) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command!");
    new targetid;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /cuff [id]");
    if(IsPlayerConnected(targetid))
    {
        if (GetPlayerWantedLevel(playerid < 1)) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}That player is not wanted!");
        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];
            GetPlayerName(playerid, name, sizeof(name));
            new target[MAX_PLAYER_NAME];
            GetPlayerName(targetid, target, sizeof(target));
            format(str, sizeof(str), "You did set cuffs on %s!",target);
            SendClientMessage(playerid, 0xE01B1B, str);
            format(str, sizeof(str), "You have been cuffed by %s",name);
            SendClientMessage(targetid, COLOR_LIGHTBLUE, str);
            SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
            SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
        }
    }
    return 1;
}
Reply


Messages In This Thread
Unknown Command - by NathNathii - 13.04.2013, 18:09
Re: Unknown Command - by Igal-A - 13.04.2013, 18:29
Re: Unknown Command - by NathNathii - 13.04.2013, 18:31
Re: Unknown Command - by kalanerik99 - 13.04.2013, 18:31
Re: Unknown Command - by NathNathii - 13.04.2013, 18:37
Re: Unknown Command - by JJB562 - 13.04.2013, 21:08
Re: Unknown Command - by NathNathii - 13.04.2013, 21:16
Re: Unknown Command - by JJB562 - 13.04.2013, 21:20
Re: Unknown Command - by NathNathii - 13.04.2013, 21:22
Re: Unknown Command - by JJB562 - 13.04.2013, 21:33

Forum Jump:


Users browsing this thread: 1 Guest(s)