SWEP/Derma help

Ok so i have a SWEP that on RELOAD runs a umsg to open a derma gui, but it opens like 7 of them and i know this is due to CurTime or whatever.

But i was told http://wiki.garrysmod.com/page/Global/IsFirstTimePredicted this would help i just have no idea where to put it.

Cheers for any help.

Can we see your code to help you with further assistance?

Reload


function SWEP:Reload()
  if ( not IsFirstTimePredicted() then return end)
 
	plr = self.Owner
	if( SERVER )then	
		umsg.Start("OpenGUI",plr)
		umsg.End()
	end
end


Derma



function DisguiseMenu()

	
	local DisguiseFrame = vgui.Create("DFrame")
	DisguiseFrame:SetPos(ScrW() * 0.125, ScrH() * 0.1)
	DisguiseFrame:SetSize(ScrW() * .75,ScrH() * .85 )
	DisguiseFrame:SetTitle( "" ) 
	DisguiseFrame:SetVisible( true )
	DisguiseFrame:SetDraggable( false )
	DisguiseFrame:ShowCloseButton( false )


That looks right…

Compare with my admin_baton:


function SWEP:SecondaryAttack( )
	// Don't let the server pass this point
	if ( SERVER ) then return false; end

	// Ensure the menu opens only once per click - The way clients work in terms of swep usage, is that they spam the function call until both the client and server are in sync. 
	// This means that while the server calls the function once, the client may call it 1 to 10 or more times. -- Use this to ensure it's only once.
	if ( !IsFirstTimePredicted( ) ) then return; end

	// This is where you set your menu; you can use vgui.Create, you can use a simple menu with sub-directories and icons, etc, or whatever.
	admin:OpenMenu( self.Owner );
end

So i altered it too


function SWEP:Reload()
if ( SERVER ) then return false; end
if ( !IsFirstTimePredicted( ) ) then return; end
 
	plr = self.Owner
	if( SERVER )then	
		umsg.Start("OpenGUI",plr)
		umsg.End()
	end
end


But still opens 5-9 panels

That code shouldn’t even run… If ( SERVER ) then return; end, then only server can call it… It won’t open with that code at all.

NOTE: Auto-refresh WORKS on entities / weapons / etc, BUT, WHEN you auto-refresh an entity, you must REMOVE the existing one and respawn it for changes to appear.

Make sure you remove the weapon and respawn it so the changes show up.