sankalp21 Posted June 26, 2016 Posted June 26, 2016 I have no programmming sense for mta but i want to make a RPG server ... i used a resource named guieditor(link-https://forum.multitheftauto.com/viewtopic.php?f=108&t=22831 ) for making gui and i made a simple gui to test it but i am having trouble please help (i made this gui code with that guieditor... is this code correct please verify) GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(242, 203, 297, 185, "Intro", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(47, 23, 205, 19, "Welcome to SKI-Skyline (RPG server)", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(88, 70, 103, 40, "Play", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "Tooltip", "start game") end ) i want to show this gui when i hit a marker please help ....
aka Blue Posted June 26, 2016 Posted June 26, 2016 (edited) Change the eventHandler to onMarkerHit (server-side) Edited June 26, 2016 by Guest
Bean666 Posted June 26, 2016 Posted June 26, 2016 (edited) this would do. if you would want the marker not accessable from air tho. Visit this: https://wiki.multitheftauto.com/wiki/Sc ... troduction Client: GUIEditor = { button = {}, window = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(242, 203, 297, 185, "Intro", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(47, 23, 205, 19, "Welcome to SKI-Skyline (RPG server)", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(88, 70, 103, 40, "Play", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "Tooltip", "start game") addEvent("GUI", true) function guishow(player) guiSetVisible(GUIEditor.window[1], true) showCursor(true) end addEventHandler("GUI",getRootElement(),guishow) Server: local marker = createMarker(x, y, z, "cylinder", 1.5, 200, 150, 50, 150) function gui( hitElement ) if isPedInVehicle(hitElement) then return; end if getElementType( hitElement ) == "player" then triggerClientEvent(hitElement, "GUI", hitElement) end end addEventHandler("onMarkerHit", root, gui) Edited June 26, 2016 by Guest
sankalp21 Posted June 26, 2016 Author Posted June 26, 2016 Change the eventHandler to onMarkerHit only changing it to marker hit will work ??? but what if i have many markers ??
sankalp21 Posted June 26, 2016 Author Posted June 26, 2016 this would do. if you would want the marker not accessable from air tho.Client: GUIEditor = { button = {}, window = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(242, 203, 297, 185, "Intro", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(47, 23, 205, 19, "Welcome to SKI-Skyline (RPG server)", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(88, 70, 103, 40, "Play", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "Tooltip", "start game") addEvent("GUI", true) function guishow(player) guiSetVisible(GUIEditor.window[1], true) showCursor(true) end addEventHandler("GUI",getRootElement(),guishow) Server: local marker = createMarker(x, y, z, "cylinder", 1.5, 200, 150, 50, 150) function gui( hitElement ) if isPedInVehicle(hitElement) then return; end if getElementType( hitElement ) == "player" then triggerClientEvent(hitElement, "GUI", hitElement) end end addEventHandler("onMarkerHit", root, gui) what is client and what is server ??? will u please tell the whole process what to do ?
Bean666 Posted June 26, 2016 Posted June 26, 2016 Make a file called client.lua and server.lua, and if you already have a meta.xml file then copy and paste this: <meta> <info name="None" author="Random" description="None" version="1.0" type="script"></info> <script src="client.lua" type="client"></script> <script src="server.lua" type="server"></script> </meta>
sankalp21 Posted June 26, 2016 Author Posted June 26, 2016 Make a file called client.lua and server.lua, and if you already have a meta.xml filethen copy and paste this: <meta> <info name="None" author="Random" description="None" version="1.0" type="script"></info> <script src="client.lua" type="client"></script> <script src="server.lua" type="server"></script> </meta> IT actually helped me a lot ... it worked ..... 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