PDA

View Full Version : Fuel Error


Donvalley
21/06/2013, 10:49 AM
Why when i activate gas system it works fine when gas is at 100 but as soon as it drops it gives a 9-12 decimal number ? :S also when you are in car the fuel meter doesnt change you have to get out of the car and get back in for it to update


new Text:GasAmount;


checkgastimer = SetTimer("CheckGas", 15000, 1);


if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new gastext[41];
new vid = GetPlayerVehicleID(playerid);
format(gastext, sizeof(gastext), "Vehicle Fuel : %d", Gas[vid]);
TextDrawSetString(GasAmount, gastext);
TextDrawShowForPlayer(playerid, GasAmount);
}


GasAmount = TextDrawCreate(499.000000, 100.000000, "Vehicle Fuel :");
TextDrawBackgroundColor(GasAmount, 255);
TextDrawFont(GasAmount, 1);
TextDrawLetterSize(GasAmount, 0.400000, 1.000000);
TextDrawColor(GasAmount, -65281);
TextDrawSetOutline(GasAmount, 0);
TextDrawSetProportional(GasAmount, 1);
TextDrawSetShadow(GasAmount, 1);
TextDrawUseBox(GasAmount, 1);
TextDrawBoxColor(GasAmount, 255);
TextDrawTextSize(GasAmount, 605.000000, 0.000000);

Juanxz
21/06/2013, 11:48 AM
Regarding the change with the fuel gauge, you have to set a system of timers or maybe a loop.

Donvalley
21/06/2013, 12:49 PM
thank now what about the random numbers though

Goldilox
21/06/2013, 04:39 PM
I don't know how is this setup Gas[vid]

Don't you have something that formats a random digit of how many digits you want?

