The gui doesn't appear when I use it like that:
Client-side
local marker = createMarker( 1282, -1664.5999755859, 12.5, "Cylinder", 2, 255, 255, 255, 255, 100, getRootElement())
function swatjob(hitElement)
GUIEditor_Button = {}
GUIEditor_Memo = {}
GUIEditor_Label = {}
if getElementType( hitElement ) == "player" and hitElement == getLocalPlayer() then
if ( guiGetVisible (windowjob) == true ) then
guiSetVisible (windowjob, false )
else
guiSetVisible (windowjob, false )
windowjob = guiCreateWindow(1031,232,301,397,"SWAT job",false)
GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob)
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob)
GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob)
addEventHandler("onClientGUIClick", GUIEditor_Button[2], closeWindow, false)
GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"To take SWAT team job, press Take job.\n\nIf you don't want to, press Cancel.\n\n\nNOTE: You need to be into SWAT team group.",false,windowjob)
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeswatWindow, false)
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false)
showCursor(true)
end
end
end
function joinTeam()
triggerServerEvent("setSWAT",localPlayer)
end
function removeswatWindow()
guiSetVisible(windowjob, false)
showCursor(false)
end
Server-Side
function createSWATTeam ()
SWATTeam = createTeam ("SWAT Team", 0, 0, 255)
end
addEventHandler ("onResourceStart", resourceRoot, createSWATTeam)
function joinSWAT()
setPlayerTeam(source,SWATTeam)
setElementModel(source,285)
end
addEvent("setSWAT", true)
addEventHandler("setSWAT",root,joinSWAT)
and it's appear when I use it like that:
local marker = createMarker( 1282, -1664.5999755859, 12.5, "Cylinder", 2, 255, 255, 255, 255, 100, getRootElement())
function swatjob(hitElement)
GUIEditor_Button = {}
GUIEditor_Memo = {}
GUIEditor_Label = {}
if getElementType( hitElement ) == "player" and hitElement == getLocalPlayer() then
if ( guiGetVisible (windowjob) == true ) then
guiSetVisible (windowjob, false )
else
guiSetVisible (windowjob, false )
windowjob = guiCreateWindow(1031,232,301,397,"SWAT job",false)
GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob)
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob)
GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob)
addEventHandler("onClientGUIClick", GUIEditor_Button[2], closeWindow, false)
GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"To take SWAT team job, press Take job.\n\nIf you don't want to, press Cancel.\n\n\nNOTE: You need to be into SWAT team group.",false,windowjob)
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeswatWindow, false)
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false)
showCursor(true)
end
end
end
function joinTeam (source)
local SWATTeam = getTeamFromName ("SWAT Team")
if (SWATTeam) then
outputChatBox ( "You are now SWAT.",source, 0, 255, 0 )
setPlayerTeam (source, SWATTeam)
end
end
addEventHandler("onClientMarkerHit", marker, swatjob)
function removeswatWindow()
guiSetVisible(windowjob, false)
showCursor(false)
end
but the Take job button doesn't work