Cuff/Uncuff for team only
#1

Hey guys, I've been trying to set these commands to COPS only but i don't know how to. I have tried a few but it just causes massive errors.

pawn Код:
CMD:cuff(playerid, params[])
{
    new targetid;
    if(sscanf(params, "r", targetid)) return SendClientMessage(playerid, -1, "   * /cuff  Name/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[60];
            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 have cuffed %s *",target);
            SendClientMessage(playerid, 0xE01B1B, str);
            format(str, sizeof(str), "   * 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);
            SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
        }

    }
    return 1;
}

CMD:uncuff(playerid, params[])
{
    new targetid;
    if(sscanf(params, "r", targetid)) return SendClientMessage(playerid, -1, "   * /uncuff  Name/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!");
            SetPlayerSpecialAction(targetid,SPECIAL_ACTION_NONE);
            new str[60];
            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 have uncuffed %s *",target);
            SendClientMessage(playerid, 0xE01B1B, str);
            format(str, sizeof(str), "   * You have been uncuffed by %s *",name);
            SendClientMessage(targetid, 0xE01B1B, str);
        }

    }
    return 1;
}
I've been trying to use gTeam[playerid] = Cops; in alot of diffrent ways
Reply
#2

if(gTeam[playerid] != Cops) return SendClientMessage(playerid, -1, "You aren't a cop!");

Have you tried this?

gTeam[playerid] = Cops would actually cause errors if your not trying to SET them to cop.
Reply
#3

Thank you it works perfectly! and no I did not try that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)