Jump to content

I have a code but how will i use it ...


Recommended Posts

:!: 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 ....

Link to comment

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 by Guest
Link to comment
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 ?

Link to comment

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> 
  

Link to comment
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> 
  

IT actually helped me a lot ... it worked .....

THANKS :D:D:D:):):lol::lol:

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...