Hello guys , today i i tried to make a gui that has 2 buttons
1 button to get 200 health costs 3k , and other to close the GUI, activating this will be through "onMarkerHit"
furthermore , you can tell me what is the wrong with this and fix it
Client side :
GUIEditor = {
button = {},
window = {},
label = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
GUIEditor.window[1] = guiCreateWindow(537, 244, 298, 234, "buy Health", false)
guiWindowSetSizable(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(9, 154, 129, 70, "Buy Health\n($3.000)", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[2] = guiCreateButton(159, 154, 129, 70, "Close", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
GUIEditor.label[1] = guiCreateLabel(16, 25, 262, 115, "You can buy 200 health from here.\n\n200 HP costs $3.000", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[1], "default-bold-small")
guiLabelSetColor(GUIEditor.label[1], 41, 255, 0)
end
)
addEventHandler ( "onClientGUIClick",root,
function ()
HealthBuy = guiCreateButton(9, 154, 129, 70, "Buy Health\n($3.000)", false, GUIEditor.window[1])
ttriggerServerEvent ( "onHealth", localPlayer )
function OpenWin()
healmarker = createMarker ( 2024.6821289063, -1411.6774902344, 16.9921875,)
if guiGetVisible ( GUIEditor.window[1] ) then
guiSetVisible ( GUIEditor.window[1], false )
showCursor(false)
else
guiSetVisible ( GUIEditor.window[1], true )
showCursor(true)
end
end
BindKey ("F2", "down", OpenWin)
server side :
addEvent ("onHealth", true)
addEventHandler ("onHealth", getRootElement(),
function()
local = getPlayerAccount ( source )
setPedStat(source, 24, 1000)
setElementHealth ( source, 200 )
end
some reason stopping it from working , and hope you guys help me out on this.
Thank you for reading this