Fantanic Posted March 20, 2014 Share Posted March 20, 2014 Hello , Im trying to make a bribe system but im not sure wich functions i got to use I would like to have if you do /bribe then there comes a object (star ) and if u run into it You get a gui with wanted levels + price , Also i would like to have it so if u got 5 stars only 1 2 3 4 5 are showing up and not 1-6 for example. Link to comment
Dealman Posted March 20, 2014 Share Posted March 20, 2014 One of the most important aspects of scripting for MTA is to learn how to navigate the Wiki. Ask yourself what you want to do, take notes - think about what you'll need, write down keywords. This is a great way to learn how to navigate the wiki. For example; • Command • Pickup (Bribe) • GUI • Wanted With those 4 keywords, you'll find the most basic functions you need to get going. As for events, ask yourself things like this; 1. You want interaction whenever a pickup is picked up. 2. Go to Client Events, search for the keyword above - "Pickup". 3. You'll get a few results, one of them being onClientPickupHit. 4. Read about this event. "This event triggers whenever a pickup is hit clientside." 5. Perfect, exactly what you need! Now you'll have the bare minimum stuff, finding the appropriate functions for the actual logic behind the script won't be as easy. But you'll never learn unless you give it a thorough try. Learn how to navigate the Wiki, and understand the examples. Then you'll be able to make pretty much anything your heart may desire. Link to comment
Fantanic Posted March 20, 2014 Author Share Posted March 20, 2014 Ahye u didnt answered my question but no matter u dont have to answer again im waiting for someone else whos expierenced with this + since when we can just see on wiki 'if u got so much wanted levels u only see 1 2 3" Link to comment
Dealman Posted March 20, 2014 Share Posted March 20, 2014 I perfectly understood your question, but you don't seem willing to even learn how to navigate the Wiki - which has each and every function and event you'll need. So I don't even see any reason to help you with that attitude, have fun waiting for someone else to assist you. Link to comment
Fantanic Posted March 20, 2014 Author Share Posted March 20, 2014 U didnt understood it m8 look at the end i said 'since when we can just see on wiki 'if u got so much wanted levels u only see 1 2 3 " , is there one? i dont think so... P.S as i told u dont have to answer anymore Link to comment
Castillo Posted March 20, 2014 Share Posted March 20, 2014 addCommandHandler createObject createColTube To create the GUI you can use the "GUIeditor" resource. I didn't get the last part: "Also i would like to have it so if u got 5 stars only 1 2 3 4 5 are showing up and not 1-6 for example." Link to comment
Fantanic Posted March 20, 2014 Author Share Posted March 20, 2014 For example , player 1 got 1 star then he only sees in the gui "1 star" player 2 got 2 stars so he sees in the gui " 1 star" AND "2 star" Link to comment
Castillo Posted March 20, 2014 Share Posted March 20, 2014 Ah, I get it now, well, it depends on how you are planning on making this GUI. To get the wanted level use: getPlayerWantedLevel Link to comment
Fantanic Posted March 21, 2014 Author Share Posted March 21, 2014 So i got to create 6 guis and then. I let it check for wanted ? Or 1 gui? Link to comment
WhoAmI Posted March 21, 2014 Share Posted March 21, 2014 There are few ways to do it. You just need some mathematic stuff to set image's position depends on wanted level. Link to comment
Castillo Posted March 21, 2014 Share Posted March 21, 2014 You could create a single window and use radio buttons, then you can use a table to store them and do something like this: local radioButtons = { guiCreateRadioButton ( args... ), guiCreateRadioButton ( args... ), guiCreateRadioButton ( args... ), guiCreateRadioButton ( args... ), guiCreateRadioButton ( args... ), guiCreateRadioButton ( args... ) } function setRadioButtonsVisible ( ) for index = 1, 6 do guiSetVisible ( radioButtons [ index ], false ) end for index = 1, getPlayerWantedLevel ( ) do guiSetVisible ( radioButtons [ index ], true ) end end Link to comment
Chickelon12 Posted March 21, 2014 Share Posted March 21, 2014 for index = 1 what does this mean and when i have to change numbers in there ? i am planning on doing a similar thing but not the same subject, so i wanna learn how to make those things Link to comment
Castillo Posted March 21, 2014 Share Posted March 21, 2014 It means it'll loop from 1 until the number given after the comma. Link to comment
Fantanic Posted March 21, 2014 Author Share Posted March 21, 2014 Hm i will try to make it with only 1 gui for the begin ( 1-6 ) (trying to script it right now ) Link to comment
Fantanic Posted March 21, 2014 Author Share Posted March 21, 2014 function bribegui() GUIEditor.window[1] = guiCreateWindow(310, 165, 112, 153, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.radiobutton[1] = guiCreateRadioButton(9, 31, 93, 15, "1 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[2] = guiCreateRadioButton(10, 46, 92, 15, "2 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[3] = guiCreateRadioButton(10, 61, 92, 15, "3 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[4] = guiCreateRadioButton(9, 76, 93, 15, "4 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[5] = guiCreateRadioButton(10, 91, 92, 15, "5 star", false, GUIEditor.window[1]) guiRadioButtonSetSelected(GUIEditor.radiobutton[5], true) GUIEditor.radiobutton[6] = guiCreateRadioButton(10, 106, 92, 15, "6 star", false, GUIEditor.window[1]) end function offerbribe() local theObject = createObject ( (star object i need list where to find the star object ID), x + 2, y + 2, z, 0, 0, 0 ) local tempCol = createColTube ( fX + 2, fY + 2, fZ, 10.0, 10.0 ) end addCommandHandler("bribe",offerbribe) Like this? (i still need the object id list of pickups btw) Like this? Link to comment
Castillo Posted March 21, 2014 Share Posted March 21, 2014 You could try creating a pickup directly using the object ID, see if it's supported. Link to comment
Fantanic Posted March 21, 2014 Author Share Posted March 21, 2014 createObject( Object ID ) ? + how to get it so if u hit the object the gui will show up? Link to comment
Fantanic Posted March 22, 2014 Author Share Posted March 22, 2014 local bribePick = createPickUp(1247, x +2, y +2, z) addEventHandler("onPickUpHit",bribePick, bribegui) like this? Link to comment
Fantanic Posted March 22, 2014 Author Share Posted March 22, 2014 function bribegui() GUIEditor.window[1] = guiCreateWindow(310, 165, 112, 153, "Bribe", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.radiobutton[1] = guiCreateRadioButton(9, 31, 93, 15, "1 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[2] = guiCreateRadioButton(10, 46, 92, 15, "2 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[3] = guiCreateRadioButton(10, 61, 92, 15, "3 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[4] = guiCreateRadioButton(9, 76, 93, 15, "4 star", false, GUIEditor.window[1]) GUIEditor.radiobutton[5] = guiCreateRadioButton(10, 91, 92, 15, "5 star", false, GUIEditor.window[1]) guiRadioButtonSetSelected(GUIEditor.radiobutton[5], true) GUIEditor.radiobutton[6] = guiCreateRadioButton(10, 106, 92, 15, "6 star", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1],true) --- asfar im aware this is right end function offerbribe() local bribePick = createPickUp(1247, x +2, y +2, z) end addCommandHandler("bribe",offerbribe) addEventHandler("onPickUpHit",bribePick, bribegui) --- im not sure about this one here i know i miss some things but i dont know what Link to comment
Deepu Posted March 22, 2014 Share Posted March 22, 2014 Wrong ! you should make a function every time you do eventHandlers or even CommadHandlers.... For example. I want 20% extra health. So we do this: function forThePick () pickle = createPickUp(1247, x +2, y +2, z) end addCommandHandler("bribe", forThePick) function dipsit (hitElement) if hitElement == localPlayer then if source == pickle then takePlayerMoney(5000) local tatta = getElementHealth(localPlayer) setElementHealth(localPlayer, tonumber(tatta)+20) end end end addEventHandler("onPickUpHit", getRootElement(), dipsit) see? Make it that way. The script I gave now may contain some errors but they are minor and can be fixed self. Link to comment
Fantanic Posted March 22, 2014 Author Share Posted March 22, 2014 So if im right i got to split the function? Edit , but i cant split it here if im right or am i wrong? or function bribepickup() guiSetVisible(bribegui,true) addEventHandler("onPickupHit",offerbribe,bribepickup) excuse me if im wrong im trying to learn more of LUA Link to comment
Deepu Posted March 22, 2014 Share Posted March 22, 2014 yes. Good work you're exactly right. Link to comment
Fantanic Posted March 22, 2014 Author Share Posted March 22, 2014 Wait shouldnt this be ; function bribepickup() triggerEvent("bribegui") end addEventHandler("onPickupHit",offerbribe,bribepickup) ? 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