Fuel System
#1

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;
}
Reply
#2

Bump...
Anyone
Reply
#3



Seriously?!
No one can help?!!?!?
Reply
#4

Seriously, Noone can read the rules?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)