Gas problem.
#1

Hi all.Now i very need your all help with this thing.That what i want to do is that,how to do every 100 metres,player lost 0.1 gas?To get vehicle all vehicle distance i do that:

Код:
new Float:ST[4];
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;

vehicleDB[vehicleid][VehicleDistance] += ST[3];
Then i divide,to get correct distance:

Код:
vehicleDB[vehicleid][VehicleDistance]/10000
with this i use to get all vehicle distance.

I want to make a taimer with 1 sec interval,and how i say on the top,how to check if after distance is 0.1 more than before distance then player lost 0.1 gas,i want to know you to do that check?i try to do when player enter vehicle i set pvar by that how mach is vehicle distance it look like that:

Код:
SetPVarFloat(playerid,"VehicleDistanceBefore",vehicleDB[vehicleid][prav]/10000);
But how to do check in that timer that what i say.Thanks for help. If you don't understand that what i say i say it for ex:

player enter to vehicle and that vehicle have 0.0 distance,i start way by car,and i reach 0.1 distance then i lost 0.1 gas,then i way by car 100 metres more (0.2) I again lost 0.1 gas and t.t....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)