11.04.2013, 17:12
So I am saving all vehicle damage to the enum which in turn goes to the database. At what point should I update the enum??
Run a loop under OnPlayerUpdate to check the vehicles. Maybe this will work out. Not sure.
|
Hi.
... I don't want to give bad advise or something, but I would do it when player leaves vehicle (using OnPlayerExitVehicle public). Seems most optimal. Greetz, LetsOWN |
I was thinking about doing a processVehicleDamage() function on a timer every 30 seconds. Would that be heavy on resources.
|
Hi.
... I don't want to give bad advise or something, but I would do it when player leaves vehicle (using OnPlayerExitVehicle public). Seems most optimal. Greetz, LetsOWN |
simply the worst way you can think of !
What if the player never leaves the car ? e.g explodes. A good way is going to be to use the vehicles damage status update callback OnVehicleDamageStatusUpdate |
simply the worst way you can think of !
What if the player never leaves the car ? e.g explodes. A good way is going to be to use the vehicles damage status update callback OnVehicleDamageStatusUpdate NOTE: if you want to go fully pro on this u can make it check how fast its updating the status so there is no overwriting. |
//global variables!
new Hour, Minute, Second;
//the callback
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
new nHour, nMinute, nSecond;
gettime(nHour, nMinute, nSecond);
if(nHour => Hour && nMinute => Minute && nSecond > Second+2)//the simplest check, ofc it can be more advanced(the +2 add another 2sec)
{
gettime(Hour, Minute, Second);//update the last time it updated
//run your save
}
return 1;
}