Problem with /fill command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with /fill command (
/showthread.php?tid=471753)
Problem with /fill command -
Lops - 25.10.2013
So. I have the problem with command /fill. It supposed to refuel my vehicle with certain amount of fuel.
If i write example /fill 12, it isn't refuel my vehicle properly and the fuel meter don't increase about 12. Sometimes if i refuel my vehicle, it says, that, "Your car is full of fuel" or sth, but it isn't.
Here is the command, what may help you to understand, whats the problem. I can't figure it out.
pawn Код:
command(fill, playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid), fuel;
if(PetrolStations(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(Engine[vehicleid] == 0)
{
if(sscanf(params, "i", fuel)) return SendClientMessage(playerid, WHITE, "Kasutus: /fill [amount(1-100)]");
{
new amount = VehicleFuel[vehicleid] + fuel;
if(amount < 100)
{
KillTimer(FuelTimer[playerid]);
VehicleFuel[vehicleid] += fuel;
new value = fuel * 2;
GivePlayerMoney(playerid, value);
if(VehicleFuel[playerid] > 100)
{
VehicleFuel[vehicleid] = 100;
}
FuelLowerTimer(playerid, vehicleid);
}
else return SendClientMessage(playerid, WHITE, "Your vehicle is full of fuel. (/einfo)");
}
}
else return SendClientMessage(playerid, WHITE, "You have to turn engine off first.");
}
else return SendClientMessage(playerid, WHITE, "You have to be in vehicle.");
}
else return SendClientMessage(playerid, WHITE, "You are not nere any gas stations.");
return 1;
}
Re: Problem with /fill command -
LemonPunch - 25.10.2013
Are u using ZCMD? if u do here:
pawn Код:
CMD:fill(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (/car engine).");
if(!IsAtFuelStation(playerid)) return SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
if(VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playerid, COLOR_RED, "This vehicle's tank is already full.");
if(RefuelingVehicle[playerid] == 1) return SendClientMessageEx(playerid, COLOR_RED, "You are refilling your vehicle's tank.");
SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
RefuelingVehicle[playerid] = 1;
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
}
return 1;
}