SA-MP Forums Archive
Unknown Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Unknown Command (/showthread.php?tid=430387)



Unknown Command - NathNathii - 13.04.2013

I created /Cuff & /uncuff but it gives me SERVER: Unknown Command?

Commands
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;
                }

        }
        return 1;
}

CMD:cuff(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: /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;
}



Re: Unknown Command - Igal-A - 13.04.2013

try
PHP код:
CMD:uncuff(playeridparams[])
{
        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:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            if(
IsPlayerInRangeOfPoint(targetid5.0xyz))
                {
                    if(!
SetPlayerAttachedObject(targetid0194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977,-81.7000350.8919991.0000001.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(playeridnamesizeof(name));
                    new 
target[MAX_PLAYER_NAME];
                    
GetPlayerName(targetidtargetsizeof(target));
                    
format(strsizeof(str), "You removed %s's cuffs",target);
                    
SendClientMessage(playerid0xE01B1Bstr);
                    
format(strsizeof(str), "You have been uncuffed by %s",name);
                    
SendClientMessage(targetidCOLOR_LIGHTBLUEstr);
                }
        }
        return 
1;




Re: Unknown Command - NathNathii - 13.04.2013

Still the same..


Re: Unknown Command - kalanerik99 - 13.04.2013

Try this

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)
    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: /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;
}



Re: Unknown Command - NathNathii - 13.04.2013

Код:
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(312) : warning 217: loose indentation
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(312) : error 029: invalid expression, assumed zero
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(312) : error 017: undefined symbol "cmd_cuff"
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(312) : error 029: invalid expression, assumed zero
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(312) : fatal error 107: too many error messages on one line
Line 312:
pawn Код:
CMD:cuff(playerid, params[])



Re: Unknown Command - JJB562 - 13.04.2013

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;
}



Re: Unknown Command - NathNathii - 13.04.2013

Thanks, but is it possible to make it so SWAT, COP & CIA can only cuff the people with wanted level 1+?
So they can't cuff theirself or innocent people.


Re: Unknown Command - JJB562 - 13.04.2013

Change your /cuff command to this:

pawn Код:
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))
    {
        // These next two lines will make it so the player cannot cuff themselves, and can only cuff people with
        // a wanted level of 1+.
        if(GetPlayerWantedLevel(playerid) < 1)) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}That player is not wanted!");
        if(targetid == playerid) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You cannot cuff yourself!");
        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;
}



Re: Unknown Command - NathNathii - 13.04.2013

Код:
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(329) : error 029: invalid expression, assumed zero
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(329) : warning 215: expression has no effect
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(329) : error 001: expected token: ";", but found "return"
C:\Users\linda\Documents\LVCnR Testing\gamemodes\LVCnR.pwn(330) : warning 225: unreachable code



Re: Unknown Command - JJB562 - 13.04.2013

Can you show me the lines 329 and 330?