SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 30/10/2015, 03:44 PM   #1
Big Clucker
Join Date: May 2015
Posts: 55
Reputation: 5
Default Fuel System - No Fuel

Nevermind, going to re-do the system from scratch to make sure there is no bugs!

Last edited by Scottylad; 31/10/2015 at 01:20 AM.
Scottylad is offline   Reply With Quote
Old 30/10/2015, 04:47 PM   #2
Join Date: Sep 2014
Location: Ls-rcr
Posts: 850
Reputation: 52
Default Re: Fuel System - No Fuel

You need to set the fuel of the vehicle somewhere in the script. Gas[vehicleid]=100.0;
******: "I've said this before. People think that MySQL is some simple plug-and-play magic bullet that you can use to just make your mode instantly better. They don't realise that the "L" in "SQL" means "language". So instead of programming PAWN, and using a bit of this mystery thing, you are now programming in two languages at once. If you spend months learning PAWN, you should spend the same time learning SQL, if not more - it is probably the more complex of the two languages, and not something that just gets bolted on to the side."

I give and want only fair reps. I hate this: "hey bro, I rep you, rep me plz

Click below if you wanna be amazed:
ATGOggy is offline   Reply With Quote
Old 30/10/2015, 04:56 PM   #3
Huge Clucker
feartonyb's Avatar
Join Date: Feb 2012
Location: Knin, Croatia
Posts: 319
Reputation: 12
Default Re: Fuel System - No Fuel

Make a check if it's a faction vehicle

	if(Gas[vehicleid] < 1.0)
		SendClientMessage(playerid, COLOR_RED, "[!ERROR] Your vehicle is out of fuel, it won't start!");
and than make a function

stock IsAFactionVehicle(vehicleid))
	if(vehicleid == ... || vehicleid == ...) return true;
	return false;
Replace "..." with vehicle IDs of your faction vehicles
feartonyb is offline   Reply With Quote
Old 31/10/2015, 12:51 AM   #4
Big Clucker
Join Date: May 2015
Posts: 55
Reputation: 5
Default Re: Fuel System - No Fuel

I've fixed it now but when I do /car engine - it says there is no fuel in the tank yet I've placed 100.00 fuel into the vehicle and placed that if it is smaller or equal to 1.0 fuel it will not start:

forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
	new string[128];
	new engine,lights,alarm,doors,bonnet,boot,objective;
    if(engine == VEHICLE_PARAMS_ON)
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER] Vehicle engine stopped successfully.");
		arr_Engine{vehicleid} = 0;
    else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
			Float: f_vHealth;

		GetVehicleHealth(vehicleid, f_vHealth);
		if(f_vHealth < 350.0) return SendClientMessage(playerid, COLOR_RED, "The car won't start - it's totalled!");
	    if(VehicleFuel[vehicleid] <= 1.0) return SendClientMessage(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER] Vehicle engine started successfully (/car engine to turn the engine off).");
		arr_Engine{vehicleid} = 1;
	return 1;
Scottylad is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Fuel System [Fuel/Speed/Vehicle Name/Health] reddromero Filterscripts 5 10/05/2014 02:50 AM
Custom Fuel system taking 2 fuel instead of 1. ricardo178 Scripting Help 6 27/04/2013 10:16 AM
Fuel System Help KiiD Scripting Help 13 21/09/2012 05:15 PM
Fuel[i] -= 1; (Insted of taking 1, takes all fuel) HondaCBR Scripting Help 2 15/04/2012 01:03 PM
Fuel System - Help? nickbugun Help Archive 1 15/04/2009 05:51 AM

All times are GMT. The time now is 08:06 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.