09.12.2012, 07:06
Hello,
My fuel system isnt working correctly.
I want it to say if the engine is on that they have to turn it off etc.
I also want it to check how much the car's fuel is and that minus 100, so that is the new fuel that gets added.
and that *3 but it doesn't work.
Menu reaction:
Public refill:
My fuel system isnt working correctly.
I want it to say if the engine is on that they have to turn it off etc.
pawn Код:
command(refill, playerid, params[])
{
#pragma unused params
if(IsAtGasStation(playerid))
{
new PCar = GetClosestVehicle(playerid, 5);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(PCar,engine,lights,alarm,doors,bonnet,boot,objective);
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(engine == VEHICLE_PARAMS_OFF)
{
if(Vehicles[PCar][Fuel] != 100)
{
ShowMenuForPlayer(Menu:Gas, playerid);
}
else
{
SCM(playerid, ADMINBLUE, "Your car is already full!");
}
}
else
{
SCM(playerid, WHITE,"Your vehicle engine is still on!");
}
}
else
{
SCM(playerid, WHITE,"You are still in a vehicle!");
}
}
}
else
{
SCM(playerid,0xFFFF00AA,".:: [ERROR]: You are not at a Gas Station! ::.");
}
return 1;
}
and that *3 but it doesn't work.
Menu reaction:
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
if(GetPlayerMenu(playerid) == Gas)
{
switch(row)
{
case 0:
{
TogglePlayerControllable(playerid,0);
GameTextForPlayer(playerid,"~b~Petrol ~n~ ~w~Refueling vehicle ~n~~g~Please wait..",10000,3);
RefillTimer = SetTimerEx("ReFill", 10000, false, "i", playerid);
Tankuje[playerid] = 1;
}
case 1:
{
GameTextForPlayer(playerid,"~r~This function isn't working yet, sorry.",3500,3);
TogglePlayerControllable(playerid,0);
}
case 2:
{
GameTextForPlayer(playerid,"~y~Have a nice day!",4000,3);
HideMenuForPlayer(Gas,playerid);
}
}
}
return 1;
}
pawn Код:
public ReFill(playerid)
{
new VehicleFuel, NewFuel, str[128];
new PCar = GetClosestVehicle(playerid, 5);
VehicleFuel = Vehicles[PCar][Fuel];
NewFuel = 100-VehicleFuel;
Vehicles[PCar][Fuel] = 100;
GivePlayerMoney(playerid, -3*NewFuel);
Player[playerid][Money] = -3*NewFuel;
format(str, sizeof(str), "You refilled your vehicle with %d liters and the price was %d.", NewFuel, 3*NewFuel);
SCM(playerid, ADMINBLUE, str);
KillTimer(RefillTimer);
TogglePlayerControllable(playerid,1);
}