Apply this command when everybody leaves?
#1

Ok guys, so I want the server to call
PHP код:
EventLoad 
every time the server gets empty, due to bugs after logging again.

Here is the command I have to put manually:
PHP код:
CMD:stopgame(playerid) {
    
EventLoad 0;
    return 
1;

Thank you!!!!
Reply
#2

PHP код:
new PlayersOnline 0;
public 
OnPlayerConnect(playerid)
{
PlayersOnline PlayersOnline+1;
return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
PlayersOnline PlayersOnline-1;
if(
PlayersOnline == 0)
{
EventLoad 0;
}
return 
1;

Reply
#3

Use foreach, download it from here:
https://github.com/karimcambridge/SA....1/foreach.inc

pawn Код:
#include <foreach>

pawn Код:
public OnPlayerDisconnect(playerid)
{
         if(Iter_Random(player) == -1)  //This checks for a random value in the player's iterator,
          {           //if it's empty means no one is online
                    // no players online
          }
          return 1;
}
Reply
#4

Thanks a lot it works +rep
Reply
#5

Код:
if(!Iter_Count(Players))
{
   EventLoaded = 0;
}
better than iter_random...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)