Jump to content

Skin Selecter in Police Job


Recommended Posts

Ive edited an old script of mine for Police And I'd like to add a skin selecter How would I do this?

MainScript

Police = createTeam("Police", 0, 0, 35) 
  
  
  
PoliceTeams = { [Police] = true } 
  
function teamSet ( ) 
    local team = getTeamFromName ( "Police" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 0, 35 ) 
    giveWeapon ( source, 23, 1000, true ) 
    giveWeapon ( source, 3, 1, true )                  outputChatBox("", thePlayer) 
        else 
            local teamw = getTeamFromName ( "Police" ) 
            if teamw then 
            cancelEvent() 
            outputChatBox("", source) 
        end 
    end 
end 
addEvent ( "sPolice", true) 
addEventHandler ( "sPolice", root, teamSet ) 
  
  

Other script "There is 1 of these for every police station

GUIEditor = { 
    memo = {}, 
    button = {}, 
    window = {}, 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0.29, 0.24, 0.42, 0.49, "", true) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1], false) 
  
        bAccept = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "", true, GUIEditor.window[1]) 
         
        bAccept = guiCreateButton(0.60, 0.20, 0.34, 0.17, "Accept Job", true, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "sa-header") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
        addEventHandler("onClientGUIClick", bAccept, showGUIbf, false) 
        addEventHandler("onClientGUIClick", bAccept, joinTeam, false) 
         
        bClose = guiCreateButton(0.67, 0.61, 0.20, 0.16, "CLOSE", true, GUIEditor.window[1]) 
        guiSetProperty(bClose, "NormalTextColour", "FFAAAAAA")  
        addEventHandler("onClientGUIClick", bClose, showGUIbf, false) 
         
        GUIEditor.memo[1] = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "PoliceJob Chose To Get Into Police then choose A skin!", true, GUIEditor.window[1]) 
         
    end 
) 
  
local joinBD = createMarker(-217.2392578125, 979.220703125, 17.500894546509, "cylinder", 2, 0, 0, 35) 
  
  
addEventHandler( "onClientResourceStart", getRootElement( ), 
    function ( startedRes ) 
    end 
); 
  
function showGUIbt(hitElement) 
 if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
 guiSetVisible(GUIEditor.window[1], true) 
 showCursor( true ) 
 end 
 end 
 addEventHandler("onClientMarkerHit", joinBD, showGUIbt)  
  
function showGUIbf() 
    guiSetVisible (GUIEditor.window[1], false ) 
    showCursor ( false ) 
end 
  
  
function joinTeam() 
    triggerServerEvent("sPolice", localPlayer, "teamSet") 
end 
  
  

Link to comment

There are many ways to implement such as solution, I assume that you're looking for a GUI with a list and some communication between server and client for preview and stuff.

You could take a look at this:

http://code.albonius.com/?action=download&id=8523e282173778cc46739ae4405d3784 (Police, law job with GUI and skin selection)

or maybe this:

http://code.albonius.com/?action=download&id=6da85f73be5914342a14abed0e7921a5 (Entire job system with skin selection from GUI and asynchronous preview visible to the client only).

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