Hi there, that's my first post on the forum but i'm not new here.
I'm having a problem with a starting GUI that let you choose joining a faction between Groove and police. The GUI is visible but the join buttons does nothing. Here's the client-side script:
function creafinestra()
showCursor(true)
GUIEditor_Button = {}
skinwdw = guiCreateWindow(327,162,370,210,"CHOOSE A FACTION TO JOIN",false)
guiWindowSetMovable(skinwdw,false)
guiWindowSetSizable(skinwdw,false)
copskin2 = guiCreateStaticImage(0.0243,0.0952,0.2568,0.8619,"images/copskin.png",true,skinwdw)
robskin2 = guiCreateStaticImage(0.7108,0.1143,0.2649,0.8429,"images/robskin.png",true,skinwdw)
copskin = guiCreateButton(0.2811,0.381,0.2054,0.2333,"POLICE",true,skinwdw)
robskin = guiCreateButton(0.5054,0.381,0.2027,0.2333,"ROBBER",true,skinwdw)
end
addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource( ) ), creafinestra)
function spawnacops(button)
if button == "left" then
triggerServerEvent("Cops", player)
guiSetInputEnabled(false)
guiSetVisible(skinwdw, false)
showCursor(false)
end
end
addEventHandler("onClientGUIClick", copskin, spawnacops)
function spawnarobs(button)
if button == "left" then
triggerServerEvent("Robs", player)
guiSetInputEnabled(false)
guiSetVisible(skinwdw, false)
showCursor(false)
end
end
addEventHandler("onClientGUIClick", robskin, spawnarobs)
and that's the server-side script:
addEvent( "Cops", true )
function entercops ( player, command, teamName )
local myTeam = getPlayerTeam ( player )
if ( myTeam ) then
outputChatBox ( "You are already member of a team!", player )
else
setPlayerTeam ( player, teamCops )
outputChatBox ( "You are now a Cops member!", player )
killPed( player )
end
end
addEventHandler ( "Cops", getRootElement(), entercops )
addCommandHandler ( "joincops", entercops, createTeamsOnStart )
addEvent( "Robs", true )
function enterrobs ( player, command, teamName )
local myTeam = getPlayerTeam ( player )
if ( myTeam ) then
outputChatBox ( "You are already member of a team!", player )
else
setPlayerTeam ( player, teamRobbers )
outputChatBox ( "You are now a Robs member!", player )
killPed( player )
end
end
addEventHandler ( "Robs", getRootElement(), enterrobs )
addCommandHandler ( "joinrobs", enterrobs, createTeamsOnStart )
Thanks for help!