Client Side:
JobGUI = guiCreateWindow(249,240,307,176,"Job GUI",false)
guiWindowSetSizable(JobGUI,false)
guiWindowSetMovable(JobGUI,false)
guiSetAlpha(JobGUI,0.89999997615814)
guiSetVisible(JobGUI, false)
EndStartJ = guiCreateButton(26,37,254,58,"End/start shift",false,JobGUI)
QuitJ = guiCreateButton(26,98,254,58,"Quit job",false,JobGUI)
function ShowGUI ( )
guiSetVisible ( JobGUI, not guiGetVisible ( JobGUI ) )
showCursor ( not isCursorShowing( ) )
end
bindKey("F2","down", ShowGUI)
function shift()
local localPlayer = getLocalPlayer()
triggerServerEvent("jobShift", localPlayer)
end
addEventHandler("onClientGUIClick", EndStartJ, shift)
function hideGUI()
guiSetVisible(JobGUI, false)
showCursor(false)
end
addEvent("hide", true)
addEventHandler("hide", localPlayer, hideGUI)
Server Side:
emp = createTeam("Unemployed team", 127, 127, 127)
occ = createTeam("Unoccupied team", 173, 255, 0)
function jobShift()
local team = getPlayerTeam(source)
if (team and getTeamName(team) == "Staff") or (team and getTeamName(team) == "Armed Forces") or (team and getTeamName(team) == "SWAT Team") or (team and getTeamName(team) == "Government") or (team and getTeamName(team) == "Civilian Workers") or (team and getTeamName(team) == "Medic") or (team and getTeamName(team) == "Police") or (team and getTeamName(team) == "Criminal") then
teamO = getPlayerTeam(source)
pSkin = getElementModel(source)
setPlayerTeam(source, emp)
setElementModel(source, 0)
triggerClientEvent("hide", getRootElement())
end
elseif (team and getTeamName(team) == emp) then
setElementModel(source, pSkin)
triggerClientEvent("hide", getRootElement())
end
end
addEvent("jobShift", true)
addEventHandler("jobShift", getRootElement(), jobShift)
What it should do:
make players able to set their team to "Unemployed" and back to their old team.... That's all for now. But the problem is when i end shift, i can't come back to my old team.... Can somebody help me please?