SA-MP Forums Archive
Automatic function depending on the connected people. - 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)
+--- Thread: Automatic function depending on the connected people. (/showthread.php?tid=497805)



Automatic function depending on the connected people. - davazi7 - 28.02.2014

Hi people! I'm trying to create a function (called by a timer) which "scan" if some user with X variable is connected and if it is make an action and if it is not, make another action. I think I haven't meant properly... I did something like this but it didn't work, can you help me?? Sorry for my bad English :S

Код:
new PlayerCount;
function ActivarAntiAFK()
{
 		for (new i = 0; i < GetMaxPlayers(); i++)
        {
            if(IsPlayerConnected(i))
            {
                #if defined ADMINSONLNE
            	if(PlayerInfo[i][AdminMC] == 0))
            	{
					SendRconCommand("loadfs antiafk");
            	}
            	else if(PlayerInfo[i][AdminMC] !=0)
            	{
					SendRconCommand("unloadfs antiafk");
            	}
            	#endif
            	PlayerCount++;
            }
        }
}