xeon17 Posted July 27, 2015 Share Posted July 27, 2015 function fireRocks() local rock = createObject ( 3930, -2815.18, 470.16, 4.86, 0, 354.488, 0 ) local weapon = createWeapon ("Molotov", -2815.18, 470.16, 4.86 ) wX,wY,wZ = getElementPosition(weapon) local fire = createFire ( wX,wY,wZ, 2) attachElements(rock,weapon,0,0,2) setTimer(function() if fire then createFire(wX,wY,wZ,2) end end, 120000,0) end addCommandHandler ( "fire", fireRocks ) This will create your desired fire at the coordinates -2815.18, 470.16, 4.86. The fire will be "reignited" every 2 minutes. Have you tried the code of Lawliet ? Link to comment
TheSmart Posted July 27, 2015 Author Share Posted July 27, 2015 nah didn't see it ye it working Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 everything work good but now i want to change it like meteor that video show you what i want give me example that how to make it? Link to comment
GTX Posted July 28, 2015 Share Posted July 28, 2015 What specifically do you want? Make meteor fall? Link to comment
GTX Posted July 28, 2015 Share Posted July 28, 2015 Simply set object position above player. Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 Simply set object position above player. how can you give me example? Link to comment
TheSmart Posted July 29, 2015 Author Share Posted July 29, 2015 nvm x1 = x - radius x2 = x + radius y1 = y - radius y2 = y + radius x = math.random(x1, x2) y = math.random(y1, y2) idk why im getting that error http://prntscr.com/7yac21 Link to comment
GTX Posted July 29, 2015 Share Posted July 29, 2015 Maybe post full script? It's because you didn't define x or y. Link to comment
TheSmart Posted July 29, 2015 Author Share Posted July 29, 2015 radius = 14 explosionType = 10 timerSeconds = 3000 showTheCredits = function(l_1_0) outputChatBox("Meteor-Rain script was created by Seers!", l_1_0, 200, 200, 30, true) end addCommandHandler("meteor", showTheCredits) rainOnAllPlayers = function() for l_2_3,l_2_4 in ipairs(getElementsByType("player")) do fallMeteo(l_2_4) end end CheckTheFallingRocks = function() for l_3_3,l_3_4 in ipairs(getElementsByType("vehicle")) do if getElementModel(l_3_4) == 564 and getElementData(l_3_4, "meteor") == 1 and getElementData(l_3_4, "exploded") == 0 then x, y, z = getElementPosition(l_3_4), l_3_4, "exploded" new1 = getElementData(l_3_4, "z-koord") + 3 if new1 <= getElementData(l_3_4, "z-koord") then createExplosion(x, y, z, explosionType, nil) setElementData(l_3_4, "exploded", 1) theFallingRock = getElementData(l_3_4, "attachedRock") setTimer(destroyElement, 5000, 1, theFallingRock) end end end end setTimer(CheckTheFallingRocks, 50, 0) thisResourceStarts = function() if tonumber(get("secondsWhenTheNextStoneFalls")) and tonumber(get("secondsWhenTheNextStoneFalls")) >= 1 then timerSeconds = tonumber(get("secondsWhenTheNextStoneFalls")) * 1000 else outputDebugString("Invalid seconds number in settings. Please check meta.xml") timerSeconds = 3000 end if tonumber(get("fallRadius")) and tonumber(get("fallRadius")) >= 0 then radius = tonumber(get("fallRadius")) else radius = 14 outputDebugString("Invalid fall radius in settings. Please check meta.xml") end setTimer(rainOnAllPlayers, timerSeconds, 0) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), thisResourceStarts) fallMeteo = function(l_5_0) if getElementInterior(l_5_0) == 0 and getElementDimension(l_5_0) == 0 and getElementHealth(l_5_0) >= 1 then x, y, z = getElementPosition(l_5_0), l_5_0 x1 = x - radius x2 = x + radius y1 = y - radius y2 = y + radius x = math.random(x1, x2) y = math.random(y1, y2) theMeteo = createVehicle(564, x, y, z + 60, 30, 30, 30) setElementData(theMeteo, "meteor", 1) setElementData(theMeteo, "z-koord", z) setElementData(theMeteo, "exploded", 0) setElementAlpha(theMeteo, 0) theRock = createObject(2936, 0, 0, 0) setElementData(theMeteo, "attachedRock", theRock) attachElements(theRock, theMeteo, 0, 0, 0) if isPedInVehicle(l_5_0) then vx, vy, vz = getElementVelocity(getPedOccupiedVehicle(l_5_0)), getPedOccupiedVehicle(l_5_0), l_5_0 setElementVelocity(theMeteo, vx, vy, -5) end end end displayVehicleLoss = function(l_6_0) if getElementModel(source) == 564 and getElementData(source, "meteor") == 1 and getElementData(source, "exploded") == 0 then x, y, z = getElementPosition(source), source, "exploded" createExplosion(x, y, z, explosionType, nil) setElementData(source, "exploded", 1) theFallingRock = getElementData(source, "attachedRock") setTimer(destroyElement, 5000, 1, theFallingRock) end end addEventHandler("onVehicleDamage", getRootElement(), displayVehicleLoss) Link to comment
Cadell Posted July 29, 2015 Share Posted July 29, 2015 Try function fireRocks () local rock = createObject ( 3930, -2815.18, 470.16, 4.86, 0, 354.488, 0 ) local weapon = createWeapon ("Molotov", -2815.18, 470.16, 4.86 ) local fire = function() createFire ( -2815.18, 470.16, 4.86, 2) end attachElements ( rock, weapon, 0, 0, 2 ) setTimer ( fire, 99999999, 1,true) end addCommandHandler ( "fire", fireRocks ) Link to comment
GTX Posted July 29, 2015 Share Posted July 29, 2015 Maybe if you'd do it by yourself, you wouldn't have this problem. Looks like it's decompiled. x, y, z = getElementPosition(l_5_0), l_5_0 to x, y, z = getElementPosition(l_5_0) Link to comment
TheSmart Posted July 29, 2015 Author Share Posted July 29, 2015 Maybe if you'd do it by yourself, you wouldn't have this problem. Looks like it's decompiled. x, y, z = getElementPosition(l_5_0), l_5_0 to x, y, z = getElementPosition(l_5_0) thnx 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