Command Issues[zcmd]
#1

How do I make this command for Cops only? and with this script and I log in it still says, You dont have pair of cuffs

pawn Код:
CMD:cuff(playerid, params[])
{
    if(gTeam[playerid] == TEAM_COPS) return SCM(playerid, COLOR_RED, "You dont have a pair of cuffs");
    new targetid;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /cuff [Part of Name/Player 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[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 have placed %s in handcuffs.",target);
            SendClientMessage(playerid, 0xE01B1B, str);
            format(str, sizeof(str), "CUFFED: You have been cuffed by officer %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;
           
        }
       
       
    }
    return 1;
}

CMD:uncuff(playerid, params[])
{
    if(gTeam[playerid] == TEAM_COPS) return SCM(playerid, COLOR_RED, "You dont have a pair of cuffs");
    new targetid;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /uncuff [Part of Name/Player 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), "INFO: You have taken the cuffs off %s!",target);
            SendClientMessage(playerid, 0xE01B1B, str);
            format(str, sizeof(str), "UNCUFFED: You have been uncuffed by officer %s!",name);
            SendClientMessage(targetid, 0xE01B1B, str);
            return 1;
           
        }
       
       
    }
    return 1;
}
EVen if IM cop it doesnt work, just says you dont have pair of cuffs
Urgent
Reply
#2

This:
if(gTeam[playerid] == TEAM_COPS) return SCM(playerid, COLOR_RED, "You dont have a pair of cuffs");
Should be like this:
if(gTeam[playerid] == TEAM_COPS) return SCM(playerid, COLOR_RED, "You aren't a Police Officer.");

And you need to add this gTeam[playerid] = TEAM_COPS; on OnPlayerRequestClass in the case of the cop skin.
Reply
#3

pawn Код:
if(gTeam[playerid] == TEAM_COPS) return SCM(playerid, COLOR_RED, "You dont have a pair of cuffs");
means if player is a cop then say You don't have a pair of cuffs

so should be like this

pawn Код:
if(gTeam[playerid] != TEAM_COPS) return SCM(playerid, COLOR_RED, "You dont have a pair of cuffs");
it means if player is not a cop
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)