Need a little help with some player checks
#1

Hey guys,

I have an admin system, it works good, there is only one thing what I need to know...
Example; I /cage /jail /freeze a player, they are succesfully caged or jailed or freezed.. But if they use a command, just likes /kill or anything they can excape from they punishment. Now is my question, how can I make a check if a player is caged, freezed or jailed..

And if a player is caged he will see:

Sorry, you are currently caged... You must be wait.

And if a player is jailed he will see:

Sorry, you are currently jailed... You must be wait.

And if a player is freezed he will see:

Sorry, you are currently freezed... You must be wait.

How can I make this?

I think If player caged = 1)) or not?

Please let me show..

Thanks
Reply
#2

Like this?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true) == 0)
    {
        if(caged = 1)
        {
            SendClientMessage(playerid, -1, "You are caged!");
        }
        else
        {
            SetPlayerHealth(playerid, 0);
        }
        return 1;
    }
    return 0;
}
Reply
#3

I will just give you an example for caged.
At the top
pawn Код:
new IsCaged[MAX_PLAYERS];
In the script where you execute command cage on him(obviously instead of targetid put the id that player has been caged)
pawn Код:
IsCaged[targetid] = 1;
On kill command
pawn Код:
if(IsCaged[playerid] == 1) return SendClientMessage(playerid,-1,"Nope.");
Uncage comand
pawn Код:
IsCaged[playerid] = 0;
Reply
#4

Ah oke, I understand it. And this:
Quote:

IsCaged[playerid] = 0;

do I need to put in every command to? or..
Reply
#5

Quote:
Originally Posted by mickos
Посмотреть сообщение
Ah oke, I understand it. And this: do I need to put in every command to? or..
That means he is not caged anymore You put it in /uncage command or whatever command you have to uncage the player.
Reply
#6

What do you mean in every command?
You mean in /kill for Caged, Jailed or Freezed?
If yes, then:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true) == 0)
    {
        if(IsCaged[playerid] == 1 || IsJailed[playerid] == 1|| IsFreezed[playerid] == 1)
        {
            SendClientMessage(playerid, -1, "You cannot /kill now!");
        }
        else
        {
            SetPlayerHealth(playerid, 0);
        }
        return 1;
    }
    return 0;
}
Reply
#7

Quote:
Originally Posted by mickos
Посмотреть сообщение
Ah oke, I understand it. And this: do I need to put in every command to? or..
Yeah it command have to have its own variable like
Frozen[MAX_PLAYERS] Jailed[MAX_PLAYERS] ect.. else they will get bugged.
And make sure you deactivate the variable when you unfreeze/unjail,
For Example under the unfreeze command add
Frozen[playerid] = 0;
Reply
#8

Thank you all guys for your help!!!!

I give Y'all +rep!

Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)