• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
Since you appear to be in the menu realm, you could use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/JoinServer]JoinServer[/url] function.
[QUOTE=meharryp;47603825]Printing it just returns the IP without the "" around it.[/QUOTE] It seems RunConsoleCommand doesn't pass the port. [code] ] lua_run_cl RunConsoleCommand( "connect", "185.38.148.13:27215" ) Network: IP 169.254.113.123, mode MP, dedicated No, ports 27015 SV / 27005 CL Bad server address ("185.38.148.13:27215") [/code]
It refuses to connect even without the port: [lua] ] lua_run_menu RunConsoleCommand( 'connect','185.38.148.13' ) Bad server address ("185.38.148.13") [/lua]
[QUOTE=meharryp;47603894]It refuses to connect even without the port: [lua] ] lua_run_menu RunConsoleCommand( 'connect','185.38.148.13' ) Bad server address ("185.38.148.13") [/lua][/QUOTE] That would be because there isn't a server on the default port I'm guessing.
Tried connecting to my local srcds and it still didn't work.
It's because RunConsoleCommand re-creates the argstr with your parameters (with quotes), which is what the connect command uses. There's other functions in the menu state meant for this, traverse _G and look.
[QUOTE=meharryp;47603912]Tried connecting to my local srcds and it still didn't work.[/QUOTE] Did you try using the JoinServer function provided above?
-snip-
[QUOTE=James xX;47603930]Did you try using the JoinServer function provided above?[/QUOTE] Didn't think of that, not really done much in the menu state previously.
[QUOTE=meharryp;47603912]Tried connecting to my local srcds and it still didn't work.[/QUOTE] Try [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/RawConsoleCommand]Global.RawConsoleCommand[/url] Note you put the command as one string, "connect ip:port" not "connect", "ip:port". [editline]26th April 2015[/editline] Or use the built in one, but for future reference if you have problems with any other commands.
I have an entity that plays a series of sounds when pressed, one after the other using timers.( if you happen to know a better method to make sounds play one after the other please let me know ). Anyways, I want it to be where if its pressed , it stops playing the old sequence of sounds from the last press ad restarts them. Im pretty sure entity:stopsound wont help me.
Can I get some help on this weird behavior with my rock? [code] AddCSLuaFile() ENT.Spawnable = true ENT.Base = "base_gmodentity" ENT.Type = "anim" function ENT:Initialize() self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE ) self:SetModel( "models/props/cs_militia/militiarock05.mdl" ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end end [/code] [vid]http://giant.gfycat.com/EuphoricNiceGoral.webm[/vid]
[QUOTE=Exho;47605478]Can I get some help on this weird behavior with my rock? [code] AddCSLuaFile() ENT.Spawnable = true ENT.Base = "base_gmodentity" ENT.Type = "anim" function ENT:Initialize() self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE ) self:SetModel( "models/props/cs_militia/militiarock05.mdl" ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end end [/code] [vid]http://giant.gfycat.com/EuphoricNiceGoral.webm[/vid][/QUOTE] If I remember correctly its because your initializing the physics on the client when you should only do it serverside. Add "if CLIENT then return end" after "function ENT:Initialize()" and it should fix it
Is there a way to disable the rendering of entities and props in a render view?
[QUOTE=Exho;47605478]rock[/QUOTE] also, just so you know, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/PhysWake]Entity:PhysWake[/url] is a shortcut for those last 4 lines
Is there an easy way to get a player to spectate something but keep the actual player where they were and frozen? I don't think Player:Lock/Freeze would work because you wouldn't be able to rotate the view but maybe it could work mixed with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/StartCommand]GM/StartCommand[/url]?
[QUOTE=MattJeanes;47608142]Is there an easy way to get a player to spectate something but keep the actual player where they were and frozen? I don't think Player:Lock/Freeze would work because you wouldn't be able to rotate the view but maybe it could work mixed with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/StartCommand]GM/StartCommand[/url]?[/QUOTE] You'd want: [url]http://wiki.garrysmod.com/page/GM/CalcView[/url]
How can I make some sort of cursor on the 3D2D panel? More specifically, how can I convert the HitPos of the player's EyeTrace into an x and y so that I can display a cursor where the player is looking on the 3D2D panel.
Seems like i was ignored last time: How can i retrieve entities nearest VISIBLE point according to it's model? entity:NearestPoint(vector) does not seem to retrieve nearest VISIBLE point. Thanks
Is there a way working in both SP and MP to check if a player is in firstperson? I'm trying to use this, but it doesn't work in singleplayer. And yes, I know it's awful code. [code] function SWEP:IsFirstPerson() if !IsValid(self) or !self:OwnerIsValid() then return false end if gamemode.ShouldDrawLocalPlayer and gamemode.ShouldDrawLocalPlayer(self.Owner) then return false end if !self:IsWeaponVisible() then return false end if self.Owner.ShouldDrawLocalPlayer and self.Owner:ShouldDrawLocalPlayer() then return false end if !IsValid(self.Owner:GetViewModel()) then return false end return true end [/code]
Did someone got an wiki or simmilar for the CPPI functions?
[QUOTE=Tomelyr;47610906]Did someone got an wiki or simmilar for the CPPI functions?[/QUOTE] [url]http://ulyssesmod.net/archive/CPPI_v1-3.pdf[/url]
Got the first person thing working, but why does this code work in MP and not SP? In SP it returns a seemingly random position in third AND firstperson. [code] function SWEP:GetMuzzlePos( ignorepos ) if !IsValid(self.Owner) then return nil end local ply=self.Owner local fp = self:IsFirstPerson() local vm = ply:GetViewModel() local obj = 0--vm:LookupAttachment( self.MuzzleAttachment and self.MuzzleAttachment or "1") if fp then obj=self:GetFPMuzzleAttachment() else obj = self:LookupAttachment( self.MuzzleAttachment and self.MuzzleAttachment or "1") if !obj or obj==0 then obj = 1 end end local muzzlepos if fp then local pos = vm:GetPos() local ang = vm:GetAngles() local rpos = vm:GetRenderOrigin() local rang = vm:GetRenderAngles() if ignorepos then vm:SetPos(ply:GetShootPos()) vm:SetAngles(ply:EyeAngles()) vm:SetRenderOrigin(ply:GetShootPos()) vm:SetRenderAngles(ply:EyeAngles()) end muzzlepos = vm:GetAttachment( obj ) vm:SetPos(pos) vm:SetAngles(ang) vm:SetRenderOrigin(rpos) vm:SetRenderAngles(rang) else muzzlepos = self:GetAttachment(obj) end return muzzlepos end [/code]
In my darkrp server, I have health stations (just the default HL2 ones) and players are able to put them in their pockets. Any way to blacklist that for the pockets?
[QUOTE=meowking1;47612544]In my darkrp server, I have health stations (just the default HL2 ones) and players are able to put them in their pockets. Any way to blacklist that for the pockets?[/QUOTE] There's a list like this in settings.lua [lua] GM.Config.PocketBlacklist = { ["fadmin_jail"] = true, ["meteor"] = true, ["door"] = true, ["func_"] = true, ["player"] = true, ["beam"] = true, ["worldspawn"] = true, ["env_"] = true, ["path_"] = true, ["prop_physics"] = true, ["money_printer"] = true, ["gunlab"] = true, } [/lua] Simply add your health state entity to that list.
Does anyone know why this gives me a mysqlite error? [lua] MySQLite.query("DELETE FROM IF EXISTS darkrp_guns (steam) VALUES ("..steamID..")") [/lua] The error: [lua] gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:253: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(steam) VALUES (76561198077479957)' at line 1 (DELETE FROM IF EXISTS darkrp_guns (steam) VALUES (76561198077479957)) [/lua]
[QUOTE=Pawsative;47613815]Does anyone know why this gives me a mysqlite error? [lua] MySQLite.query("DELETE FROM IF EXISTS darkrp_guns (steam) VALUES ("..steamID..")") [/lua] The error: [lua] gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:253: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(steam) VALUES (76561198077479957)' at line 1 (DELETE FROM IF EXISTS darkrp_guns (steam) VALUES (76561198077479957)) [/lua][/QUOTE] use WHERE.
[QUOTE=_FR_Starfox64;47609842]How can I make some sort of cursor on the 3D2D panel? More specifically, how can I convert the HitPos of the player's EyeTrace into an x and y so that I can display a cursor where the player is looking on the 3D2D panel.[/QUOTE] Maybe this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/ToScreen]Vector:ToScreen[/url]
[QUOTE=James xX;47613869]use WHERE.[/QUOTE] Thanks :)
[QUOTE=Exho;47613878]Maybe this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/ToScreen]Vector:ToScreen[/url][/QUOTE] Do you really think it would be that easy... [code] local angles = cahTable:GetAngles() angles:RotateAroundAxis(angles:Up(), 90) local hitPos = util.IntersectRayWithPlane(LocalPlayer():EyePos(), gui.ScreenToVector(ScrW()/2, ScrH()/2), cahTable:LocalToWorld(cahTable.origin), angles:Up()) local offset = hitPos - cahTable:LocalToWorld(cahTable.origin) offset:Rotate(Angle(0, -angles.y, 0)) offset:Rotate(Angle(-angles.p, 0, 0)) offset:Rotate(Angle(0, 0, -angles.r)) local cursor = {x = offset.x * (1 / 0.125), y = -(offset.y * (1 / 0.125))} [/code] [I]So yeah, I found a solution after doing some looking around.[/I]
Sorry, you need to Log In to post a reply to this thread.