public DecreaseFuel(playerid)
{
new string[255];
for(new i = 0; i < MAX_VEHICLES; i++)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
Fuel[i] = Fuel[i] - 1;
printf("%d",Fuel[i]);
if(Fuel[i] <= 0)
{
Fuel[i] = 0;
SetVehicleParamsEx(i,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
format(string, sizeof(string), "** The vehicle has run out of fuel. (( %s )).", GetName(playerid));
NearByMessage(playerid, SCRIPTPURPLE, string);
}
}
}
}
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~ ~R~%d KM/H ~n~~r~%d FUEL", GetPlayerSpeed(i, 0), Fuel[i]);
Thanks, I looked at this before I made this thread and it didn't really provide any insightful answers.
Still, thanks though. |
Show me the refuel you are making because here is only when vehicle loses fuel..
I cant actually get what your gametext do... so explain it better if you don't mind. |
function Decreasing_Fuel()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if (isrefuelling[i]) continue;
new vid = GetPlayerVehicleID(i);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
if (GetPlayerVehicleSeat(i) == 0)
{
fuel[vid] = fuel[vid] -1;
if (fuel[vid]<1)
{
fuel[vid] = 0;
SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, objective);
GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,3);
}
}
new string[125];format(string,sizeof string,"Vehicle Fuel:%i",fuel[vid]);
TextDrawSetString(td_fuel[i],string);
}
return 1;
}