16.01.2015, 02:08
So I'm having another issue, and its with something that's a little bit complicated.
I have a public to decrease fuel every so long.
However, when it's meant to update on the game text here:
It just stays at zero.. even though when I print on the public it goes down and Fuel[MAX_VEHICLES] is defined as a global variable.
Help (REP+)
I have a public to decrease fuel every so long.
pawn Код:
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);
}
}
}
}
pawn Код:
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~ ~R~%d KM/H ~n~~r~%d FUEL", GetPlayerSpeed(i, 0), Fuel[i]);
Help (REP+)