Disable /go to a player while he's in drag/duel/race
#1

How to disable /go to a player when hes in drag duel or race?

Example:

Player 1 go to /race
Player 2 try to go to Player 1

Gametextforplayer will appear to Player 2 "Can't use go while player is in Dm"
Reply
#2

in your /goto cmd
make a variable/bool check like
pawn Код:
if(IsPlayerInRace[playerid]==true) return //Player in the race
in order to use it you will need to do this
pawn Код:
//at the top
new IsPlayerInRace[MAX_PLAYERS];

//then when player enters the race add:
IsPlayerInRace[playerid]=1; //or "false" if using bool

//when the player leaves"
IsPlayerInRace[playerid]=0; //or "false" if using bool
Reply
#3

Declare a per-player global variable

pawn Код:
new InEvent[MAX_PLAYERS];
And when you set a player up for an event (drag/duel/race) set the value of this var to 1 (Which means he is in an event)

pawn Код:
InEvent[playerid] = 1;
Then you can simply use the var in your /go command like this

pawn Код:
if(InEvent[playerid] == 1) // if they are in an event
{
    // Do something
}
Reply
#4

thanks both +rep!
Reply
#5

But if the player is in the race and reconnects, then they can tele to him, so you must save the variable.
Reply
#6

i think you would not spawn in a race?! if you reconnect you are mostly on any spawn
P.s do something like in OnPlayerDeath InEvent[playerid]=0;
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)