SA-MP Forums Archive
disable commands while jailed - 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: disable commands while jailed (/showthread.php?tid=422699)



disable commands while jailed - Ananisiki - 14.03.2013

^^^^^^^^


Re: disable commands while jailed - Scenario - 14.03.2013

Are you setting jailed[playerid] to 1 when you jail the player?

Also, don't use "return 0;" in the command, it'll cause issues. Just use "return 1;", it stops the command from processing.


Re: disable commands while jailed - Jewell - 15.03.2013

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(jailed[playerid] == 1)
    {
      SendClientMessage(playerid,red,"You cannot use commands while in Jail!");
      return 0;
    }
    return 1;
}



Re: disable commands while jailed - Ananisiki - 15.03.2013

^^^^^^^^


Re: disable commands while jailed - Denying - 15.03.2013

Just make something like this:
pawn Код:
CMD:blabla(blabla .. )
{
    if(Jailed[playerid] == 1) return SendClientMessage(playerid, color, "You are jailed, therefore you may not use
    commands"
);
    end of command.
    return 1;
}
In every command. ( I don't know any callback to ZCMD commands. Such as OnPlayerCommandText )


Re: disable commands while jailed - Ananisiki - 15.03.2013

^^^^^^^^


Re: disable commands while jailed - Denying - 15.03.2013

Try..
pawn Код:
CMD:armour(playerid, params[])
{
    if(Jailed[playerid] == 1) return SendClientMessage(playerid, -1, "You are jailed, therefore you may not use any command!");
    new string[128], name[MAX_PLAYER_NAME], Float:armour;
    if(jailed[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Jailed.");
    }
    if(isDead[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    }
    GetPlayerArmour(playerid, armour);
    if(armour >= 100)
    {
        SendClientMessage(playerid, COLOR_RED, "Your Armour Is Already Full.");
    }
    else
    {
        GetPlayerName(playerid, name, sizeof name);
        format(string, sizeof string, "%s (%d) Has Used /armour To Refill His Armour.", name, playerid);
        SetPlayerChatBubble(playerid, "Has Refilled His Armour (/a)", COLOR_YELLOW, 60, 3000);
        MessageToAllAdmins(string, COLOR_FLBLUE);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Refilled Your Armour.");
        SetPlayerArmour(playerid, 100.0);
    }
    return 1;
}



Re: disable commands while jailed - Cameltoe - 15.03.2013

OnPlayerCommandReceived(playerid, cmdtext[])

Check if the player is jailed under this callback, and return 0 if he is;