SA-MP Forums Archive
how to set a limit - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to set a limit (/showthread.php?tid=116163)



how to set a limit - Bearfist - 27.12.2009

Hii ..
how to set a limit for people who want to enter a command?
..
like that only 10 Players are able to Join a Deatchmatch room.


LG Bearfist


Re: how to set a limit - Correlli - 27.12.2009

Create a variable which will count the amount of players who joined the deathmatch room and use it to check if the variable is equal to 10.


Re: how to set a limit - Bearfist - 27.12.2009

Alright ... so I have to add:
Код:
new InDM;
InDM++;
in the loop of the Command ( for Example /EnterDM ) and Check if (InDM < 10) in the loop?
Otherwise it should be unable to join.

Is that Right ?


Re: how to set a limit - Correlli - 27.12.2009

The variable should be global and you don't need any loop.


Re: how to set a limit - Bearfist - 27.12.2009

Okay.
Than I add
Код:
 
new InDM;
at the top of my script

and at the command /EnterDM: I add InDM++;

and if InDM > 2 the Player can't join the Deatchmatch

Is that right ?


Re: how to set a limit - Correlli - 27.12.2009

Correct.

You can use this way to check the limit:
pawn Код:
if(myVariable < 10)
{
  // player can join the deathmatch room.
}
else
{
  // player CAN'T join the deathmatch room.
}



Re: how to set a limit - Bearfist - 27.12.2009

Thank you very much =)
It helped a lot.

LG Bearfist


Re: how to set a limit - Correlli - 27.12.2009

You're welcome.