ming23 Posted March 16, 2014 Share Posted March 16, 2014 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
Anubhav Posted March 16, 2014 Share Posted March 16, 2014 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
cheez3d Posted March 16, 2014 Share Posted March 16, 2014 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
Anubhav Posted March 16, 2014 Share Posted March 16, 2014 He told me thank you at SKYPE. He is my old friend too late to answer. Link to comment
ming23 Posted March 16, 2014 Author Share Posted March 16, 2014 He told me thank you at SKYPE. He is my old friend too late to answer. the script don't work , go try in ur local server first Link to comment
Anubhav Posted March 16, 2014 Share Posted March 16, 2014 Oh realy? I tested it and it worked. Link to comment
ming23 Posted March 16, 2014 Author Share Posted March 16, 2014 Oh realy? I tested it and it worked. ERROR : luckymoney/luckmoney.lua:2: stack overflow Link to comment
DNL291 Posted March 16, 2014 Share Posted March 16, 2014 (edited) 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 March 16, 2014 by Guest Link to comment
ming23 Posted March 16, 2014 Author Share Posted March 16, 2014 Try my version . work 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