10.06.2012, 09:20
i have a textdraw speedo here is my public fuel
here is my /fuelcars the problem is if i type /fuelcars the fuel goes to 100 after 10 minutes..
pawn Код:
public Fuel()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && (GetPlayerState(i)== PLAYER_STATE_DRIVER))
{
if(IsRefilling[i])
{
continue;
}
new
vehicleid = GetPlayerVehicleID(i),
TD_String[25]
;
if(GetPlayerVehicleSeat(i) != 0)
{
continue;
}
if(IsRanOutOfFuel[vehicleid])
{
continue;
}
if(!VehicleFuel[vehicleid])
{
new
engine,
lights,
alarm,
doors,
bonnet,
boot,
objective
;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(i, -1, "You ran out of fuel.");
IsRanOutOfFuel[vehicleid] = true;
return 1;
}
if(engineOn[i] == 1)
VehicleFuel[vehicleid]--;
format(TD_String, 25, "%i %", VehicleFuel[vehicleid]);
TextDrawSetString(Text:Values[i][3], TD_String);
}
}
}
}
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/fuelcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new c=0;c<CAR_AMOUNT;c++)
{
VehicleFuel[c] = 100;
}
SendClientMessage(playerid, COLOR_GREY, " All cars filled with Fuel ! ");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
return 1;
}
}
return 1;
}