justn Posted April 15, 2014 Share Posted April 15, 2014 Hi, i have problem with a code, when the player clicks the get job button, nothing happens ( dont get errors in debugscript ) Client: addEventHandler("onClientGUIClick",CriminalWindow, function(b) if b == "left" then if source == CriminalGetJob then if ( getElementData ( localPlayer, "Occupation" ) == "Unemployed" ) then local CrimBox = guiComboBoxGetSelected(CriminalComboBox) local CrimType = guiComboBoxGetItemText(CriminalComboBox, CrimBox) if ( CrimType ) ~= "Please select your criminal type .." then triggerServerEvent("gotCrimJob",getLocalPlayer(),CrimType) guiSetVisible(CriminalGetJob,false) guiSetVisible(CriminalWindow,false) showCursor(false) guiSetText(RCrimLabel, #guiGetText(RCrimLabel) .."Criminal Type: "..CrimType) exports["TopBarChat"]:sendClientMessage("You are now a criminal !",255, 0, 0, true) CriminalQuitJob = guiCreateButton(10, 286, 122, 34, "Quit Job", false, CriminalWindow) elseif ( getElementData ( localPlayer, "Occupation" ) ~= "Unemployed" ) then guiSetVisible(CriminalWindow,false) guiSetVisible(JobM_Window,true) showCursor(true) elseif ( CrimType ) == "Please select your criminal type .." then exports["TopBarChat"]:sendClientMessage("You haven't selected a criminal type !",255, 0, 0, true) end end end end end) Server; function gotTheJob (CrimType) local CriminalTeam = getTeamFromName ( "Criminal" ) if ( CriminalTeam ) then setElementModel ( source, 0 ) setPlayerTeam ( source, CriminalTeam ) setElementData ( source, "Occupation", CrimType ) end end addEvent("gotCrimJob",true) addEventHandler ( "gotCrimJob", getRootElement(), gotTheJob ) Link to comment
Saml1er Posted April 15, 2014 Share Posted April 15, 2014 Remove this line: if source == CriminalGetJob then source is already defined and use outputDebugScript after every line so you can know where the problem is. Link to comment
justn Posted April 15, 2014 Author Share Posted April 15, 2014 Lol, that's not the problem, i use that line in all my guis, but anyways, i have fixed. Thanks though ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now