SA-MP Forums Archive
If this can be a reason for server slowdown - lagg ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: If this can be a reason for server slowdown - lagg ? (/showthread.php?tid=165153)



If this can be a reason for server slowdown - lagg ? - ikey07 - 03.08.2010

If this can be a reason for server slowdown - lagg ?

pawn Код:
OnPlayerUpdate(playerid)
{
    for(new veh = 0; veh < MAX_VEHICLES; veh++)
    {
        if (CarLocked[veh] == 1) { SetVehicleParamsForPlayer(veh,playerid,0,1); }
        else { SetVehicleParamsForPlayer(veh,playerid,0,0); }
    }
}
??


Re: If this can be a reason for server slowdown - lagg ? - Jefff - 03.08.2010

omg YES :O

use this

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(CarLocked[vehicleid] == 1) SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
    else SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0);
    return 1;
}



Re: If this can be a reason for server slowdown - lagg ? - WackoX - 03.08.2010

Quote:
Originally Posted by ikey07
Посмотреть сообщение
If this can be a reason for server slowdown - lagg ?

pawn Код:
OnPlayerUpdate(playerid)
{
    for(new veh = 0; veh < MAX_VEHICLES; veh++)
    {
        if (CarLocked[veh] == 1) { SetVehicleParamsForPlayer(veh,playerid,0,1); }
        else { SetVehicleParamsForPlayer(veh,playerid,0,0); }
    }
}
??
100 % sure, it looks like you want the server to crash!?

MAX_VEHICLES = 2000
OnPlayerUpdate gets called every... like 0.05 seconds.
That means that script part is called about 40.000 times every 1 second for 1 player.
That means if you have 200 players in your server, times 40.000 = 8.000.000 times a second.

So if you have 200 players, that script part will be executed 8 million times per second.


Re: If this can be a reason for server slowdown - lagg ? - ikey07 - 03.08.2010

Well, I have feel about it

Thx, you guys saved me a lot of keyboards and time