Jump to content

onClientGUIClick Help


justn

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...