[Help] You are in DM /kill to leave -
mickos - 22.06.2012
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
Re: [Help] You are in DM /kill to leave -
Ranama - 22.06.2012
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.
Re: [Help] You are in DM /kill to leave -
Kindred - 22.06.2012
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.
Re: [Help] You are in DM /kill to leave -
mickos - 22.06.2012
Ahh oke thank all, I gonna try to make it thanks
Re: [Help] You are in DM /kill to leave -
denNorske - 22.06.2012
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.
Re: [Help] You are in DM /kill to leave -
iggy1 - 22.06.2012
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;
}
Re: [Help] You are in DM /kill to leave -
denNorske - 23.06.2012
thankyou very much, and very helpful!
Re: [Help] You are in DM /kill to leave -
Dubya - 23.06.2012
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;
}
Re: [Help] You are in DM /kill to leave -
denNorske - 23.06.2012
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