Fuel and mileage timers
#1

Hello, this has been on my mind for a while now... As I'm writing a gamemode I currently need to add Fuel,Speedometer update and Mileage to vehicles. And I'm looking for tips about it.

Speeomdeter,Mileage - Where would you put the update code for it? I'm currently thinking about OnPlayerUpdate or a ~1second(or less) timer. I guess mileage should be updated as often as speed...

Fuel - As this is going to be updated not as often as speed, I'm planning to put it under 1min timer(I have a 1min timer for every player started in OnPlayerConnect, I use it for main stuff).
An other idea I have is creating a global timer which would loop trough all vehicles and decrease their fuel.

So if you have any ideas,experiences or anything concerning this, please share
Reply
#2

I suggest you to add your speedo on your onplayerupdate so it doens't got any delay about your speed/fuel ect.
Reply
#3

I'd say create a one second timer for the speedo, 32 times a second(OnPlayerUpdate) is too much(I think that was the value).

As for the fuel, just put a 5 seconds timer to check for the fuel, since it's not needed often, but to lower the value of it(Like 1%), make that every minute I guess, it would be good.

Hope this helps.
Reply
#4

Thank you both. What do you think about fuel should it be in the speedos function(but called les frequently) or a different global timer?
Reply
#5

Fuel should be at a different global timer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)