onfloow21 Posted June 27, 2021 Share Posted June 27, 2021 spawnLocations = { {-334.01287841797,755.61181640625,30.81921005249}, {-1429.798828125, -951.255859375, 201.04934692383}, {-2715.1435546875, -2481.720703125, 2.9290246963501}, {-2443.8115234375, 666.802734375, 34.791397094727}, {255.5625, -1826.6689453125, 3.8544130325317}, {2035.9404296875, -1183.443359375, 22.706228256226}, {2857.73046875, 1764.4794921875, 10.8203125}, } lootItems = { {"Toolbox",100}, } function math.percentChance(percent,repeatTime) local hits = 0 for i = 1,repeatTime do local number = math.random(1,1000)/10 if number <= percent then hits = hits+1 end end return hits end respawnAirdrop2Timer2 = false function spawnAirdrop2(player) if isElement(player) and not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then return end if isElement(productq2) then destroyElement(productq2) end if isElement(avialColq2) then destroyElement(avialColq2) end if isElement(blipq2) then destroyElement(blipq2) end if isTimer(respawnAirdrop2Timer2)then killTimer(respawnAirdrop2Timer2) end respawnAirdrop2Timer2 = setTimer(spawnAirdrop2,2100000,1) local item_id = math.random(1,#spawnLocations) x,y,z = spawnLocations[item_id][1],spawnLocations[item_id][2],spawnLocations[item_id][3]-0.16 local location = getZoneName(x,y,z) local city = getZoneName(x,y,z,true) outputChatBox("#FF0000[AIR-DROP] #00FF00SPRIJIN AERIAN AL ARMATEI! SE POATE VEDEA PE MAPA/GPS!", getRootElement(), 255,255,255, true) xpsq,ypsq,zpsq = x,y,z+7,3 xpvq,ypvq,zpvq = x-48,y-16,z+37 xsbq,ysbq,zsbq = x-48,y-16,z+41 xssq,yssq,zssq = x-528,y+2,z+141 xsdq,ysdq,zsdq = x+528,y+2,z+141 blipq2 = createBlip(x,y,z,5) aviaNavaq2 = createObject(1683,xssq,yssq,zssq,0,0,0) moveObject(aviaNavaq2,8000,xsbq,ysbq,zsbq) setTimer(function() parasProdq2 = createObject(2903,xpvq,ypvq,zpvq,0,0,0) moveObject(aviaNavaq2,8000,xsdq,ysdq,zsdq) moveObject(parasProdq2,15000,xpsq,ypsq,zpsq) triggerClientEvent("playAirdrop2Sound",getRootElement()) end,8000,1) setTimer(destroyElement,16100,1,aviaNavaq2) setTimer(function() destroyElement(parasProdq2) productq2 = createObject(2919,x,y,z,0,0,0) setElementFrozen(productq2,true) avialColq2 = createColSphere(x,y,z,2) attachElements(avialColq2,productq2,0,0,0) setElementData(avialColq2,"parent",object) setElementData(avialColq2,"hospitalbox",true) setElementData(avialColq2,"MAX_Slots",0) setElementData(avialColq2, "M16A2", 1) setElementData(avialColq2, "DMR", 1) setElementData(avialColq2, "5.56x45mm Cartridge", 6) setElementData(avialColq2, "7.62x51mm Cartridge", 6) setElementData(avialColq2, "Backpack (Coyote)", 1) setElementData(avialColq2, "Blood Bag", 2) setElementData(avialColq2, "Morphine", 2) setElementData(avialColq2, "Painkiller", 2) setElementData(avialColq2, "GPS", 1) setElementData(avialColq2, "Map", 1) setElementData(avialColq2, "Watch", 1) for i,item in pairs(lootItems)do local value = math.percentChance(item[2],1) if value >= 1 then setElementData(avialColq2,item[1],value) local ammoData,weapID = getWeaponAmmoType(item[1],true) if ammoData then local minBullets,maxBullets = math.floor(getAmmoPlus(ammoData)/3),getAmmoPlus(ammoData)*2 local ammoQuantity = math.random(minBullets,maxBullets) setElementData(avialColq2,ammoData,ammoQuantity) end end end end,23100,1) end spawnAirdrop2() addCommandHandler("spawnairdrop",spawnAirdrop2) addCommandHandler("removeairdrop",function(player) if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then return end if isElement(productq2) then destroyElement(productq2) end if isElement(avialColq2) then destroyElement(avialColq2) end if isElement(blipq2) then destroyElement(blipq2) end if isTimer(respawnAirdrop2Timer2)then killTimer(respawnAirdrop2Timer2) end end) I'm gettin' this ERROR: ardp/Server2.lua:98: attempt to call global 'getWeaponAmmoType' (a nil value) Link to comment
Discord Moderators Zango Posted June 28, 2021 Discord Moderators Share Posted June 28, 2021 "getWeaponAmmoType" is not an MTA function but a custom one. I'm guessing you found this script somewhere, you need the rest of it to make it work Link to comment
Shady1 Posted June 28, 2021 Share Posted June 28, 2021 if you want i can give you free airdrop system Link to comment
Shady1 Posted June 28, 2021 Share Posted June 28, 2021 -- HELI CRASH SIDES local fgCrashSpawns = { ["helicrash"] = { {1146.16,1221.79,10.1}, }, } local fgLootItems = { ["helicrashLoots"] = { -- WEAPONS {"M4",1}, {"AK-47",1}, -- ITEMS {"Toolbox",2}, {"Infrared Goggles",1}, {"Night Vision Goggles",1}, {"GPS",2}, {"Map",2}, -- MED {"Painkiller",8}, {"Morphine",8}, -- CLOTH {"Punk Clothing",2}, {"Ghillie Suit",3}, -- BACKPACK {"Alice Pack",1}, {"Czech Backpack",1}, {"Coyote Backpack",1}, {"OS Backpack",1}, }, ["helicrashMags"] = { {"M4 Mag",1}, {"AK Mag",1}, }, } function math.percentChance( percent, repeatTime ) local hits = 0 for i = 1, repeatTime do local number = math.random( 0, 200 ) / 2 if number <= percent then hits = hits + 1 end end return hits end function createHeliCrashSite( ) if heliCol then destroyElement( getElementData( heliCol, "parent" ) ) destroyElement( heliCol ) destroyElement( heliBlip ) end local item_id = math.random( 1, #fgCrashSpawns["helicrash"] ) local x,y,z = fgCrashSpawns["helicrash"][item_id][1],fgCrashSpawns["helicrash"][item_id][2],fgCrashSpawns["helicrash"][item_id][3] helicrash = createVehicle( 417, x,y,z+1,0,0,90, nil, nil, nil ) blowVehicle( helicrash ) setElementFrozen( helicrash, true ) heliCol = createColSphere( x,y,z, 6 ) heliBlip = createBlip( x,y,z, 5 ) outputChatBox( "#ffdf32[Klarice] #e5e5e5New Heli-Crash has been destroyed!", root, 0, 255, 0, true ) setElementData( heliCol, "parent", helicrash ) setElementData( heliCol, "helicrash", true ) setElementData( heliCol, "MAX_Slots", 0 ) for i, item in ipairs( fgLootItems["helicrashLoots"] ) do local value = math.percentChance( item[2] * 3.5, 15 ) setElementData( heliCol, item[1], value ) end for i, item in ipairs( fgLootItems["helicrashMags"] ) do setElementData( heliCol, item[1], math.random( 10, 30 ) ) end setTimer( createHeliCrashSite, 3600000, 1 ) end createHeliCrashSite( ) meta.xml : <meta> <info author="shady" name="heliCrash" version="1.0" type="script" /> <script src="helicrashes.lua" type="server" /> </meta> 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now