Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local currModelNr
- if (istable(job.model)) then
- currModelNr = 1
- jobModel = job.model[currModelNr]
- else
- currModelNr = nil
- end
- local playermodel = jobDetailsPanel:Add("DModelPanel")
- playermodel:SetPos(-50, 0)
- playermodel:SetSize(400, 800)
- playermodel:SetModel(jobModel)
- local mn, mx = playermodel.Entity:GetRenderBounds()
- local size = 0
- size = math.max( size, math.abs(mn.x) + math.abs(mx.x) )
- size = math.max( size, math.abs(mn.y) + math.abs(mx.y) )
- size = math.max( size, math.abs(mn.z) + math.abs(mx.z) )
- playermodel:SetFOV( 15 )
- playermodel:SetCamPos( Vector( size + 180, size, size ) )
- playermodel:SetLookAt( (mn + mx) * 0.3 )
- function playermodel:LayoutEntity( Entity ) return end -- disables default rotation
- -- Right Arrow for playermodel change
- if (istable(job.model)) then
- local arrowRightButton = jobDetailsPanel:Add("DButton")
- arrowRightButton:SetText("")
- arrowRightButton:SetPos(230, 260)
- arrowRightButton:SetSize(23, 43)
- arrowRightButton.DoClick = function()
- if (currModelNr != nil) then
- if isstring(job.model[currModelNr + 1]) then
- currModelNr = currModelNr + 1
- jobModel = job.model[currModelNr]
- playermodel:SetModel(jobModel)
- DarkRP.setPreferredJobModel(jobindex, jobModel)
- end
- end
- end
- arrowRightButton.Paint = function(self, w, h)
- surface.SetDrawColor(VoidF4.Colors.White)
- surface.SetMaterial(VoidF4.Icons.ArrowRight)
- surface.DrawTexturedRect(0, 0, 23, 43)
- end
- -- Left Arrow for playermodel change
- local arrowLeftButton = jobDetailsPanel:Add("DButton")
- arrowLeftButton:SetText("")
- arrowLeftButton:SetPos(30, 260)
- arrowLeftButton:SetSize(23, 43)
- arrowLeftButton.DoClick = function()
- if (currModelNr != nil) then
- if isstring(job.model[currModelNr - 1]) then
- currModelNr = currModelNr - 1
- jobModel = job.model[currModelNr]
- playermodel:SetModel(jobModel)
- DarkRP.setPreferredJobModel(jobindex, jobModel)
- end
- end
- end
- arrowLeftButton.Paint = function(self, w, h)
- surface.SetDrawColor(VoidF4.Colors.White)
- surface.SetMaterial(VoidF4.Icons.ArrowLeft)
- surface.DrawTexturedRect(0, 0, 23, 43)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement