Jump to content

Help


Recommended Posts

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 
            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", resourceRoot, 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) 
        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) 
        setElementAlpha(theMeteo, 0) 
        theRock = createObject(3930, 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)) 
            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) 
        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

First of all, do not triple post.

Second, improve your English or go to your language forum.

Third, why is this script decompiled? (Can see from variable names)

This should work I think.

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 
            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", resourceRoot, 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) 
        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) 
        setElementAlpha(theMeteo, 0) 
        setElementHealth(theMeteo, 250) 
        setVehicleDamageProof(theMeteo, true) 
        theRock = createObject(3930, 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)) 
            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) 
        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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...