Deepu Posted February 7, 2014 Author Posted February 7, 2014 yeah but I tested it and it doesnt work when I hit the wanted marker it doesnt change to seeds : 50 why? WANT SCRIPTS? I SELL LIKE AN ANIMATED CUSTOMISED GUI FOR 5USD AND AN RPG GAMEMODE FOR 30USD ONLY. IF YOU NEED SPECIAL SCRIPTS THEN I SELL EACH FOR 5 USD.
Deepu Posted February 7, 2014 Author Posted February 7, 2014 the script I used to test yours is like this thePlayer = getLocalPlayer () local x,y,z = getElementPosition(thePlayer) local aa = createMarker(x + 5,y,z - 1, "cylinder", 2, 255, 2, 0, 255) function mainFunction (hitElement) function ZeroSeeds() dxDrawText("Seeds : 0", 697, 580, 842, 652, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 0", 697, 578, 842, 650, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 0", 695, 580, 840, 652, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 0", 695, 578, 840, 650, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 0", 696, 579, 841, 651, tocolor(248, 245, 14, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) end function MoreSeeds() dxDrawText("Seeds : 50", 697, 580, 842, 652, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 50", 697, 578, 842, 650, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 50", 695, 580, 840, 652, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 50", 695, 578, 840, 650, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) dxDrawText("Seeds : 50", 696, 579, 841, 651, tocolor(248, 245, 14, 255), 1.00, "default-bold", "left", "top", true, true, true, true, false) end function open() opened = not opened if opened == true then addEventHandler("onClientRender", getRootElement(), ZeroSeeds) else removeEventHandler("onClientRender", getRootElement(), ZeroSeeds) addEventHandler("onClientRender", getRootElement(), MoreSeeds) end end end addEventHandler("onClientMarkerHit", aa, mainFunction) mhmm.... no errors but doesnt work WANT SCRIPTS? I SELL LIKE AN ANIMATED CUSTOMISED GUI FOR 5USD AND AN RPG GAMEMODE FOR 30USD ONLY. IF YOU NEED SPECIAL SCRIPTS THEN I SELL EACH FOR 5 USD.
myonlake Posted February 7, 2014 Posted February 7, 2014 (edited) Fine, since neither of you can script anything. Client-side function drawSeeds( ) dxDrawText( "Seeds: " .. getElementData( localPlayer, "job:seeds" ), 0, 0, 100, 60, tocolor( 255, 255, 255, 255 ), 1.0, "default-bold", "left", "top", true, false, true, false, false ) end addEventHandler( "onClientResourceStart", resourceRoot, function( ) addEventHandler( "onClientRender", root, drawSeeds ) end ) Server-side local seedMarker = createMarker( 0, 0, 3, "cylinder", 1.5, 220, 160, 20, 180 ) local maxSeedAmount = 50 function getSeedAmount( player ) if ( not player ) or ( not getElementType( player ) ~= "player" ) then return end return ( getElementData( player, "job:seeds" ) and tonumber( getElementData( player, "job:seeds" ) ) or 0 ) end function setSeedAmount( player, amount ) local amount = tonumber( amount ) if ( not player ) or ( not getElementType( player ) ~= "player" ) or ( not amount ) or ( amount and amount < 0 ) then return end setElementData( player, "job:seeds", math.min( maxSeedAmount, amount ), true ) return true end addEventHandler( "onMarkerHit", seedMarker, function( hitElement, matchingDimension ) if ( getElementType( hitElement ) ~= "player" ) or ( not matchingDimension ) then return end setSeedAmount( hitElement, getSeedAmount( hitElement ) + 1 ) outputChatBox( "You picked up one seed.", hitElement, 20, 245, 20, false ) end ) Edited February 7, 2014 by Guest If I helped you, please click the like button on the right Thanks!
Deepu Posted February 7, 2014 Author Posted February 7, 2014 when does this work? and where shall I place these datas? WANT SCRIPTS? I SELL LIKE AN ANIMATED CUSTOMISED GUI FOR 5USD AND AN RPG GAMEMODE FOR 30USD ONLY. IF YOU NEED SPECIAL SCRIPTS THEN I SELL EACH FOR 5 USD.
myonlake Posted February 7, 2014 Posted February 7, 2014 Feel free to learn scripting by reading the following sources. https://wiki.multitheftauto.com/wiki/Server_Manual https://wiki.multitheftauto.com/wiki/Resources https://wiki.multitheftauto.com/wiki/Sc ... troduction viewtopic.php?f=148&t=40809 If you can't get it to work, I would give up hope if I was you, sorry. Scripting isn't for everybody and it seems it's hard for you to understand what a variable is and how you can use it even though I have given you three links to the variable manual that is very easy to catch and learn. Same goes to element data, which I am using in the code I posted above. Again, if you don't understand the way it works, I'd stop and read the manuals above. Please stop asking and make them yourself. If I helped you, please click the like button on the right Thanks!
Deepu Posted February 7, 2014 Author Posted February 7, 2014 ok thanks socailZ I wanted this now I can learn this getElementData thanks very much :) I appreciate your kindness WANT SCRIPTS? I SELL LIKE AN ANIMATED CUSTOMISED GUI FOR 5USD AND AN RPG GAMEMODE FOR 30USD ONLY. IF YOU NEED SPECIAL SCRIPTS THEN I SELL EACH FOR 5 USD.
myonlake Posted February 7, 2014 Posted February 7, 2014 You're welcome if you even opened the links I gave you. Good luck... If I helped you, please click the like button on the right Thanks!
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