SA-MP Forums Archive
Fuel 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)
+--- Thread: Fuel System (/showthread.php?tid=358528)



Fuel System - Qur - 10.07.2012

Hey.. I'm trying to setup my fuel system.. but its not working.. I've made it on the text draw.. but it doesnt showing anything..



here's my code:

Код:
new Text:FUELOS[MAX_PLAYERS];
new gGas[MAX_PLAYERS];
new checkgastimer;

forward FuelSys(playerid);
forward CheckGas();

#define GasMax 100
new Gas[CAR_AMOUNT];

On Player Connect :
FUELOS[playerid] = TextDrawCreate(10.0,220.0," ");
TextDrawShowForPlayer(playerid,FUELOS[playerid]);

On Player Spawn :
SetTimerEx("FuelSys", 100, true,"i",playerid);

On Game Mode Int :
checkgastimer = SetTimer("CheckGas", 50000, 1);

On Game Mode Exit :
KillTimer(checkgastimer);

public FuelSys(playerid)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
    	new vehicleid = GetPlayerVehicleID(playerid);
    	if(vehicleid != 0)
		{
			new string[256];
    		format(string,256,"Fuel Left: %d%",Gas[vehicleid]);
 			TextDrawSetString(FUELOS[playerid], string);
		}
	}
	else
	{
	    TextDrawSetString(SPEEDOS[playerid], " ");
		TextDrawSetString(FUELOS[playerid], " ");
		TextDrawSetString(HEALTH[playerid], " ");
	}
	return 1;
}

public CheckGas()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
    	if(IsPlayerConnected(i))
       	{
       	    if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                new vehicle = GetPlayerVehicleID(i);
          		if(Gas[vehicle] >= 1)
		   		{
		   		    if(Gas[vehicle] >= 100)
		   		    {
						Gas[vehicle] = 100;
					}
	              	Gas[vehicle]--;
	              	return 1;
		   		}
			}
    	}
	}
	return 1;
}



Re: Fuel System - Qur - 11.07.2012

Bump...
Anyone


Re: Fuel System - Qur - 11.07.2012



Seriously?!
No one can help?!!?!?


Re: Fuel System - tyler12 - 11.07.2012

Seriously, Noone can read the rules?