What is difference ?Need help
#1

I want to know which is better .. Like

I use global timer

Код:
forward OnPlayerCheat( );
public OnPlayerCheat( )
{ 
foreach(Player,i)
{
//Checking anti cheats for player here   
} 
}
or using Timer to for each player started when that player connect like

SetTimerEx("OnPlayerCheat",1000,true,"u",playerid) ;

Код:
forward OnPlayerCheat(playerid );
public OnPlayerCheat(playerid )
{  
//Checking anti cheats for player here    
}
In both cases i am using 1 sec Timer so which is better global one or timer for each player?

I am confuse

Kindly help Thanks.
Reply
#2

i'd use global timer and IsPlayerConnected.
Reply
#3

You mean you dont use global timer?

Well i readed some where foreach already check is player connected or not.
Reply
#4

if foreach already checks if is player online or not - use it. imo it's better and simpler than creating a timer for each player
Reply
#5

But i have issue about that also look timer start after 1 sec which mean loop start for all players after ....
is not that loop cause lag?

I dont know about single timer for all ..
i think it causing more problem.
Reply
#6

Код:
public OnGameModeInit()
{
	SetTimer("AntiCheat", 2500, 1);
}

forward AntiCheat(i);
public AntiCheat(i)
{
	for(new i = 0; i < SLOTS; i++)
	{
		if(IsPlayerConnected(i))
	    	{
			//check for cheats	
		}
	}
}
Reply
#7

As i can see you are using old version of foreach Mr. Bilal.
Reply
#8

I think you dont understand , i am not talking about foreach i am talking about which is better global or timer for each player.
Reply
#9

lol i already said the global timer is better in my first post in this thread.
Reply
#10

I know what you said but i am saying but using loop in global timer can cause lag...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)