SA-MP Forums Archive
Need a little help with some player checks - 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: Need a little help with some player checks (/showthread.php?tid=404291)



Need a little help with some player checks - mickos - 02.01.2013

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


Re: Need a little help with some player checks - Faisal_khan - 02.01.2013

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



Re: Need a little help with some player checks - InfiniTy. - 02.01.2013

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;



Re: Need a little help with some player checks - mickos - 02.01.2013

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

IsCaged[playerid] = 0;

do I need to put in every command to? or..


Re: Need a little help with some player checks - InfiniTy. - 02.01.2013

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.


Re: Need a little help with some player checks - Faisal_khan - 02.01.2013

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



Re: Need a little help with some player checks - DaRk_RaiN - 02.01.2013

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;


Re: Need a little help with some player checks - mickos - 02.01.2013

Thank you all guys for your help!!!!

I give Y'all +rep!

Thanks