Jump to content

Debug Script myster help


Recommended Posts

  
local mbag = { 
    {2422.3,-2261.6,16}, 
    {1758.9,-2767.9,1.7}, 
    {2493.3,-951.8,82.25}, 
    {815.7,-1108.2,25.8}, 
    {390.9,-2054.3,13.8}, 
    {-719.05,-1938.8,8.35}, 
    {-625.7,-2249.5,23.05}, 
    {-1812.3,-168.5,18.2}, 
    {-2659.5,1528.05,54.79}, 
    {-1733.76,194.75,3.6}, 
    {-2535.5,40.15,8.5}, 
    {-1804.85,558.45,35.15}, 
    {-752.6,-131.6,65.8}, 
} 
  
function createBag() 
    local random = math.random ( #mbag ) 
    local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] 
    bag = createPickup( x, y, z, 3, 1550 ) 
    setElementCollisionsEnabled( bag, false ) 
    bl = createBlipAttachedTo(bag,37) 
   outputChatBox("A Mystery Bag Has Been Appeard On Your Map Get It First And Get Some Nice Prizes In It!", root, 0, 255, 0) 
end 
addEventHandler("onResourceStart", resourceRoot,createBag) 
  
addEventHandler("onPickupHit",root, 
function ( player ) 
    if ( source ~= bag ) then 
        return 
    end 
    if ( isPedInVehicle( player ) ) then 
        return 
    end 
    if ( getElementData( player, "Role" ) == "Staff" ) then 
    else 
    if ( getElementData( player, "Role" ) == "Government" ) then 
    else 
    if ( getElementData( player, "Role" ) == "SWAT" ) then  
    else 
    if ( getElementData( player, "Role" ) == "Emergency" ) then 
    else 
    if ( getElementData( player, "Role" ) == "Police" ) then 
    else 
    if ( getElementData( player, "Role" ) == "Civilian" ) then 
    else 
    if ( getElementData( player, "Role" ) == "Criminal" ) then 
    else 
    if ( getElementData( player, "Role" ) == "Unemployed" ) then 
    else 
    if ( getElementData( player, "Role" ) == "Off-duty Workers" ) then 
        return 
        outputChatBox("First Go Criminal", localPlayer, 0, 255, 0) 
    end 
        destroyElement( bag ) 
        destroyElement( bl ) 
        randomMoney = math.random ( 1000, 20000 ) 
        randomArmor = math.random( 15, 30 ) 
        givePlayerMoney(player,randomMoney) 
        setPedArmor ( player, getPedArmor(player) + randomArmor ) 
        outputChatBox("You found $" .. tostring(randomMoney) .." and ".. tostring(randomArmor) .."% Armor", player, 0, 250, 0) 
        setTimer( createBag, 90000, 1 ) 
    end 
    end 
    end 
    end 
    end 
    end 
    end 
    end 
    end 
    end 
    end 
    end 
) 
  

DEBUG SCRIPT 3: MSG

ERROR:Loading script failed:med-mysterbag/client.lua:72:') expected(to close'('at line 27)near'end'

Link to comment

You have too many 'end' at the end, that's what trigger that. Use indentation next time so you can see how many ends you should have. See below example.

function sampleIndent() 
    if random1 == random2 then 
        -- Do stuff 
    end 
end 

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...