Checking if there are 70 players online?
#1

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
Reply
#2

new pCount
OnPlayerConnect

pCount++;
if(pCount == 70)
{
ActivateLogitech90'sFunction();
}
OnPlayerDisconnect
pCount--;

Might help u..
Reply
#3

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
Reply
#4

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.
Reply
#5

U want to show it when there are 70 players online??

Код:
 if(pCount == 70)
{
GameTextForPlayer(blablabla);
}
Reply
#6

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.
Reply
#7

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);
}
Reply
#8

Код:
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); 
}
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)