Bug CMD:refuel 'Please Help.
#1

Someone Help me ?

When I type /refuel near gas pump
It didn't work



So It didn't work when near the gas pump



Command:
Код:
CMD:refuel(playerid, params[])
{
    if (GetPVarType(playerid, "Refueling"))
	{
	    SetPVarInt(playerid, "Refueling", -1);
	}
	else
	{

	    new vehicleid = GetPlayerVehicleID(playerid);

		new
			iBusinessID,
			iPumpID;

		GetClosestGasPump(playerid, iBusinessID, iPumpID);
		if (iBusinessID == INVALID_BUSINESS_ID)
		{
		        SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
                    	return 1;
		}
		if (!Businesses[iBusinessID][bStatus])
		{
			SendClientMessageEx(playerid, COLOR_RED, "This fuel station is closed.");
                    	return 1;
		}
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "You are not driving a vehicle!");
                    	return 1;
		}
		if(VehicleFuel[vehicleid] >= 100.0)
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "Your vehicle fuel tank is full!");
                    	return 1;
		}
		if (IsVIPcar(vehicleid))
		{
			SendClientMessageEx(playerid, COLOR_RED, "This is a vehicle from the VIP garage and it has already unlimited amount of fuel.");
                    	return 1;
		}
		if (CreatedCars[vehicleid] != INVALID_VEHICLE_ID)
		{
			SendClientMessageEx(playerid, COLOR_RED, "This is an admin-spawned vehicle and it has already unlimited amount of fuel.");
                    	return 1;
		}
		new engine,lights,alarm,doors,bonnet,boot,objective;
		GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
	        if(engine == VEHICLE_PARAMS_ON)
		{
	 		SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (/car engine).");
                    	return 1;
		}
		if (Businesses[iBusinessID][GasPumpGallons][iPumpID] == 0.0)
		{
			SendClientMessageEx(playerid, COLOR_RED, "No gas left in the gas station tank.");
                    	return 1;
		}
		if (GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)
		{
			SendClientMessageEx(playerid,COLOR_RED,"This vehicle does not need fuel.");
                    	return 1;
		}
		if (Businesses[iBusinessID][GasPumpVehicleID][iPumpID] > 0)
		{
		        SendClientMessageEx(playerid, COLOR_RED, "This gas pump is occupied.");
                    	return 1;
		}
		SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
		SendClientMessageEx(playerid, COLOR_YELLOW, "Type /refuel again to stop refueling.");
		SetPVarInt(playerid, "Refueling", vehicleid);
		Businesses[iBusinessID][GasPumpSaleGallons][iPumpID] = 0;
		Businesses[iBusinessID][GasPumpSalePrice][iPumpID] = 0;
		Businesses[iBusinessID][GasPumpVehicleID][iPumpID] = vehicleid;
		Businesses[iBusinessID][GasPumpTimer][iPumpID] = SetTimerEx("GasPumpSaleTimer", 200, true, "iii", playerid, iBusinessID, iPumpID);

	}
	return 1;
	
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)