27.03.2013, 16:41
(
Последний раз редактировалось SKAzini; 30.03.2013 в 12:12.
)
Well, basically I believe that my script is eating CPU. Sometimes (not all the time) the CPU usage gets up to 120%, reported by the Volt-Host server information page else it only uses around 15%.
Fuel system (I do not think that this is the problem):
I also checked that MySQL would free data after every select..
Fuel system (I do not think that this is the problem):
pawn Код:
//OnGameModeInit:
SetTimer("VehFuelTimer", 40000, true);
//---
public VehFuelTimer()
{
new iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective;
for(new i; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleSeat(i) == 0)
{
new veh = GetVehicleModel(GetPlayerVehicleID(i));
if(veh == 481 || veh == 509 || veh == 510)
{
}
else
{
if(!VehAdmin[GetPlayerVehicleID(i)])
{
GetVehicleParamsEx(GetPlayerVehicleID(i), iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
if(VehFuel[GetPlayerVehicleID(i)] < 1) SetVehicleParamsEx(GetPlayerVehicleID(i), 0, iLights, iAlarm, iDoors, iBonnet, iBoot, 0);
else
{
if(iEngine == 1)
{
if(VehFuel[GetPlayerVehicleID(i)] > 0)
{
VehFuel[GetPlayerVehicleID(i)]--;
}
}
}
}
}
}
}
return 1;
}