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;
}
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;
}
VehicleFuel[c] = 100;
if(strcmp(cmd, "/fuelcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new c=0;c<CAR_AMOUNT;c++)
{
new TD_String[25];
VehicleFuel[c] = 100;
format(TD_String, 25, "%i %", VehicleFuel[vehicleid]);
TextDrawSetString(Text:Values[i][3], TD_String);
}
SendClientMessage(playerid, COLOR_GREY, " All cars filled with Fuel ! ");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/fuelcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
new vehicleid = GetPlayerVehicleID(playerid);
new TD_String[25];
VehicleFuel[c] = 100;
format(TD_String, 25, "%i %", VehicleFuel[vehicleid]);
TextDrawSetString(Text:Values[i][3], TD_String);
}
SendClientMessage(playerid, COLOR_GREY, " All cars filled with Fuel ! ");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
return 1;
}
}
return 1;
}
(27934) : error 017: undefined symbol "i" = TextDrawSetString(Text:Values[i][3], TD_String);
(27932) : error 017: undefined symbol "vehicleid" = format(TD_String, 25, "%i %", VehicleFuel[vehicleid]);
You want to refill all cars, or just used cars?
Why: new vehicleid = GetPlayerVehicleID(playerid); ? Correct is: new vehicleid = GetPlayerVehicleID(i); // get vehicleid of vehicle used by "i" maybe add first if(!IsPlayerInAnyVehicle(i)) continue; VehicleFuel[vehicleid] = 100; format(TD_String, 25, "%i %", VehicleFuel[i]); VehicleFuel -> textdraw of the user, or of the vehicle? |
if(strcmp(cmd, "/fuelcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new TD_String[25];
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new veh=0;veh<MAX_VEHICLES;veh++)
{
VehicleFuel[veh] = 100;
format(TD_String, sizeof(TD_String), "%d", VehicleFuel[veh]);
}
TextDrawSetString(Text:Values[playerid][3], TD_String);
SendClientMessage(playerid, COLOR_GREY, " All cars filled with Fuel ! ");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
return 1;
}
}
return 1;
}