Pillhead2007
21/06/2013, 06:35 PM
you Can Use Mine Pretty Much Perfect
#include <streamer>
forward FuelConsumptionLow();
forward RefillFuel(playerid);
new Fuel[MAX_VEHICLES];
new FuelCheckpoint[MAX_PLAYERS];
new FuelTimer;
new FuelRefillTimer;
new Menu:GasMenu;
new Menu:FuelPayMent;
new RefillingFuel[MAX_PLAYERS];
enum pInfo
{
//--[Payment Method]
pPayByVisa,
pPayByCash,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
main()
{
//--[Fuel Payment]
FuelPayMent = CreateMenu("~w~Gas ~r~Station",1,50,220,200,230);
SetMenuColumnHeader(FuelPayMent, 0, "Select Payment");
AddMenuItem(FuelPayMent,0,"Visa Debit");
AddMenuItem(FuelPayMent,0,"Cash");
AddMenuItem(FuelPayMent,0,"Cancel");
//--[Fuel Pick]
GasMenu = CreateMenu("~w~Gas ~r~Station",1,50,220,200,230);
SetMenuColumnHeader(GasMenu, 0, "Select A Fuel");
AddMenuItem(GasMenu,0,"Unleaded 95");
AddMenuItem(GasMenu,0,"Super Unleaded 97");
AddMenuItem(GasMenu,0,"Diesel");
AddMenuItem(GasMenu,0,"Natural Gas");
AddMenuItem(GasMenu,0,"Exit");
//---[TextDraws]
//--[Fuel]
for(new playerid = 0;playerid < GetMaxPlayers();playerid++){
FuelTxt[playerid] = TextDrawCreate(0,410,"Fuel:%i%");
TextDrawBackgroundColor(FuelTxt[playerid],0x00000033);
TextDrawFont(FuelTxt[playerid],3);
TextDrawLetterSize(FuelTxt[playerid],0.399999,1.700000);
TextDrawColor(FuelTxt[playerid],0xFFFFFFFF);
TextDrawSetShadow(FuelTxt[playerid],3);}
}
public FuelConsumptionLow()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
new vehicleid = GetPlayerVehicleID(i);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(GetPlayerVehicleSeat(i) == 0)
{
Fuel[vehicleid]--;
if(Fuel[vehicleid]<= 0)
{
Fuel[vehicleid] = 0;
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors, bonnet,boot,objective);
VehicleInfo[vehicleid][vEngine] = 0;
GameTextForPlayer(i,"~w~You Are Out Of ~r~Fuel~w~!",5000,4);
}
}
new string[125];
format(string,sizeof string,"Fuel:%i%",Fuel[vehicleid]);
TextDrawSetString(FuelTxt[i],string);
}
return 1;
}
public RefillFuel(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playerid))
{
if(RefillingFuel[playerid] == 1)
{
if(Fuel[vehicleid] < 100)
{
Fuel[vehicleid] = 100;
RefillingFuel[playerid] = 0;
KillTimer(FuelRefillTimer);
TogglePlayerControllable(playerid, 0);
}
}
new string[128];
format(string,sizeof string,"Fuel:%i%",Fuel[vehicleid]);
TextDrawSetString(FuelTxt[playerid],string);
KillTimer(FuelRefillTimer);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
return 1;
}
public OnGameModeInit()
{
//--[Fuel]
for(new i=0;i<MAX_VEHICLES;i++)
{
Fuel[i] = 100;
}
return 1;
}
public OnPlayerDeath(playerid)
{
TextDrawHideForPlayer(playerid,FuelTxt[playerid]);
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == Checkpoint[0]||checkpointid == FuelCheckpoint[1]||checkpointid == FuelCheckpoint[2]||checkpointid == FuelCheckpoint[3]||checkpointid == FuelCheckpoint[4]||checkpointid == FuelCheckpoint[5]||checkpointid == FuelCheckpoint[6]||checkpointid == FuelCheckpoint[7]||checkpointid == FuelCheckpoint[8]||checkpointid == FuelCheckpoint[9]||checkpointid == FuelCheckpoint[10]||checkpointid == FuelCheckpoint[11])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[12]||checkpointid == FuelCheckpoint[13]||checkpointid == FuelCheckpoint[14]||checkpointid == FuelCheckpoint[15]||checkpointid == FuelCheckpoint[16]||checkpointid == FuelCheckpoint[17]||checkpointid == FuelCheckpoint[18]||checkpointid == FuelCheckpoint[19]||checkpointid == FuelCheckpoint[20]||checkpointid == FuelCheckpoint[21]||checkpointid == FuelCheckpoint[22]||checkpointid == FuelCheckpoint[23])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[24]||checkpointid == FuelCheckpoint[25]||checkpointid == FuelCheckpoint[26]||checkpointid == FuelCheckpoint[27]||checkpointid == FuelCheckpoint[28]||checkpointid == FuelCheckpoint[29]||checkpointid == FuelCheckpoint[30]||checkpointid == FuelCheckpoint[31]||checkpointid == FuelCheckpoint[32]||checkpointid == FuelCheckpoint[33]||checkpointid == FuelCheckpoint[34]||checkpointid == FuelCheckpoint[35])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[36]||checkpointid == FuelCheckpoint[37]||checkpointid == FuelCheckpoint[38]||checkpointid == FuelCheckpoint[39]||checkpointid == FuelCheckpoint[40]||checkpointid == FuelCheckpoint[41]||checkpointid == FuelCheckpoint[42]||checkpointid == FuelCheckpoint[43]||checkpointid == FuelCheckpoint[44]||checkpointid == FuelCheckpoint[45]||checkpointid == FuelCheckpoint[46]||checkpointid == FuelCheckpoint[47])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[48]||checkpointid == FuelCheckpoint[49]||checkpointid == FuelCheckpoint[50]||checkpointid == FuelCheckpoint[51]||checkpointid == FuelCheckpoint[52]||checkpointid == FuelCheckpoint[53]||checkpointid == FuelCheckpoint[54]||checkpointid == FuelCheckpoint[55]||checkpointid == FuelCheckpoint[56]||checkpointid == FuelCheckpoint[57]||checkpointid == FuelCheckpoint[58]||checkpointid == FuelCheckpoint[59])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[60]||checkpointid == FuelCheckpoint[61]||checkpointid == FuelCheckpoint[62]||checkpointid == FuelCheckpoint[63]||checkpointid == FuelCheckpoint[64]||checkpointid == FuelCheckpoint[65]||checkpointid == FuelCheckpoint[66]||checkpointid == FuelCheckpoint[67]||checkpointid == FuelCheckpoint[68]||checkpointid == FuelCheckpoint[69]||checkpointid == FuelCheckpoint[70]||checkpointid == FuelCheckpoint[71])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[72]||checkpointid == FuelCheckpoint[73]||checkpointid == FuelCheckpoint[74]||checkpointid == FuelCheckpoint[75]||checkpointid == FuelCheckpoint[76]||checkpointid == FuelCheckpoint[77]||checkpointid == FuelCheckpoint[78]||checkpointid == FuelCheckpoint[79]||checkpointid == FuelCheckpoint[80]||checkpointid == FuelCheckpoint[81]||checkpointid == FuelCheckpoint[82]||checkpointid == FuelCheckpoint[83])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[84]||checkpointid == FuelCheckpoint[85]||checkpointid == FuelCheckpoint[86]||checkpointid == FuelCheckpoint[87]||checkpointid == FuelCheckpoint[88]||checkpointid == FuelCheckpoint[89]||checkpointid == FuelCheckpoint[90]||checkpointid == FuelCheckpoint[91]||checkpointid == FuelCheckpoint[92]||checkpointid == FuelCheckpoint[93]||checkpointid == FuelCheckpoint[94]||checkpointid == FuelCheckpoint[95])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
if(checkpointid == FuelCheckpoint[96]||checkpointid == FuelCheckpoint[97]||checkpointid == FuelCheckpoint[98])
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128],string2[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Your Visa Balance is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
format(string2,sizeof(string2),COLOR_WHITE"Thats If You Want To Pay By Visa To Purchase Fuel.");
SendClientMessage(playerid,-1, string);
SendClientMessage(playerid,-1, string2);
ShowMenuForPlayer(FuelPayMent,playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Are Not In A Vehicle !!");
}
}
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)///this is not yet completed as ive not had the time but the first 5 are correct just change the values also haven't added vehicle info on electric petrol or diesel enum to the correct values on vehicle.ide on gta sa directory
{
new Menu:current;
current = GetPlayerMenu(playerid);
if(current == FuelPayMent)
{
switch(row)
{
case 0:
{
PlayerInfo[playerid][pPayByVisa] = 1;
ShowMenuForPlayer(GasMenu, playerid);
}
case 1:
{
PlayerInfo[playerid][pPayByCash] = 1;
ShowMenuForPlayer(GasMenu, playerid);
}
case 2:
{
HideMenuForPlayer(FuelPayMent,playerid);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
}
}
if(current == GasMenu)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, doors, alarm, bonnet, boot, objective;
switch(row)
{
case 0:
{
if(PlayerInfo[playerid][pPayByCash] == 1)
{
if(Fuel[vehicleid] >= 100)
{
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Your Fuel Tank Is Full !!");
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 95 && Fuel[vehicleid] < 100)
{
if(GetPlayerMoney(playerid) >= 1)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -1);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have"COLOR_GREEN" $1"COLOR_WHITE" In Your Wallet.");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
}
else if(Fuel[vehicleid] >= 85 && Fuel[vehicleid] <= 94)
{
if(GetPlayerMoney(playerid) >= 6)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -6);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have"COLOR_GREEN" $6"COLOR_WHITE" In Your Wallet.");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
}
else if(Fuel[vehicleid] >= 75 && Fuel[vehicleid] < 85)
{
if(GetPlayerMoney(playerid) >= 11)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -11);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have"COLOR_GREEN" $11"COLOR_WHITE" In Your Wallet.");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
}
else if(Fuel[vehicleid] >= 65 || Fuel[vehicleid] < 75)
{
if(GetPlayerMoney(playerid) >= 16)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -16);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have"COLOR_GREEN" $16"COLOR_WHITE" In Your Wallet.");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
}
else if(Fuel[vehicleid] >= 55 || Fuel[vehicleid] < 65)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -21);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 45 || Fuel[vehicleid] < 55)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -27);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 35 || Fuel[vehicleid] < 45)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -33);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 25 || Fuel[vehicleid] < 35)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -39);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 15 || Fuel[vehicleid] < 25)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -45);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 0 || Fuel[vehicleid] < 15)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -51);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have Enough Cash !");
PlayerInfo[playerid][pPayByCash] = 0;
}
}
if(PlayerInfo[playerid][pPayByVisa] == 1)
{
if(Fuel[vehicleid] >= 100)
{
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Your Fuel Tank Is Full !!");
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
else if(Fuel[vehicleid] >= 95 && Fuel[vehicleid] < 100)
{
if(PlayerInfo[playerid][pBankAccount] >= 1)
{
RefillingFuel[playerid] = 1;
PlayerInfo[playerid][pBankAccount] -= 1;
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByVisa] = 0;
if(fexist(UserPath(playerid)))
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Player-Data");
INI_WriteInt(File,"BankAccount",PlayerInfo[playerid][pBankAccount]);
INI_Close(File);
}
new string[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Transaction Successfull, Your New Bank Balance Is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
SendClientMessage(playerid,-1,string);
}
}
else if(Fuel[vehicleid] >= 85 && Fuel[vehicleid] <= 94)
{
if(PlayerInfo[playerid][pBankAccount] >= 6)
{
RefillingFuel[playerid] = 1;
PlayerInfo[playerid][pBankAccount] -= 6;
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByVisa] = 0;
if(fexist(UserPath(playerid)))
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Player-Data");
INI_WriteInt(File,"BankAccount",PlayerInfo[playerid][pBankAccount]);
INI_Close(File);
}
new string[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Transaction Successfull, Your New Bank Balance Is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
SendClientMessage(playerid,-1,string);
}
}
else if(Fuel[vehicleid] >= 75 || Fuel[vehicleid] < 85)
{
if(PlayerInfo[playerid][pBankAccount] >= 6)
{
RefillingFuel[playerid] = 1;
PlayerInfo[playerid][pBankAccount] -= 11;
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByVisa] = 0;
if(fexist(UserPath(playerid)))
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Player-Data");
INI_WriteInt(File,"BankAccount",PlayerInfo[playerid][pBankAccount]);
INI_Close(File);
}
new string[128];
format(string,sizeof(string),COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" Transaction Successfull, Your New Bank Balance Is:"COLOR_GREEN" $%d"COLOR_WHITE".",PlayerInfo[playerid][pBankAccount]);
SendClientMessage(playerid,-1,string);
}
}
else if(Fuel[vehicleid] >= 65 || Fuel[vehicleid] < 75)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -16);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 55 || Fuel[vehicleid] < 65)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -21);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 45 || Fuel[vehicleid] < 55)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -27);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 35 || Fuel[vehicleid] < 45)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -33);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 25 || Fuel[vehicleid] < 35)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -39);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 15 || Fuel[vehicleid] < 25)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -45);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
PlayerInfo[playerid][pPayByCash] = 0;
}
else if(Fuel[vehicleid] >= 0 || Fuel[vehicleid] < 15)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -51);
GameTextForPlayer(playerid,"~r~Unleadead 95 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
VehicleInfo[vehicleid][vEngine] = 0;
SetVehicleParamsEx(vehicleid,0,lights,doors,alarm, bonnet,boot,objective);
KillTimer(FuelTimer);
PlayerInfo[playerid][pPayByCash] = 0;
}
}
}
case 1:
{
if(GetPlayerMoney(playerid) >= 60)
{
if(Fuel[vehicleid] >= 100)
{
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Your Fuel Tank Is Full !!");
}
if(Fuel[vehicleid] < 100)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -60);
GameTextForPlayer(playerid,"~r~Super Unleadead 97 ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
VehicleInfo[vehicleid][vEngine] = 0;
engine = 0;
SetVehicleParamsEx(vehicleid,engine,lights,doors,a larm,bonnet,boot,objective);
KillTimer(FuelTimer);
}
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have Enough Cash !");
}
}
case 2:
{
if(GetPlayerMoney(playerid) >= 60)
{
if(Fuel[vehicleid] >= 100)
{
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Your Fuel Tank Is Full !!");
}
if(Fuel[vehicleid] < 100)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -60);
GameTextForPlayer(playerid,"~r~Diesel ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
VehicleInfo[vehicleid][vEngine] = 0;
engine = 0;
SetVehicleParamsEx(vehicleid,engine,lights,doors,a larm,bonnet,boot,objective);
KillTimer(FuelTimer);
}
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have Enough Cash !");
}
}
case 3:
{
if(GetPlayerMoney(playerid) >= 60)
{
if(Fuel[vehicleid] >= 100)
{
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Your Fuel Tank Is Full !!");
}
if(Fuel[vehicleid] < 100)
{
RefillingFuel[playerid] = 1;
GivePlayerMoney(playerid, -60);
GameTextForPlayer(playerid,"~r~Natural Gas ~n~ ~w~Refueling Vehicle ~n~ ~g~Please Wait...",4000,3);
FuelRefillTimer = SetTimerEx("RefillFuel",2000,1,"i",playerid);
VehicleInfo[vehicleid][vEngine] = 0;
engine = 0;
SetVehicleParamsEx(vehicleid,engine,lights,doors,a larm,bonnet,boot,objective);
KillTimer(FuelTimer);
}
}
else
{
TogglePlayerControllable(playerid, 1);
RefillingFuel[playerid] = 0;
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Don't Have Enough Cash !");
}
}
case 4:
{
HideMenuForPlayer(GasMenu,playerid);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
GameTextForPlayer(playerid,"~w~You Can Now Turn On Ignition ~n~ To Turn On Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~!",3000,4);
}
}
TogglePlayerControllable(playerid,1);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
//--[Fuel]
FuelCheckpoint[0] = CreateDynamicCP(2108.7808,927.2892,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[1] = CreateDynamicCP(2114.3733,926.6577,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[2] = CreateDynamicCP(2120.9197,927.8914,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[3] = CreateDynamicCP(2120.9055,923.4056,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[4] = CreateDynamicCP(2115.0183,923.2924,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[5] = CreateDynamicCP(2109.3677,923.4417,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[6] = CreateDynamicCP(2108.7913,916.6863,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[7] = CreateDynamicCP(2114.2791,917.0167,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[8] = CreateDynamicCP(2119.9773,916.3806,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[9] = CreateDynamicCP(2121.1189,912.7866,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[10] = CreateDynamicCP(2115.1331,912.8631,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[11] = CreateDynamicCP(2109.2546,913.0229,10.8203,3.0,0,0 ,-1,5.0);
FuelCheckpoint[12] = CreateDynamicCP(2634.1892,1114.1205,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[13] = CreateDynamicCP(2639.0669,1113.9657,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[14] = CreateDynamicCP(2644.7126,1113.3190,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[15] = CreateDynamicCP(2645.2688,1110.0897,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[16] = CreateDynamicCP(2640.2148,1109.9452,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[17] = CreateDynamicCP(2634.1799,1109.6874,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[18] = CreateDynamicCP(2634.4658,1102.8927,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[19] = CreateDynamicCP(2639.2800,1102.5261,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[20] = CreateDynamicCP(2645.1858,1102.3428,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[21] = CreateDynamicCP(2645.5928,1098.9929,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[22] = CreateDynamicCP(2640.2700,1099.2267,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[23] = CreateDynamicCP(2634.8308,1099.2721,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[24] = CreateDynamicCP(2195.2927,2470.0906,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[25] = CreateDynamicCP(2195.4221,2474.5916,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[26] = CreateDynamicCP(2195.3494,2480.1204,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[27] = CreateDynamicCP(2198.1458,2480.2900,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[28] = CreateDynamicCP(2198.3857,2474.9087,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[29] = CreateDynamicCP(2198.1028,2470.2695,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[30] = CreateDynamicCP(2206.0237,2470.1619,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[31] = CreateDynamicCP(2206.4529,2473.9092,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[32] = CreateDynamicCP(2206.5405,2479.7046,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[33] = CreateDynamicCP(2634.8308,1099.2721,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[34] = CreateDynamicCP(2208.6667,2480.8679,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[35] = CreateDynamicCP(2209.1143,2474.8806,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[36] = CreateDynamicCP(2208.7407,2470.3989,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[37] = CreateDynamicCP(2153.5828,2741.1687,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[38] = CreateDynamicCP(2147.6658,2741.0576,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[39] = CreateDynamicCP(2142.3901,2741.2117,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[40] = CreateDynamicCP(2141.6956,2743.8687,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[41] = CreateDynamicCP(2147.6206,2744.1465,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[42] = CreateDynamicCP(2153.5920,2744.0486,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[43] = CreateDynamicCP(2153.4204,2751.2065,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[44] = CreateDynamicCP(2147.7434,2751.8328,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[45] = CreateDynamicCP(2141.6116,2751.7439,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[46] = CreateDynamicCP(2141.8179,2755.1025,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[47] = CreateDynamicCP(2147.2407,2754.7571,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[48] = CreateDynamicCP(2153.2368,2754.5857,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[49] = CreateDynamicCP(1602.4869,2206.2961,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[50] = CreateDynamicCP(1596.6930,2206.2192,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[51] = CreateDynamicCP(1590.5864,2205.8420,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[52] = CreateDynamicCP(1590.0883,2203.2332,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[53] = CreateDynamicCP(1595.6864,2203.0886,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[54] = CreateDynamicCP(1601.5751,2203.3127,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[55] = CreateDynamicCP(1601.8931,2195.5793,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[56] = CreateDynamicCP(1596.0645,2195.0261,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[57] = CreateDynamicCP(1590.2952,2194.8159,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[58] = CreateDynamicCP(1590.0046,2192.4124,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[59] = CreateDynamicCP(1595.7502,2192.4153,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[60] = CreateDynamicCP(1602.0670,2192.3350,10.8203,3.0,0, 0,-1,5.0);
FuelCheckpoint[61] = CreateDynamicCP(-1477.2898,1856.8906,32.6398,3.0,0,0,-1,5.0);
FuelCheckpoint[62] = CreateDynamicCP(-1465.2904,1859.3123,32.6328,3.0,0,0,-1,5.0);
FuelCheckpoint[63] = CreateDynamicCP(-1464.9656,1862.3068,32.6398,3.0,0,0,-1,5.0);
FuelCheckpoint[64] = CreateDynamicCP(-1477.6771,1865.8319,32.6398,3.0,0,0,-1,5.0);
FuelCheckpoint[65] = CreateDynamicCP(-1465.3917,1866.6824,32.6328,3.0,0,0,-1,5.0);
FuelCheckpoint[66] = CreateDynamicCP(-1465.3975,1869.5880,32.6328,3.0,0,0,-1,5.0);
FuelCheckpoint[67] = CreateDynamicCP(-1478.0535,1868.8499,32.6328,3.0,0,0,-1,5.0);
FuelCheckpoint[68] = CreateDynamicCP(-1326.7760,2686.8931,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[69] = CreateDynamicCP(-1327.0586,2684.1975,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[70] = CreateDynamicCP(-1327.4729,2681.3140,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[71] = CreateDynamicCP(-1327.8630,2679.1577,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[72] = CreateDynamicCP(-1328.4803,2675.4961,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[73] = CreateDynamicCP(-1328.5684,2673.8777,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[74] = CreateDynamicCP(-1329.0122,2670.0313,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[75] = CreateDynamicCP(-1329.4550,2668.4976,50.0625,3.0,0,0,-1,5.0);
FuelCheckpoint[76] = CreateDynamicCP(-2409.1660,970.1500,45.3016,3.0,0,0,-1,5.0);
FuelCheckpoint[77] = CreateDynamicCP(-2409.0400,975.6674,45.2969,3.0,0,0,-1,5.0);
FuelCheckpoint[78] = CreateDynamicCP(-2409.1587,980.9697,45.2969,3.0,0,0,-1,5.0);
FuelCheckpoint[79] = CreateDynamicCP(-2412.8457,981.9281,45.2969,3.0,0,0,-1,5.0);
FuelCheckpoint[80] = CreateDynamicCP(-2412.7693,976.5505,45.2969,3.0,0,0,-1,5.0);
FuelCheckpoint[81] = CreateDynamicCP(-2413.0659,971.2130,45.2969,3.0,0,0,-1,5.0);
FuelCheckpoint[82] = CreateDynamicCP(-1664.1681,416.2672,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[83] = CreateDynamicCP(-1668.8328,411.5138,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[84] = CreateDynamicCP(-1673.9806,406.2597,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[85] = CreateDynamicCP(-1677.8134,402.3348,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[86] = CreateDynamicCP(-1680.4927,404.0694,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[87] = CreateDynamicCP(-1676.1893,408.0239,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[88] = CreateDynamicCP(-1670.9512,413.0762,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[89] = CreateDynamicCP(-1666.9934,417.4710,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[90] = CreateDynamicCP(-1670.4814,422.1657,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[91] = CreateDynamicCP(-1675.3580,418.4229,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[92] = CreateDynamicCP(-1680.9493,413.0178,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[93] = CreateDynamicCP(-1685.4596,408.2812,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[94] = CreateDynamicCP(-1686.8375,410.8939,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[95] = CreateDynamicCP(-1682.7776,414.7359,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[96] = CreateDynamicCP(-1677.3827,419.9156,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[97] = CreateDynamicCP(-1673.2299,424.4374,7.1797,3.0,0,0,-1,5.0);
FuelCheckpoint[98] = CreateDynamicCP(-1478.3348,1861.4565,32.6328,3.0,0,0,-1,5.0);
return 1;
}
public OnPlayerUpdate(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Fuel[vehicleid]<= 10)
{
//--[Fuel]
//-[Garage1]
SetPlayerMapIcon(playerid, 66,2112.1772,918.1446,10.4451,55,0,MAPICON_GLOBAL) ;
//-[Garage2]
SetPlayerMapIcon(playerid, 67,2640.4646,1102.7355,10.8203,55,0,MAPICON_GLOBAL );
//-[Garage3]
SetPlayerMapIcon(playerid, 68,2201.8408,2475.9265,10.8203,55,0,MAPICON_GLOBAL );
//-[Garage4]
SetPlayerMapIcon(playerid, 69,1004.0070,-939.3102,42,55,0,MAPICON_GLOBAL);
//-[Garage5]
SetPlayerMapIcon(playerid, 70,1944.3260,-1772.9254,13.3906,55,0,MAPICON_GLOBAL);
//-[Garage6]
SetPlayerMapIcon(playerid, 71,-90.5515,-1169.4578,2.4079,55,0,MAPICON_GLOBAL);
//-[Garage7]
SetPlayerMapIcon(playerid, 72,-1609.7958,-2718.2048,48.5391,55,0,MAPICON_GLOBAL);
//-[Garage8]
SetPlayerMapIcon(playerid, 73,-2029.4968,156.4366,29,55,0,MAPICON_GLOBAL);
//-[Garage9]
SetPlayerMapIcon(playerid, 74,-2408.7590,976.0934,45.4175,55,0,MAPICON_GLOBAL);
//-[Garage10]
SetPlayerMapIcon(playerid, 76,-1676.6323,414.0262,7,55,0,MAPICON_GLOBAL);
//-[Garage11]
SetPlayerMapIcon(playerid, 78,-1328.0000,2677.0000,50.0625,55,0,MAPICON_GLOBAL);
//-[Garage12]
SetPlayerMapIcon(playerid, 79,70.0000,1218.0000,18.8113,55,0,MAPICON_GLOBAL);
//-[Garage13]
SetPlayerMapIcon(playerid, 80,2146.0000,2749.0000,10.8203,55,0,MAPICON_GLOBAL );
//-[Garage14]
SetPlayerMapIcon(playerid, 81,1595.0000,2201.0000,10.8203,55,0,MAPICON_GLOBAL );
//-[Garage15]
SetPlayerMapIcon(playerid, 82,-1464.0000,1863.0000,32.6398,55,0,MAPICON_GLOBAL);
//-[Garage16]
SetPlayerMapIcon(playerid, 83,652.0000,-560.0000,16.3359,55,0,MAPICON_GLOBAL);
//-[Garage17]
SetPlayerMapIcon(playerid, 84,1383.9152,461.1158,20.1088,55,0,MAPICON_GLOBAL) ;
}
if(Fuel[vehicleid] >= 10)
{
//--[Fuel]
//-[Garage1]
SetPlayerMapIcon(playerid, 66,2112.1772,918.1446,10.4451,55,0,MAPICON_LOCAL);
//-[Garage2]
SetPlayerMapIcon(playerid, 67,2640.4646,1102.7355,10.8203,55,0,MAPICON_LOCAL) ;
//-[Garage3]
SetPlayerMapIcon(playerid, 68,2201.8408,2475.9265,10.8203,55,0,MAPICON_LOCAL) ;
//-[Garage4]
SetPlayerMapIcon(playerid, 69,1004.0070,-939.3102,42,55,0,MAPICON_LOCAL);
//-[Garage5]
SetPlayerMapIcon(playerid, 70,1944.3260,-1772.9254,13.3906,55,0,MAPICON_LOCAL);
//-[Garage6]
SetPlayerMapIcon(playerid, 71,-90.5515,-1169.4578,2.4079,55,0,MAPICON_LOCAL);
//-[Garage7]
SetPlayerMapIcon(playerid, 72,-1609.7958,-2718.2048,48.5391,55,0,MAPICON_LOCAL);
//-[Garage8]
SetPlayerMapIcon(playerid, 73,-2029.4968,156.4366,29,55,0,MAPICON_LOCAL);
//-[Garage9]
SetPlayerMapIcon(playerid, 74,-2408.7590,976.0934,45.4175,55,0,MAPICON_LOCAL);
//-[Garage10]
SetPlayerMapIcon(playerid, 76,-1676.6323,414.0262,7,55,0,MAPICON_LOCAL);
//-[Garage11]
SetPlayerMapIcon(playerid, 78,-1328.0000,2677.0000,50.0625,55,0,MAPICON_LOCAL);
//-[Garage12]
SetPlayerMapIcon(playerid, 79,70.0000,1218.0000,18.8113,55,0,MAPICON_LOCAL);
//-[Garage13]
SetPlayerMapIcon(playerid, 80,2146.0000,2749.0000,10.8203,55,0,MAPICON_LOCAL) ;
//-[Garage14]
SetPlayerMapIcon(playerid, 81,1595.0000,2201.0000,10.8203,55,0,MAPICON_LOCAL) ;
//-[Garage15]
SetPlayerMapIcon(playerid, 82,-1464.0000,1863.0000,32.6398,55,0,MAPICON_LOCAL);
//-[Garage16]
SetPlayerMapIcon(playerid, 83,652.0000,-560.0000,16.3359,55,0,MAPICON_LOCAL);
//-[Garage17]
SetPlayerMapIcon(playerid, 84,1383.9152,461.1158,20.1088,55,0,MAPICON_LOCAL);
}
return 1;
}
public OnPlayerKeyState(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(PRESSED(KEY_SUBMISSION))
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(VehicleInfo[vehicleid][vEngine] != 1)
{
if(Fuel[vehicleid] > 0)
{
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors, bonnet,boot,objective);
VehicleInfo[vehicleid][vEngine] = 1;
GameTextForPlayer(playerid,"~w~Ignition: ~g~On", 200,3);
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Ignition State:"COLOR_GREEN" On");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn Off Ignition Press Key ~k~~TOGGLE_SUBMISSIONS~ ");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On/Off Lights Press Key ~k~~PED_FIREWEAPON~ ");
FuelTimer = SetTimer("FuelConsumptionLow",10000,true);
}
if(Fuel[vehicleid]<= 0)
{
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors, bonnet,boot,objective);
VehicleInfo[vehicleid][vEngine] = 0;
GameTextForPlayer(playerid,"~w~You Are Out Of ~r~Fuel~w~!", 200,3);
KillTimer(FuelTimer);
}
}
else
{
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors, bonnet,boot,objective);
VehicleInfo[vehicleid][vEngine] = 0;
GameTextForPlayer(playerid,"~w~Ignition: ~r~Off", 200,3);
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" Ignition State:"COLOR_RED" Off");
SendClientMessage(playerid,-1,COLOR_YELLOW"<<Vehicle Info>>"COLOR_WHITE" To Turn On/Off Lights Press Key ~k~~PED_FIREWEAPON~ ");
KillTimer(FuelTimer);
}
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == 2 && oldstate == 1)
{
new string2[24];
format(string2,sizeof string2,"Fuel:%i%",Fuel[vehicleid]);
TextDrawSetString(FuelTxt[playerid],string2);
}
if(newstate == 1 && oldstate == 2)
{
TextDrawHideForPlayer(playerid,FuelTxt[playerid]);
}
return 1;
}

Donvalley
22/06/2013, 08:46 AM
I don't know how is this setup Gas[vid]

Don't you have something that formats a random digit of how many digits you want?

new vid = GetPlayerVehicleID(playerid);

AntonioCroatia
22/06/2013, 08:50 AM
Try to use this, replace with yours...

if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new gastext[41];
new vid = GetPlayerVehicleID(playerid);
format(gastext, sizeof(gastext), "Vehicle Fuel : %i", Gas[vid]);
TextDrawSetString(GasAmount, gastext);
TextDrawShowForPlayer(playerid, GasAmount);
}

Donvalley
22/06/2013, 08:56 AM
no difference

Donvalley
22/06/2013, 09:49 AM
how do i make the fuel gauge no more then 3 decimals

Donvalley
22/06/2013, 11:05 AM
everything working except for more then 3 digits. says 100 next time it shows 13 9576857495 or other random numbers

Donvalley
12/05/2014, 08:55 AM
bump

BroZeus
12/05/2014, 09:21 AM
show where u change value of Gas[vid] and show wheer have u declared this Gas[MAX_VEHICLES]

Donvalley
12/05/2014, 09:57 AM
show where u change value of Gas[vid] and show wheer have u declared this Gas[MAX_VEHICLES]


new speed = (floatround(Dis)*MULTIPLY_SPEED);

new Sspeed[15];

if( speed == 0) {
format(Sspeed,sizeof(Sspeed),"~G~%dm/h",(floatround(Dis)*MULTIPLY_SPEED));
} else if( speed >= 1 && speed <= 60 ){
format(Sspeed,sizeof(Sspeed),"~G~%dm/h",(floatround(Dis)*MULTIPLY_SPEED));
Gas[carid] -= 0.2;
} else if( speed >= 61 && speed <= 120 ){
format(Sspeed,sizeof(Sspeed),"~R~%dm/h",(floatround(Dis)*MULTIPLY_SPEED));
Gas[carid] -= 0.3;
} else {
format(Sspeed,sizeof(Sspeed),"~R~%dm/h",(floatround(Dis)*MULTIPLY_SPEED));
Gas[carid] -= 0.0;
}



for(new i = 0; i < MAX_VEHICLES; i++)
{
Gas[i] = 100;
}


those?

Donvalley
12/05/2014, 10:09 AM
is it something to do with this:


(floatround(Dis)*MULTIPLY_SPEED));

Donvalley
12/05/2014, 11:21 AM
bump - getting very desperate!

Donvalley
12/05/2014, 12:39 PM
Gas[carid] -= 0.1;


its to do with this if i set it like this :


Gas[carid] -= 1;


it works but takes to much gas why cant i use 0.anything?

Macronix
12/05/2014, 01:53 PM
The "new Gas[MAX_whatever];" needs to be "new Float:Gas[MAX_whatever];" :)

Donvalley
12/05/2014, 02:23 PM
fixed it by changing from

Gas[carid] -= 0.1;


to


Gas[carid] -= 1/10;


works perfectly, thanks all anyways for the help :)