Jump to content

[HELP]Money Marker


ming23

Recommended Posts

Hey guys , this is my first script ( money marker ) , but don't work on my server , can someone help me?

Script :

function createMarker() 
local mar = createMarker(2252.941, -1699.663, 13.75506, "cylinder", 2, 0, 0, 0, 255) 
outputChatBox ( "The marker was spawning! Location : Los Santos , Ganton ( near LS Gym )", getRootElement(), 0, 0, 255, true ) 
end 
addEventHandler("onResourceStart",resourceRoot,createMarker) 
addEventHandler("onMarkerHit",root, 
function (player) 
        if ( source == mar ) then 
            if getElementType(player) == "player" 
                setElementData(player,"mar",false) 
                local x,y,z = getElementPosition(player) 
                local data = getElementData(mar,"num") 
                local data = tonumber(data) 
                destroyElement(mar) 
                givePlayerMoney(player,10000) 
            end 
        end 
end 

Meta :

    type="Script" name="Lucky Money" author="Ming" description="LUCKY MONEY D:" version="0" /> 
    

Thank you!

Link to comment
  
function createMarker() 
local mar = createMarker(2252.941, -1699.663, 13.75506, "cylinder", 2, 0, 0, 0, 255) 
outputChatBox ( "The marker was spawning! Location : Los Santos , Ganton ( near LS Gym )", getRootElement(), 0, 0, 255, true ) 
end 
addEventHandler("onResourceStart",resourceRoot,createMarker) 
addEventHandler("onMarkerHit",root, 
        function(source,hitElement) 
        if ( source == mar ) then 
        if getElementType(player) == "player" then 
                setElementData(player,"mar",false) 
                local x,y,z = getElementPosition(player) 
                destroyElement(mar) 
                givePlayerMoney(player,10000) 
            end 
        end 
        end) 
  

Link to comment
  
addEventHandler("onResourceStart",resourceRoot,function() 
    local marker = createMarker(2252.941,-1699.663,13.75506,"cylinder",2,0,0,0,255) 
    outputChatBox ("The marker was spawning! Location : Los Santos , Ganton ( near LS Gym )",root,0,0,255,true ) 
    addEventHandler("onMarkerHit",marker,function(element,dimension) 
        if getElementType(element) == "player" then 
            destroyElement(source) 
            givePlayerMoney(element,10000) 
        end 
    end) 
end) 
  

Link to comment
  • Moderators
Oh realy? I tested it and it worked.

It will not work at all, because the name of the function is already a MTA function (which will cause a stack overflow) and "mar" is defined locally. Also, there are other errors in the event "onMarkerHit".

Edited by Guest
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...