How to do that - when you click the Button Groove join the team?
Sorry For my bad english
client :
GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Label = {}
function stgui_close()
showCursor(false)
guiSetVisible( GUIEditor_Window[1], false )
outputChatBox ( "Team Selected!", 255, 255, 36, true)
end
function stgui_show(key, keyState)
outputChatBox ( "Select Team", 255, 255, 36, true)
showCursor(true)
guiSetVisible( GUIEditor_Window[1], true )
end
function StartMode(startedResource)
if getThisResource() == startedResource then
showCursor(true)
GUIEditor_Window[1] = guiCreateWindow(124,233,781,360,"Team Deathmatch 0.1",false)
guiWindowSetSizable(GUIEditor_Window[1],false)
GUIEditor_Label[1] = guiCreateLabel(0.2151,0.1389,0.5826,0.1778,"Team Deathmatch 0.1",true,GUIEditor_Window[1])
guiLabelSetColor(GUIEditor_Label[1],255-255-34)
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top")
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false)
guiSetFont(GUIEditor_Label[1],"sa-gothic")
GUIEditor_Label[2] = guiCreateLabel(0.3841,0.3417,0.2535,0.1306,"Select Team",true,GUIEditor_Window[1])
guiLabelSetColor(GUIEditor_Label[2],255-255-255)
guiLabelSetVerticalAlign(GUIEditor_Label[2],"top")
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false)
guiSetFont(GUIEditor_Label[2],"sa-header")
grove = guiCreateButton(0.274,0.5306,0.4443,0.0917,"Grove",true,GUIEditor_Window[1])
ballas = guiCreateButton(0.274,0.6806,0.4443,0.0917,"Ballas",true,GUIEditor_Window[1])
vagos = guiCreateButton(0.274,0.8333,0.4443,0.0917,"Vagos",true,GUIEditor_Window[1])
guiSetVisible( GUIEditor_Window[1], true )
addEventHandler ( "onClientGUIClick", grove, teamgrove, false )
addEventHandler ( "onClientGUIClick", ballas, teamballas, false )
addEventHandler ( "onClientGUIClick", vagos, teamvagos, false )
bindKey ( "m", "down", stgui_show )
end
end
addEventHandler("onClientResourceStart", getRootElement(), StartMode)
function teamgrove(startedResource)
if getThisResource() == startedResource then
triggerServerEvent("teamgrove", getRootElement(), p)
end
end
addEventHandler("onClientResourceStart", getRootElement(), teamgrove)
server:
function createTeamsOnStart ()
teamgrove = createTeam ( "Grove", 0,255,0 )
teamballas = createTeam ( "Ballas", 0,255,0 )
teamvagos = createTeam ( "Vagos", 0,255,0 )
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart )
function joingrove ( source )
setPlayerTeam ( source, teamgrove )
triggerClientEvent("teamgrove", getRootElement(),source)
end
addEvent("teamgrove", true)
addEventHandler("teamgrove", getRootElement(), joingrove)