Fuel System | Roleplay|CnR -
RanSEE - 03.08.2012
Fuel System
Here it goes-
Introduction
This is very simple, there is to the bottom right a textdraw with your fuel, vehicle health, and your speed in kilometers. Your fuel decreases by 1 every 3 seconds from 100. At 20, it will send a warning, "You are almost out of fuel, go to the nearest gas station!". To refuel, you simply go to a defined gas station and type /refuel, it will turn off your engine, take $20, and give you back to 100 gas. Then after done refueling, it will turn your car engine back on.
Functions
At the bottom right theres a textdraw with your fuel, vehicle health, and your speed in kilometers (This is the same). Your fuel decreased by 2 every second from 100 (Different). (It did not warn you at 20gas.). To refuel you just type /refuel anywhere (different) and it will take $80 and set your gas to 100 (different.). If you did not make it to a gas station on time, it would kick you out of your vehicle (different). (Added engine off/on)
Adding Gas Stations
Under
Код:
stock IsPlayerAtRefuelStation(playerid)
add the Co-ordinates
Код:
if (IsPlayerInRangeOfPoint(playerid,10,x,y,z)) return 1;
Gas Charges
Код:
if (GetPlayerMoney(playerid) - 20 <0) return SendClientMessage(playerid,0xFFC800FF,"You dont have enough money!");
GivePlayerMoney(playerid, -20); //Sets the player's cash -$80
Change -20 to desired prices in both the lines.
Gas Empty time
Код:
new string[128];format(string,sizeof string,"Fuel: %i",fuel[vid] /3);
That is 1 gas every per second
Change /3 to desired number
Change Log:
At the Gas Station
You cannot move at the filling station, as engine turns off, well makes sense.
To change the time you must wait at the filling station
Under
Код:
SetTimerEx("timer_refuel",4500,false,"i",playerid);
Change 4500 to desired amount (4500 Denotes 4.5secs)
Download
http://www.mediafire.com/?lp8tjnj2tazr5f [amx+pwn] Version 1 - Old
http://rghost.net/41203563 [amx+pwn] Version 2 - New (Recommended)
Regards
Evil Junction
Re: CF Gas/Fuel System -
Joe21 - 03.08.2012
good job !
Re: CF Gas/Fuel System -
Lewis_Johnson - 03.08.2012
You won't believe how long I've been looking for something like this!
I love you!
Re: CF Gas/Fuel System -
Djole1337 - 03.08.2012
Already had something like that^, scripted by me,
good job.
Re: CF Gas/Fuel System -
mickos - 03.08.2012
Good job
Re: CF Gas/Fuel System -
Ben_Gale - 04.08.2012
i shall be trying this out let u kniw !
Re: CF Gas/Fuel System -
RanSEE - 06.08.2012
Thank you very much, glad that you like it.
Re: CF Gas/Fuel System -
RanSEE - 12.08.2012
Updated Check the main post.
Код:
Change Log:
At the Gas Station
You cannot move at the filling station, as engine turns off, well makes sense.
To change the time you must wait at the filling station
Under
Code:
SetTimerEx("timer_refuel",4500,false,"i",playerid);
Change 4500 to desired amount (4500 Denotes 4.5secs)
Re: CF Gas/Fuel System -
Scott Zulkifli - 12.08.2012
nice..
Re: CF Gas/Fuel System -
RanSEE - 28.10.2012
Version 2 Out
Link Updated