Helicopter Script - Fe
AddMount(750001, name = "Attack Helicopter", model = "model/helicopter.o3d", -- you need to create or rename a model speed = 50, -- base walk speed ~12, so 50 = very fast fly = true, canattack = false, -- no attacking while mounted cooldown = 300, -- seconds before remount effects = effect = "fly_smoke", attach = "engine" , effect = "rotor_blur", attach = "rotor" , sound = "heli_rotor.wav", fuelItem = 750002, -- optional fuel consumption check fuelInterval = 600, -- seconds per fuel unit onFuelEmpty = function(player) Dismount(player) Message(player, "Out of fuel! Helicopter lands.") end ) You need these client assets (or substitute existing ones):
function SaveLocation() local x, y, z = GetPlayerPos() local map = GetMapName() local locData = string.format("%s,%d,%d,%d", map, x, y, z)
function TeleportTo(locData) local parts = Split(locData, ",") local map = parts[1] local x = tonumber(parts[2]) local y = tonumber(parts[3]) local z = tonumber(parts[4]) FE Helicopter Script
function HasFuel() return CountItem(750002) > 0 or GetPlayerVar("HELI_FUEL_TICK") == "1" end
function RepairHeli() SetPlayerVar("HELI_COOLDOWN", 0) Say("Helicopter repaired. Cooldown removed.") end Right-click to ride
| File | Path | |------|------| | Helicopter model | model/vehicle/helicopter.o3d | | Texture | model/vehicle/heli_texture.dds | | Icon | icon/item/heli_icon.bmp | | Sound | sound/heli_rotor.wav | | Effect | effect/heli_fly_smoke.efx |
function UseFuel() local fuel = CountItem(750002) if fuel > 0 then RemoveItem(750002, 1) SetPlayerVar("HELI_FUEL_TICK", "1") SetTimer("FuelExpire", 600000) -- 10 min in ms end end Lua Script – NPC “Helicopter Pilot” (for teleport
INSERT INTO `item_proto` (`id`, `name`, `type`, `typeid`, `icon`, `desc`, `price_sell`, `price_buy`, `sex`, `job`, `level`, `attack`, `defence`, `range`, `slot`, `max_stack`, `apply`, `value`, `duration`) VALUES (750001, 'Helicopter License', 16, 1, 'heli_icon.bmp', 'Allows you to summon a personal helicopter. Right-click to ride.', 100000, 500000, 2, 0, 20, 0, 0, 0, 0, 1, 0, 0, 0); Adjust id to an unused value in your server. typeid 1 = mount. 2. Lua Script – NPC “Helicopter Pilot” (for teleport & fuel) Save as script_helicopter.lua in your scripts/npc/ folder.
function BuyFuel() if CountItem(750002) < 1 then if GetPlayerGold() >= 50000 then TakeGold(50000) GiveItem(750002, 1) Say("Here's a Fuel Barrel. Lasts 10 flight minutes.") else Say("Need 50,000 penya.") end else Say("You already have fuel.") end end
-- NPC ID: 80001 (Helicopter Pilot) -- Location: Flarine, near hangar function OnTalk( npc ) local dialog = " [Helicopter Pilot]\n Welcome, pilot! I manage your personal helicopter.\n What would you like to do?\n --- 1. Teleport to saved location\n 2. Save current location\n 3. Buy Fuel Barrel (10 min flight)\n 4. Repair helicopter (remove cooldown)\n 5. Exit\n " local choice = Ask( dialog, 5 )
if choice == 1 then TeleportMenu() elseif choice == 2 then SaveLocation() elseif choice == 3 then BuyFuel() elseif choice == 4 then RepairHeli() else Say("Fly safe, pilot!") end end