Problem with gas system. - 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: Problem with gas system. (
/showthread.php?tid=272968)
Problem with gas system. -
budelis - 30.07.2011
Hi peoples.I have do gas system,here is my script:
public OnPlayerStateChange(playerid, newstate, oldstate)
Код:
if(newstate == PLAYER_STATE_DRIVER)
{
SetPVarFloat(vehicleid,"RidaPries",vehicleDB[vehicleid][prav]/10000); // Save the float into a player variable
Here if is player driver,then set pvar by vehicle distane.
Код:
vehicleDB[vehicleid][prav]/10000 - With this i get player run wih vehicle distance.
Then i set 1 sec timer with true and after that taimer:
Код:
SetPVarFloat(vehicleid,"RidaPo",vehicleDB[vehicleid][prav]/10000); // Save the float into a player variable
if(GetPVarFloat(vehicleid,"RidaPries") - GetPVarFloat(playerid,"RidaPo") >= 0.1)
{
vehicleDB[vehicleid][gas] -=0.1;
return 1;
}
SetPVarFloat(vehicleid,"RidaPries",vehicleDB[vehicleid][prav]/10000); // Save the float into a player variable
return 1;
}
And why when player run with vehicle 0.1(100 metres) he don't lose 0.1 gas?Maybe i do mistake please help i'am begginer in scripts.