SA-MP Forums Archive
Need Small help Rep + - 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: Need Small help Rep + (/showthread.php?tid=570339)



Need Small help Rep + - MBilal - 09.04.2015

Hello I'm using only 4 timers in server but the server is lagging hard when we have more players like more than 50.
I'm using nothing on OnPlayerUpdate

Код:
	t1 = SetTimer("AntiCheatUpdate",8000,true);

        t2 = SetTimer("AutoMessage", 60000, true);

	t6 = SetTimer("Anticheat", 1000, true);

this onplayer spawn statstimer[playerid] = SetTimerEx("StatsInfromation", 15000, true, "u", playerid); but this timer got kill on player death and start again on player spawn. 
I'm using this to update player stats textdraws.



Re: Need Small help Rep + - Sithis - 09.04.2015

Include more information? What kinds of code is executed ik every timer? What OS, what kind of machine? Other heavy scripts you're running?


Re: Need Small help Rep + - MBilal - 09.04.2015

t1 = SetTimer("AntiCheatUpdate",8000,true);

this timer check all anti cheats.. like health /armour /weapon /speed /money

t2 = SetTimer("AutoMessage", 60000, true); //this will update message textdraws

t6 = SetTimer("Anticheat", 1000, true); // this timer only check the Weapon crasher and vehicle teleport


Re: Need Small help Rep + - [ABK]Antonio - 09.04.2015

Quote:
Originally Posted by MBilal
Посмотреть сообщение
Hello I'm using only 4 timers in server but the server is lagging hard when we have more players like more than 50.
I'm using nothing on OnPlayerUpdate

Код:
	t1 = SetTimer("AntiCheatUpdate",8000,true);

        t2 = SetTimer("AutoMessage", 60000, true);

	t6 = SetTimer("Anticheat", 1000, true);

this onplayer spawn statstimer[playerid] = SetTimerEx("StatsInfromation", 15000, true, "u", playerid); but this timer got kill on player death and start again on player spawn. 
I'm using this to update player stats textdraws.
Wouldn't it make more sense to increment a variable inside of the anti-cheat to run every 15 seconds instead of having that 15 second timer for every player? Just running a loop inside of the AntiChat (which I'm sure you already have)? I mean, you could really do that for all of them if you wanted since you started with a base of 1 second.


Re: Need Small help Rep + - MBilal - 09.04.2015

Too make lag less , i'm removing stats update timer but i want to know how i can update these text
onplayerdeath ?
how i can use them onplayerdeath to update these textdraws?

Код:
stock  StatsInfromation(playerid)
{
	if (IsPlayerConnected(playerid))
  	{
    format(Jstring, sizeof(Jstring), "~y~Rank : ~w~%s" , GetRankName(playerid));
    PlayerTextDrawSetString(playerid,Rank[playerid],Jstring);
    
    format(Jstring, sizeof(Jstring), "~b~Score : ~w~%d" , GetPlayerScore(playerid));
    PlayerTextDrawSetString(playerid,Stats[playerid],Jstring);

    format(Jstring, sizeof(Jstring), "~g~Kills : ~w~%d" , pInfo[playerid][Kills]);
    PlayerTextDrawSetString(playerid,kills[playerid],Jstring);

    format(Jstring, sizeof(Jstring), "~r~Deaths : ~w~%d" , pInfo[playerid][Deaths]);
    PlayerTextDrawSetString(playerid,pDeaths[playerid],Jstring);

    format(Jstring, sizeof(Jstring), "~b~Headshots : ~w~%d" , pInfo[playerid][Headshot]);
    PlayerTextDrawSetString(playerid,HEADSHOTS[playerid],Jstring);

    format(Jstring, sizeof(Jstring), "~r~Streak : ~w~%d" , Streaks[playerid]);
    PlayerTextDrawSetString(playerid,KS[playerid],Jstring);

    format(Jstring, sizeof(Jstring), "~y~Ratio : ~w~%.2f" ,Float:pInfo[playerid][Kills]/Float:pInfo[playerid][Deaths]);
    PlayerTextDrawSetString(playerid,RATIO[playerid],Jstring);
	}
	return 1;
}