[Help] You are in DM /kill to leave
#1

Hey everyone,

I have some minigames I know how to make it, but I need disable ALL commands for players that has joined a minigame.
When a player in a minigame try a command he will see this: You are currectly in DM /kill to leave.
How can I make that?

I have try a lot of things but it didnt work by me, because I got errors/warnings.
Can anyone tell me more about it?

Thanks

micks0087
Reply
#2

Quote:
Originally Posted by mickos0087
Посмотреть сообщение
Hey everyone,

I have some minigames I know how to make it, but I need disable ALL commands for players that has joined a minigame.
When a player in a minigame try a command he will see this: You are currectly in DM /kill to leave.
How can I make that?

I have try a lot of things but it didnt work by me, because I got errors/warnings.
Can anyone tell me more about it?

Thanks

micks0087
You could add in all commands if((*your event array variable*)playerinfo[playerid][inevent] == 1)return SendClientMessage(playerid, COLOR_ERROR, "You can't use that command right now");
But that requre alot of work if you got many command and there may be some other way that i don't know about.
Reply
#3

Make a variable/bool, and set it true when the player joins a minigame. And if they type commands, check if the Boolean is false, and if it is, it continues on with the command.

Use SendClientMessage on the second part, although I think you already know this. We would need to see some code if you want us to add it ourselves.
Reply
#4

Ahh oke thank all, I gonna try to make it thanks
Reply
#5

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Make a variable/bool, and set it true when the player joins a minigame. And if they type commands, check if the Boolean is false, and if it is, it continues on with the command.

Use SendClientMessage on the second part, although I think you already know this. We would need to see some code if you want us to add it ourselves.
since there is already a topic about this, let me hijack it xD

if I have that you said here, how can I let some commands pass trough then?

like /leave must work.
Reply
#6

pawn Код:
//create a global player array
new bool: bIsInDM[MAX_PLAYERS];

//when you send a player to the DM (or whatever)

bIsInDM[playerid] = true;

COMMAND:leave(playerid, params[])
{
    if( bIsInDM[playerid] )//check if player is in DM
    {
        //player is in DM remove them
       
        bIsInDM[playerid] = false;
    }
    else
    {
        //player is not in dm
    }
    return 1;
}
Reply
#7

thankyou very much, and very helpful!
Reply
#8

Or this:
pawn Код:
// Create's the In an Event variable.
new IsInEvent[MAX_PLAYERS];

// The Command you wanted:

CMD:kill(playerid, params[])
{
    if(!IsInEvent)// Check's if the Player is in a DM.
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a DM!");
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "You have left the DM area!");
        SetPlayerPos(playerid,1766.5635,-1847.7111,13.5781); // Teleports them to Los Santos.
        IsInEvent[playerid] = 0; // Sets them to not being in a DM.
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by iggy1
Посмотреть сообщение
pawn Код:
//create a global player array
new bool: bIsInDM[MAX_PLAYERS];

//when you send a player to the DM (or whatever)

bIsInDM[playerid] = true;

COMMAND:leave(playerid, params[])
{
    if( bIsInDM[playerid] )//check if player is in DM
    {
        //player is in DM remove them
       
        bIsInDM[playerid] = false;
    }
    else
    {
        //player is not in dm
    }
    return 1;
}
so what is the difference creating new bool
and
new
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)