• Dark RP being wiped on death
    9 replies, posted
So when you join the server everything is good but sometimes when you die you respawn with nothing, no physgun no camera, nothing and you have to choose the job again to get your stuff back I want to know how to fix this so my server will be more accessible.
Besides looking through you code and fixing it, a hacky way of fixing this is to reset the player's team in a PlayerSpawn hook
And how would I do that I know how to make hooks but how would I make it so they spawn as their job and with their SWEPS
Literally just reset their team in the hook. ply:SetTeam(ply:Team())
I found the problem its ULIB when its installed it wipes you on death, is there a fix for this? Also I found that when I start the server it gets a error on garrysmod/lua/vgui/dnumslider on line 88 if you could give me some insight on this is would be ecstatic Heres the dnumslider file: local PANEL = {} --[[--------------------------------------------------------- -----------------------------------------------------------]] function PANEL:Init() self.TextArea = self:Add( "DTextEntry" ) self.TextArea:Dock( RIGHT ) self.TextArea:SetDrawBackground( false ) self.TextArea:SetWide( 45 ) self.TextArea:SetNumeric( true ) self.TextArea.OnChange = function( textarea, val ) self:SetValue( self.TextArea:GetText() ) end self.Slider = self:Add( "DSlider", self ) self.Slider:SetLockY( 0.5 ) self.Slider.TranslateValues = function( slider, x, y ) return self:TranslateSliderValues( x, y ) end self.Slider:SetTrapInside( true ) self.Slider:Dock( FILL ) self.Slider:SetHeight( 16 ) Derma_Hook( self.Slider, "Paint", "Paint", "NumSlider" ) self.Label = vgui.Create ( "DLabel", self ) self.Label:Dock( LEFT ) self.Label:SetMouseInputEnabled( true ) self.Scratch = self.Label:Add( "DNumberScratch" ) self.Scratch:SetImageVisible( false ) self.Scratch:Dock( FILL ) self.Scratch.OnValueChanged = function() self:ValueChanged( self.Scratch:GetFloatValue() ) end self:SetTall( 32 ) self:SetMin( 0 ) self:SetMax( 1 ) self:SetDecimals( 2 ) self:SetText( "" ) self:SetValue( 0.5 ) -- -- You really shouldn't be messing with the internals of these controls from outside.. -- .. but if you are this might stop your code from fucking us both. -- self.Wang = self.Scratch end --[[--------------------------------------------------------- SetMinMax -----------------------------------------------------------]] function PANEL:SetMinMax( min, max ) self.Scratch:SetMin( tonumber( min ) ) self.Scratch:SetMax( tonumber( max ) ) self:UpdateNotches() end function PANEL:SetDark( b ) self.Label:SetDark( b ) end --[[--------------------------------------------------------- GetMin -----------------------------------------------------------]] function PANEL:GetMin() return self.Scratch:GetMin() end --[[--------------------------------------------------------- GetMin -----------------------------------------------------------]] function PANEL:GetMax() return self.Scratch:GetMax() end --[[--------------------------------------------------------- GetRange -----------------------------------------------------------]] function PANEL:GetRange() return self:GetMax() - self:GetMin() end --[[--------------------------------------------------------- SetMin -----------------------------------------------------------]] function PANEL:SetMin( min ) if ( !min ) then min = 0 end self.Scratch:SetMin( tonumber( min ) ) self:UpdateNotches() end --[[--------------------------------------------------------- SetMax -----------------------------------------------------------]] function PANEL:SetMax( max ) if ( !max ) then max = 0 end self.Scratch:SetMax( tonumber( max ) ) self:UpdateNotches() end --[[--------------------------------------------------------- Name: SetValue -----------------------------------------------------------]] function PANEL:SetValue( val ) val = math.Clamp( tonumber( val ) or 0, self:GetMin(), self:GetMax() ) if ( val == nil ) then return end if ( self:GetValue() == val ) then return end self.Scratch:SetValue( val ) self:ValueChanged( self:GetValue() ) end --[[--------------------------------------------------------- Name: GetValue -----------------------------------------------------------]] function PANEL:GetValue() return self.Scratch:GetFloatValue() end --[[--------------------------------------------------------- Name: SetDecimals -----------------------------------------------------------]] function PANEL:SetDecimals( d ) self.Scratch:SetDecimals( d ) self:UpdateNotches() end --[[--------------------------------------------------------- Name: GetDecimals -----------------------------------------------------------]] function PANEL:GetDecimals() return self.Scratch:GetDecimals() end -- -- Are we currently changing the value? -- function PANEL:IsEditing() return self.Scratch:IsEditing() || self.TextArea:IsEditing() || self.Slider:IsEditing() end --[[--------------------------------------------------------- Name: PerformLayout -----------------------------------------------------------]] function PANEL:PerformLayout() self.Label:SetWide( self:GetWide() / 2.4 ) end --[[--------------------------------------------------------- Name: SetConVar -----------------------------------------------------------]] function PANEL:SetConVar( cvar ) self.Scratch:SetConVar( cvar ) self.TextArea:SetConVar( cvar ) end --[[--------------------------------------------------------- Name: SetText -----------------------------------------------------------]] function PANEL:SetText( text ) self.Label:SetText( text ) end --[[--------------------------------------------------------- Name: ValueChanged -----------------------------------------------------------]] function PANEL:ValueChanged( val ) val = math.Clamp( tonumber( val ) or 0, self:GetMin(), self:GetMax() ) self.Slider:SetSlideX( self.Scratch:GetFraction( val ) ) if ( self.TextArea != vgui.GetKeyboardFocus() ) then self.TextArea:SetValue( self.Scratch:GetTextValue() ) end self:OnValueChanged( val ) end --[[--------------------------------------------------------- Name: OnValueChanged -----------------------------------------------------------]] function PANEL:OnValueChanged( val ) -- For override end --[[--------------------------------------------------------- -----------------------------------------------------------]] function PANEL:TranslateSliderValues( x, y ) self:SetValue( self.Scratch:GetMin() + (x * self.Scratch:GetRange()) ); return self.Scratch:GetFraction(), y end --[[--------------------------------------------------------- Name: GetTextArea -----------------------------------------------------------]] function PANEL:GetTextArea() return self.TextArea end function PANEL:UpdateNotches() local range = self:GetRange() self.Slider:SetNotches( nil ) if ( range < self:GetWide()/4 ) then return self.Slider:SetNotches( range ) else self.Slider:SetNotches( self:GetWide()/4 ) end end --[[--------------------------------------------------------- Name: GenerateExample -----------------------------------------------------------]] function PANEL:GenerateExample( ClassName, PropertySheet, Width, Height ) local ctrl = vgui.Create( ClassName ) ctrl:SetWide( 200 ) ctrl:SetMin( 1 ) ctrl:SetMax( 10 ) ctrl:SetText( "Example Slider!" ) ctrl:SetDecimals( 0 ) PropertySheet:AddSheet( ClassName, ctrl, nil, true, true ) end derma.DefineControl( "DNumSlider", "Menu Option Line", table.Copy(PANEL), "Panel" ) -- No example for this fella PANEL.GenerateExample = nil --[[--------------------------------------------------------- Name: -----------------------------------------------------------]] function PANEL:PostMessage( name, _, val ) if ( name == "SetInteger" ) then if ( val == "1" ) then self:SetDecimals( 0 ) else self:SetDecimals( 2 ) end end if ( name == "SetLower" ) then self:SetMin( tonumber(val) ) end if ( name == "SetHigher" ) then self:SetMax( tonumber(val) ) end if ( name == "SetValue" ) then self:SetValue( tonumber( val ) ) end end --[[--------------------------------------------------------- Name: -----------------------------------------------------------]] function PANEL:PerformLayout() self.Scratch:SetVisible( false ) self.Label:SetVisible( false ) self.Slider:StretchToParent(0,0,0,0)
[QUOTE=TheWoWNerd;48367110]-snip[/QUOTE] Holy crap, please, PLEASE use pastebin, or at [U]least[/U] [CODE].. What is the error? I'm tired right now but you just said it was on line 88 And- what code_gs had said, use [CODE]ply:SetTeam(ply:Team())[/CODE] in a player spawn hook. [URL="http://wiki.garrysmod.com/page/GM/PlayerSpawn"]http://wiki.garrysmod.com/page/GM/PlayerSpawn[/URL]
When you set the player hook it is setting them to that team but also creating problem since darkrp wants you to selct your job from the f4 menu, it gives you the option to select your job even tho you already are it, it also breaks shipments and weapons
I really doubt some clientside code from ULIB is messing up only your server. It's most likely a bug with something else, are any errors being printed while playing?
XGUI queue error: lua/vgui/dnumslider.lua:90: attempt to perform arithmetic on a nil value
Figured it out its ULIB's group system causing errors with the jobs in DarkRP
Sorry, you need to Log In to post a reply to this thread.