Deepu Posted February 5, 2014 Share Posted February 5, 2014 How do you this thing? I made the rest of my farmer job I need the one like this : in the right corner down there is "Seeds: 0" and when I click the 50 seeds button then it changes to "seeds: 50" how do I do that? and also when I Plant some seeds, there comes a counter ====> " 1/50" "2/50" and at last when its "50/50" it says "you're out of seeds" How do I do that thing? Also please teach me here is the pics http://imgur.com/stMUCPG http://imgur.com/7GAhHC9 http://imgur.com/4bYNyAD http://imgur.com/e9CyC9V http://imgur.com/FL8XV2w and thanks in advance and its so urgent I want the answer by tommorrow thanks again and please ITS VERY URGENT SORRY FOR THE DIFFICULTIES YOU FACED IN HELPING ME Link to comment
myonlake Posted February 6, 2014 Share Posted February 6, 2014 You can use dxDrawText to draw 2D text on the screen. Render it with onClientRender event client-side and you can use a variable or player's element data to output the current amount of seeds. When they click the button on the GUI, it will increase the amount of seeds by changing the value of the variable or player's element data. When they hit the max, it will disable the button. That marker is a custom marker created with dxDrawLine3D. I wouldn't suggest spending time on making that, because I think it's difficult for you to understand the mathematical algorithms behind it. Feel free to try if you want to, I can assure you the algorithm is interesting to implement in MTA and see it work. I made a simple 2D outline circle system myself, it was fun to make despite all the problems I faced when trying to find out the best way to do it. Link to comment
Deepu Posted February 6, 2014 Author Share Posted February 6, 2014 but how do I make the current seeds and all? how do I update the DxDrawText? please write the codes? with xyz screen size and all that thanks Link to comment
myonlake Posted February 6, 2014 Share Posted February 6, 2014 We don't make scripts for you. You must do them yourself, find a scripter to do it for you for some price, or find it from the community. You should read the links included in my post. Rendering automatically "updates" the data you do, because it renders it again each frame. This way you won't have to worry about updating the dxDrawText. Also, about the seeds, like I said, you can use variables or element data to save the seed amount. You can use guiGetScreenSize to get the screen width and height and calculate the position of the text relative to the scale. Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 man, you think I don't know scripting? nopee. I have made 50 scripts and sold them for free i never done this seeds data update thing before so I asked cuz I already made farmer job Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 man look Leave the seeds, how can I update some thing on the gui like drugs ? Link to comment
xXMADEXx Posted February 7, 2014 Share Posted February 7, 2014 man, you think I don't know scripting? nopee. I have made 50 scripts and sold them for free i never done this seeds data update thing before so I asked cuz I already made farmer job He wasn't saying you didn't know scripts, he was just saying he doesn't write scripts for free. The dxDrawText will update every-render, example: addEventHandler ( "onClientRender", root, function ( ) dxDrawText ( tostring ( getElementData ( localPlayer, "Job" ) ), 0, 0, 0, 0 ) end ) In the code, for example, any time the "Job" data would change for localPlayer, it would automatically update the text. Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 I will show you the script alright Made? addEventHandler("onClientRender", root, function() 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 theTractor () triggerServerEvent("onChoot", thePlayer) end addEventHandler("onClientMarkerHit", markerB, theTractor) function A (hitElement) if hitElement == thePlayer then if isPedInVehicle(thePlayer) then if isElementWithinMarker(hitElement, markerA) then aa = createMarker(x + 5,y,z - 1, "cylinder", 2, 255, 2, 0, 255) addEventHandler("onClientRender", root, function() dxDrawText("1/50", 699, 394, 852, 514, tocolor(224, 238, 16, 255), 2.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("TAKE A COMBINE HARVESTER WHEN READY ", 533, 448, 635, 477, tocolor(182, 130, 5, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Seeds : 49", 673, 482, 881, 546, tocolor(195, 226, 20, 255), 1.50, "default-bold", "left", "top", false, false, true, false, false) end ) end end end end you can edit that now/? Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 I will show you the script alright Made? addEventHandler("onClientRender", root, function() 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 theTractor () triggerServerEvent("onChoot", thePlayer) end addEventHandler("onClientMarkerHit", markerB, theTractor) function A (hitElement) if hitElement == thePlayer then if isPedInVehicle(thePlayer) then if isElementWithinMarker(hitElement, markerA) then aa = createMarker(x + 5,y,z - 1, "cylinder", 2, 255, 2, 0, 255) addEventHandler("onClientRender", root, function() dxDrawText("1/50", 699, 394, 852, 514, tocolor(224, 238, 16, 255), 2.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("TAKE A COMBINE HARVESTER WHEN READY ", 533, 448, 635, 477, tocolor(182, 130, 5, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Seeds : 49", 673, 482, 881, 546, tocolor(195, 226, 20, 255), 1.50, "default-bold", "left", "top", false, false, true, false, false) end ) end end end end you can edit that now/? Link to comment
myonlake Posted February 7, 2014 Share Posted February 7, 2014 If you can make that much code, I am sure you can make a variable or element data as well. Try to do it and if it doesn't work, let us know. Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 look at this ..... addEventHandler("onClientRender", root, function() 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 theTractor () triggerServerEvent("onChoot", thePlayer) end addEventHandler("onClientMarkerHit", markerB, theTractor) function A (hitElement) if hitElement == thePlayer then if isPedInVehicle(thePlayer) then if isElementWithinMarker(hitElement, markerA) then aa = createMarker(x + 5,y,z - 1, "cylinder", 2, 255, 2, 0, 255) addEventHandler("onClientRender", root, function() dxDrawText("1/50", 699, 394, 852, 514, tocolor(224, 238, 16, 255), 2.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("TAKE A COMBINE HARVESTER WHEN READY ", 533, 448, 635, 477, tocolor(182, 130, 5, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Seeds : 49", 673, 482, 881, 546, tocolor(195, 226, 20, 255), 1.50, "default-bold", "left", "top", false, false, true, false, false) dxDrawText ( tostring ( getElementData ( localPlayer, "Job" ) ), 0, 0, 0, 0 ) end ) end end end end addEventHandler("onClientMarkerHit", markerA, A) it doesnt work what I want is that I wanna replace the Seeds: 0 thing in the first function it doesnt replace seeds with the new one Link to comment
myonlake Posted February 7, 2014 Share Posted February 7, 2014 Because you aren't using a variable nor element data. Like I said, use either of them. Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 can't u give an example? not just the seeds just give an example of guns or something Can't You !?! Link to comment
Karuzo Posted February 7, 2014 Share Posted February 7, 2014 Why should he ? I mean if you have sold 50 scripts for "free" , you could do that easily. He said what you have to do, just use a variable or a element-data . I mean he spents such time to link everything for you. You just have to click on the links, and voila, you have an example Link to comment
xeon17 Posted February 7, 2014 Share Posted February 7, 2014 What wrong with you guys , if you can to help him why you no did it ? what cost you to give this guy fucking 5 lines of a script ? what you lossing ? Link to comment
xeon17 Posted February 7, 2014 Share Posted February 7, 2014 Why should he ? I mean if you have sold 50 scripts for "free" , you could do that easily.He said what you have to do, just use a variable or a element-data . I mean he spents such time to link everything for you. You just have to click on the links, and voila, you have an example Why you post if you no want to help this guy ? to get +1 post ? omg.. Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 addEventHandler("onClientRender", root, function() 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 ) ok? now this is the edit I am thinking off but doesnt work Told ya I am new to getElementData () I know those getPlayerCount and all look local pup = getElementData(thePlayer, "jobs") then I did addEventHandler ( "onClientRender", root, function ( ) dxDrawText ( tostring ( getElementData ( thePlayer, "Job" ) ), 0, 0, 0, 0 ) end ) it doesnt work -.- Told you -.- I dunno abt getElementData without you showing an ex: I have read wiki Link to comment
Karuzo Posted February 7, 2014 Share Posted February 7, 2014 No, im just sayin. He wants examples? myonlake linked every function so he has an example. Btw, you say im tryin' to get +1 post more ? You double posted. Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 KRZO you know abt this? frankly speaking Do you? if you know please help by giving examples or editing mine cuz This is not the script that I am going to use or sell or give or do somthng its for me to make another script like this but not this a totally differnet one got it friendly helpers? Link to comment
xeon17 Posted February 7, 2014 Share Posted February 7, 2014 KRZO said: No, im just sayin. He wants examples? myonlake linked every function so he has an example. Btw, you say im tryin' to get +1 post more ? You double posted. hahaha Funny. If this guy not understand the wiki extample , then give him your extample , tell him something about it . If you know something about it KOZO , i'm 100% sure you not. Link to comment
Karuzo Posted February 7, 2014 Share Posted February 7, 2014 EufraT im just not going to answer you. B2T: Deepu, which event changes the dxDrawText ? And where do you set your Element-Data "jobs" ? Link to comment
Deepu Posted February 7, 2014 Author Share Posted February 7, 2014 KRZO the thing that changes it is onClientRender() and the place is on marker B hit you know it? Link to comment
Karuzo Posted February 7, 2014 Share Posted February 7, 2014 What do you mean with onClientRender() changes it ? Let me give you an example how you could change the dxDrawing : 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 addEventHandler("onClientMarkerHit", marker, open) Just an example. 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