Checking if there are 70 players online? - 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: Checking if there are 70 players online? (
/showthread.php?tid=194743)
Checking if there are 70 players online? -
Face9000 - 30.11.2010
Hi all.
I need to do a script that check if there are more than 70 players online and he active a function that i decide.
Example: When server reach 70 players,the script will auto give weapon etc.
Thanks
Re: Checking if there are 70 players online? -
Lutsen - 30.11.2010
new pCount
OnPlayerConnect
pCount++;
if(pCount == 70)
{
ActivateLogitech90'sFunction();
}
OnPlayerDisconnect
pCount--;
Might help u..
Re: Checking if there are 70 players online? -
Scenario - 30.11.2010
It depends how accurate you want it to be, really. Using a timer, it would work, but you may loose a player before the timer kicks in and does something... You could do the actions right when the 70th player joins the server as well... I would use a timer though. I did the base for you below;
With a Timer |
Without a Timer
Re: Checking if there are 70 players online? -
Face9000 - 30.11.2010
Thanks guys!
I've another question..
I've inserted a GameTextForPlayer with text (CRAZY HOUR ACTIVE)
And i need to show until server has 70 players,if we reach 69 players,the text will hide.
How to?
Thanks alot.
Re: Checking if there are 70 players online? -
Lutsen - 30.11.2010
U want to show it when there are 70 players online??
Код:
if(pCount == 70)
{
GameTextForPlayer(blablabla);
}
Re: Checking if there are 70 players online? -
Face9000 - 30.11.2010
Quote:
Originally Posted by Lutsen
U want to show it when there are 70 players online??
Код:
if(pCount == 70)
{
GameTextForPlayer(blablabla);
}
|
Yeah,and when there are 69 players,the text will hide.
And a loop again if reach 70 players.
Re: Checking if there are 70 players online? -
Nero_3D - 30.11.2010
Quote:
Originally Posted by Logitech90
Yeah,and when there are 69 players,the text will hide.
And a loop again if reach 70 players.
|
Hide?, if you want a permanent text (not like GameText which disappears after a delay) you need to use TextDraws
pawn Код:
new Players;
//OnPlayerConnect
if(++Players > 69) {
if(Players == 70) {
TextDrawShowForAll(Text:text);
} else {
TextDrawShowForPlayer(playerid, Text:text);
}
}
//OnPlayerDisconnect
if(--Players == 69) {
TextDrawHideForAll(Text:text);
}
Re: Checking if there are 70 players online? -
Lutsen - 30.11.2010
Код:
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(pCount >= 69)
{
GameTextForPlayer(i,"happy hour active", 3600000, 4);
}
if(pCount <= 70)
{
GameTextForPlayer(i," ",1,4);
}
}
}