Jump to content

Help gui


K4stic

Recommended Posts

addEventHandler("onClientGUIClick", root, 
function () 
     if (source == takebtn) then 
        if not( getPlayerTeam ( localPlayer, getTeamFromName("Unemployed") ) ) then 
        outputChatBox("You must Quit From your Job first",255,0,0) 
            return 
        end 
          local row,col = guiGridListGetSelectedItem(skinsgrid) 
          if (row and col and row ~= -1 and col ~= -1) then 
               local skinName = guiGridListGetItemText(skinsgrid, row, 1) 
               if skinName == "Medic 1 (skin: 274)" then 
                    triggerServerEvent("setMedic",localPlayer,274) 
               elseif skinName == "Medic 2 (skin: 275)" then 
                    triggerServerEvent("setMedic",localPlayer,275) 
               elseif skinName == "Medic 3 (skin: 276)" then 
                    triggerServerEvent("setMedic",localPlayer,276) 
               end 
                guiSetVisible(windowjob, false) 
                showCursor(false) 
          else 
            outputChatBox("Please,select a skin of the list.",255,0,0) 
            end 
       elseif (source == closebtn) then 
        guiSetVisible(windowjob, false) 
        showCursor(false) 
     end 
  end 
) 

No errors just nothing

How i can make it then player click on takebtn and player not Unemployed to output him/her Message

Link to comment
addEventHandler("onClientGUIClick", root, 
function () 
     if (source == takebtn) then 
        if (not getTeamName(getPlayerTeam(localPlayer)) == "Unemployed") then 
        outputChatBox("You must Quit From your Job first",255,0,0) 
            return 
        end 
          local row,col = guiGridListGetSelectedItem(skinsgrid) 
          if (row and col and row ~= -1 and col ~= -1) then 
               local skinName = guiGridListGetItemText(skinsgrid, row, 1) 
               if skinName == "Medic 1 (skin: 274)" then 
                    triggerServerEvent("setMedic",localPlayer,274) 
               elseif skinName == "Medic 2 (skin: 275)" then 
                    triggerServerEvent("setMedic",localPlayer,275) 
               elseif skinName == "Medic 3 (skin: 276)" then 
                    triggerServerEvent("setMedic",localPlayer,276) 
               end 
                guiSetVisible(windowjob, false) 
                showCursor(false) 
          else 
            outputChatBox("Please,select a skin of the list.",255,0,0) 
            end 
       elseif (source == closebtn) then 
        guiSetVisible(windowjob, false) 
        showCursor(false) 
     end 
  end 
) 

Link to comment
Thx @Renkon i forgot that the 'getPlayerTeam' is Server side

Thx for Try @DNL291 but will not work because 'getPlayerTeam' is Server Side function

but now i use Element Data and it work

getPlayerTeam Is client-side and server-side.

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...