• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[code]local HasCalledFunc = false function GM:PlayerSpawn(ply) if HasCalledFunc == true then ply:KillSilent() else ply:SetTeam(TEAM_HUMAN) ply:SetModel( table.Random( humanpms ) ) ply:SetupHands() end end[/code] Anyone know how I could only call the if statement once, when the hook is called instead of being called forever? Edit: Never mind, found a way to do so by replacing GM:PlayerSpawn with GM:PlayerInitialSpawn
Okay so, I'm making a menu that is called when the player runs the ShowHelp key (primarily F1) I'm kinda stuffed on how i would be able to toggle the menu on and off, if the menu is open, it would close, and vice versa. I tried doing this, but I've had no luck. [lua] local EscMenu local function openEscMenu() EscMenu = EscMenu or vgui.Create("escMenu") EscMenu:Appear() end local function closeEscMenu() EscMenu:Disappear() end local function MenuShow() if not EscMenu or not EscMenu.toggled then openEscMenu() else closeEscMenu() end end hook.Add("ShowHelp", "MenuShow", MenuShow) [/lua] Disappear() and Appear() are as followed. [lua] function PANEL:Appear() self:SetVisible(true) self:AlphaTo(255, 0.25, 0) self.toggled = true self:MakePopup() end function PANEL:Disappear() self.toggled = false self:SetVisible(false) end [/lua] If you have any more information, please let me know. I really need some assistance on this as I'm clueless. Extra note: escMenu is a DFrame. Thanks!
Is there any easy way to reverse ACT animations? I'm currently doing this inside CalcMainActivity [code] ply.backwardsTimer = ply.backwardsTimer - 0.0035 ply:SetCycle( ply.backwardsTimer ) [/code] but it seems that it's FPS dependant, someone with 150 fps will see a much faster animation than someone with 30fps.
[QUOTE=Adzter;47788303]Is there any easy way to reverse ACT animations? I'm currently doing this inside CalcMainActivity [code] ply.backwardsTimer = ply.backwardsTimer - 0.0035 ply:SetCycle( ply.backwardsTimer ) [/code] but it seems that it's FPS dependant, someone with 150 fps will see a much faster animation than someone with 30fps.[/QUOTE] [lua] local k = 60 -- Seeing as multiplying by FrameTime() will slow it down considerably, change this. ply.backwardsTimer = ply.backwardsTimer - (0.0035*FrameTime()*k) ply:SetCycle( ply.backwardsTimer ) [/lua]
I'm trying to find out where I'd put a derma menu code that is triggered by an NWBool in cl_init.lua... where would I put this? in an if CLIENT then if statement, or is there a function I could put a code for that in?
[QUOTE=A Fghtr Pilot;47788695]I'm trying to find out where I'd put a derma menu code that is triggered by an NWBool in cl_init.lua... where would I put this? in an if CLIENT then if statement, or is there a function I could put a code for that in?[/QUOTE] Don't use NWBools to trigger menus, use net messages.
What? Why? [editline]23rd May 2015[/editline] I've never even learned how to use the net library correctly, I always found tutorials on it confusing. I just rely on console commands and NWBools...
[QUOTE=A Fghtr Pilot;47788745]What? Why? [editline]23rd May 2015[/editline] I've never even learned how to use the net library correctly, I always found tutorials on it confusing. I just rely on console commands and NWBools...[/QUOTE] Because they're more for storing persistent information that clients need to know. server [lua] util.AddNetworkString("MyNetMessage") net.Receive("MyNetMessage", function(length, ply) print(ply:Nick() .. " sent a net message saying ".. net.ReadString()) end) [/lua] client [lua] net.Start("MyNetMessage") net.WriteString("hello") net.SendToServer() [/lua] output [code] Blasteh sent a net message saying hello [/code]
My entity is: [B]ANIM[/B] not point, and this keeps happening: [B]SERVER:[/B] [code] lua_run print( Player( 3 ).Vehicle:GetBoneName( 1 )) [/code] [B]Output:[/B] [code] Turn_FL [/code] [B]CLIENT:[/B] [code] lua_run_cl print( Player( 3 ).Vehicle:GetBoneName( 1 )) [/code] [B]OUTPUT:[/B] [code] __INVALIDBONE__ [/code] Idk why this is happening. I might just create a clientside entity to grab the bone positions >:l
Anyone know why this doesn't work. It worked a year ago. I have a bunch of func_brush on a map that I want to be passable for a player on a certain team. However when I came back today to test my old gamemode this didn't work. [lua] /* SERVER */ function GM:PlayerInitialSpawn( ply ) GAMEMODE:AutoBalance() GAMEMODE:SyncTime( ply ) if #player.GetAll() >= 2 then GAMEMODE:CheckRound() end ply.respawnTime = CurTime() ply:SetCustomCollisionCheck() end function GM:PlayerSpawn( ply ) ply:SetCustomCollisionCheck() if ply:Team() == TEAM_RED or ply:Team() == TEAM_BLUE then GAMEMODE:PlayerLoadout(ply) end end /* SHARED */ function GM:ShouldCollide( ent, ent2 ) if (ent:IsPlayer() or ent2:IsPlayer()) and (ent:GetClass() == "func_brush" or ent2:GetClass() == "func_brush") then if (ent:GetName() == "reddoor" and ent2:Team() == TEAM_RED) or (ent2:GetName() == "reddoor" and ent:Team() == TEAM_RED) then return false end if (ent:GetName() == "bluedoor" and ent2:Team() == TEAM_BLUE) or (ent2:GetName() == "bluedoor" and ent:Team() == TEAM_BLUE) then return false end end if ent:IsPlayer() and ent2:IsPlayer() then if ent:Team() == ent2:Team() then return false end end return true end [/lua] Here one of [url=https://dl.dropboxusercontent.com/u/10790421/fw_skyplatform.zip]my maps[/url] if you wanna test.
Hello everyone, I am currently having two separate issues on one of my servers and could use some help. First Issue: [code] [ERROR] lua/entities/wt_rocketboots_thinker/cl_init.lua:23: attempt to compare nil with number 1. unknown - lua/entities/wt_rocketboots_thinker/cl_init.lua:23 [/code] [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=237544369"]This[/URL] is the addon in question. I extracted the gma and went through the files. Line 23 that outputs the error. [code] self.Dead = self.DieTime<CurTime() or self.Player:IsOnGround() [/code] Second Issue: [code] [ERROR] lua/autorun/rb655_lightsaber_presets.lua:225: bad argument #1 to 'ClientsideModel' (string expected, got nil) 1. ClientsideModel - [C]:-1 2. fn - lua/autorun/rb655_lightsaber_presets.lua:225 3. unknown - addons/ulib/lua/ulib/shared/hook.lua:108 [/code] [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=111412589"]This[/URL] is the second addon in question. Extracted the gma as well to find the line. Line 225 that outputs error. [code] ply.LightsaberMDL = ClientsideModel( wep.WorldModel, RENDERGROUP_BOTH ) [/code] Thanks for any help :)
Having a problem that i cant seem to fix. When using ulx to force map switches, it crashes the client. Not the server, but the client itself. If more info is needed to figure this out, let me know. This bug is driving me crazy. Thanks for any help or ideas.
Anyone know how I can add a delay to this, so that it doesn't print tons and tons of text upon a player pressing E once? [code]if SERVER then function ENT:Initialize() self:SetModel( self.Model ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetUseType( SIMPLE_USE ) local phys = self:GetPhysicsObject() if (phys:IsValid()) then phys:EnableMotion( true ) end end function ENT:Think() end function ENT:Use( activator, caller, useType ) if activator:IsPlayer() then local _ents = ents.FindInSphere( self:GetPos(), 600 ) for k, v in pairs( _ents ) do if ( v:GetClass() == "simple_nextbot" ) then activator:ChatPrint( "A hostile lifeform has been found!" ) else activator:ChatPrint("The search for hostile lifeforms has found nothing...") end end end [/code]
[QUOTE=A Fghtr Pilot;47790358]Anyone know how I can add a delay to this, so that it doesn't print tons and tons of text upon a player pressing E once? [code]if SERVER then function ENT:Initialize() self:SetModel( self.Model ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetUseType( SIMPLE_USE ) local phys = self:GetPhysicsObject() if (phys:IsValid()) then phys:EnableMotion( true ) end end function ENT:Think() end function ENT:Use( activator, caller, useType ) if activator:IsPlayer() then local _ents = ents.FindInSphere( self:GetPos(), 600 ) for k, v in pairs( _ents ) do if ( v:GetClass() == "simple_nextbot" ) then activator:ChatPrint( "A hostile lifeform has been found!" ) else activator:ChatPrint("The search for hostile lifeforms has found nothing...") end end end [/code][/QUOTE] Set the use type to SIMPLE_USE in ENT:Initialize. [code] self:SetUseType(SIMPLE_USE) [/code]
[QUOTE=A Fghtr Pilot;47790358]Anyone know how I can add a delay to this, so that it doesn't print tons and tons of text upon a player pressing E once? [code]if SERVER then function ENT:Initialize() self:SetModel( self.Model ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetUseType( SIMPLE_USE ) local phys = self:GetPhysicsObject() if (phys:IsValid()) then phys:EnableMotion( true ) end end function ENT:Think() end function ENT:Use( activator, caller, useType ) if activator:IsPlayer() then local _ents = ents.FindInSphere( self:GetPos(), 600 ) for k, v in pairs( _ents ) do if ( v:GetClass() == "simple_nextbot" ) then activator:ChatPrint( "A hostile lifeform has been found!" ) else activator:ChatPrint("The search for hostile lifeforms has found nothing...") end end end [/code][/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetUseType]Entity:SetUseType[/url] to SIMPLE_USE in the init function.
I'm having a bit of trouble building a module for GMod. I downloaded the files off of the Github, but when I run premake.bat, it says "cannot open ../../common.lua; no such file or directory."I have the source SDK repository downloaded in the directory that the module source is in. This is the first time that I have had to do this, so can anyone offer me help?
[QUOTE=AK to Spray;47790696]I'm having a bit of trouble building a module for GMod. I downloaded the files off of the Github, but when I run premake.bat, it says "cannot open ../../common.lua; no such file or directory."I have the source SDK repository downloaded in the directory that the module source is in. This is the first time that I have had to do this, so can anyone offer me help?[/QUOTE] Which of our modules are you attempting to build?
[url]https://github.com/glua/build-loadout[/url] It might already be on our build page [editline]23rd May 2015[/editline] [url]http://build.glua.me/[/url]
So I'm trying to make a rainbow effect on my weapon. My main problem is getting individual values from a the vector of pl:GetWeaponColor(). Any help with that?
I am attempting to improve wire mods FLIR for wire cameras. It turns out the color of the prop can effect what it looks like. So I look at this, [CODE] FLIR.normal = CreateMaterial("flir_normal", "VertexLitGeneric", { ["$basetexture"] = "color/white", ["$model"] = 1, ["$halflambert"] = 1 -- causes the diffuse lighting to 'wrap around' more })[/CODE] And figure if can force the color too be white, then they should always show up. I add this. [CODE]["$color"] = {255,255,255},[/CODE] [CODE] FLIR.normal = CreateMaterial("flir_normal", "VertexLitGeneric", { ["$basetexture"] = "color/white", ["$model"] = 1, ["$color"] = {255,255,255}, ["$halflambert"] = 1 -- causes the diffuse lighting to 'wrap around' more })[/CODE] Nothing changed. Am I doing something wrong?
[QUOTE=MCiLuZiioNz;47789915]Hello everyone, I am currently having two separate issues on one of my servers and could use some help. First Issue: [code] [ERROR] lua/entities/wt_rocketboots_thinker/cl_init.lua:23: attempt to compare nil with number 1. unknown - lua/entities/wt_rocketboots_thinker/cl_init.lua:23 [/code] [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=237544369"]This[/URL] is the addon in question. I extracted the gma and went through the files. Line 23 that outputs the error. [code] self.Dead = self.DieTime<CurTime() or self.Player:IsOnGround() [/code] Second Issue: [code] [ERROR] lua/autorun/rb655_lightsaber_presets.lua:225: bad argument #1 to 'ClientsideModel' (string expected, got nil) 1. ClientsideModel - [C]:-1 2. fn - lua/autorun/rb655_lightsaber_presets.lua:225 3. unknown - addons/ulib/lua/ulib/shared/hook.lua:108 [/code] [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=111412589"]This[/URL] is the second addon in question. Extracted the gma as well to find the line. Line 225 that outputs error. [code] ply.LightsaberMDL = ClientsideModel( wep.WorldModel, RENDERGROUP_BOTH ) [/code] Thanks for any help :)[/QUOTE] For first issue do: [code] self.Dead = ( self.DieTime or 0 ) < CurTime() or self.Player:IsOnGround() [/code] Second issue do [code] if wep.WorldModel do ply.LightsaberMDL = ClientsideModel( wep.WorldModel, RENDERGROUP_BOTH ) else -- there is no world model so put code here on how to handle that end [/code] [editline]24th May 2015[/editline] [QUOTE=B10H4Z4RD;47791707]So I'm trying to make a rainbow effect on my weapon. My main problem is getting individual values from a the vector of pl:GetWeaponColor(). Any help with that?[/QUOTE] you can get the rgb by doing, for example; pl:GetWeaponColor().r for [B]r[/B]ed
[QUOTE=FLIPPY;47791828]I am attempting to improve wire mods FLIR for wire cameras. It turns out the color of the prop can effect what it looks like. So I look at this, [CODE] FLIR.normal = CreateMaterial("flir_normal", "VertexLitGeneric", { ["$basetexture"] = "color/white", ["$model"] = 1, ["$halflambert"] = 1 -- causes the diffuse lighting to 'wrap around' more })[/CODE] And figure if can force the color too be white, then they should always show up. I add this. [CODE]["$color"] = {255,255,255},[/CODE] [CODE] FLIR.normal = CreateMaterial("flir_normal", "VertexLitGeneric", { ["$basetexture"] = "color/white", ["$model"] = 1, ["$color"] = {255,255,255}, ["$halflambert"] = 1 -- causes the diffuse lighting to 'wrap around' more })[/CODE] Nothing changed. Am I doing something wrong?[/QUOTE] Try $color2 instead of $color.
How can I make a rendertarget a material rather than a texture?
[QUOTE=Cushie;47792836]Try $color2 instead of $color.[/QUOTE] Nothing changed. I think its cause I'm trying to change the color of the material, not the prop it self. Then again I could be wrong.
[QUOTE=thatguy2234;47790670]Set the use type to SIMPLE_USE in ENT:Initialize. [code] self:SetUseType(SIMPLE_USE) [/code][/QUOTE] It's already got it's usetype as SIMPLE_USE. My problem is that it prints tons of text on a player's screen instead of just printing one line. I tried putting just plain "return" in the code and it worked, though.
[QUOTE=meharryp;47792922]How can I make a rendertarget a material rather than a texture?[/QUOTE] [lua]CreateMaterial(rtname, 'shader', { ["$basetexture"] = rtname })[/lua]
[QUOTE=zerf;47790707][url]https://github.com/glua/build-loadout[/url] It might already be on our build page [editline]23rd May 2015[/editline] [url]http://build.glua.me/[/url][/QUOTE] Thanks, the modules were already built on that site. Unfortunately, GMod is refusing to load modules in the menu state, but I'm still trying to fix it.
[QUOTE=AK to Spray;47793812]Thanks, the modules were already built on that site. Unfortunately, GMod is refusing to load modules in the menu state, but I'm still trying to fix it.[/QUOTE] gmsv_module_win32.DLL should let it load on the menu.
[QUOTE=meharryp;47793825]gmsv_module_win32.DLL should let it load on the menu.[/QUOTE] Correct, works properly. Thanks.
some time ago someone on the what are you working on thread said some function of the render distance function but I can't seem to find it back
Sorry, you need to Log In to post a reply to this thread.