• What do you need help with? V3
    6,419 replies, posted
  • Avatar of marvincmarvin
  • [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index0167.html?title=Entity.SetUnFreezable]Entity.SetUnFreezable [img]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/images/9/9f/NewerServer.png[/img][/url][/b]?
  • Avatar of Fantym420
  • [QUOTE=Mrwhitee;34627748]issues[/QUOTE] try adding these (or just one or the other) before ent:Spawn() [lua] ent:SetKeyValue("gmod_allowphysgun","0") ent:SetKeyValue("gmod_allowtools","0") [/lua] that should stop them from being affected by physgun and tool gun [b]edited:[/b] lol, should have refreshed, the other way looks easier.
  • [QUOTE=PencilOnDesk;34626053][lua]function bloodtest() for k,v in pairs(player.GetAll()) do if v:Health() >= 25 then if timer.IsTimer("NextBleedOut") then timer.Destroy("NextBleedOut") end end if v:Health() <= 24 then if timer.IsTimer("NextBleedOut") then return end timer.Create("NextBleedOut",1,0,function() local Pos = v:GetPos() + Vector(0,0,30) local effectdata = EffectData() effectdata:SetStart( Pos ) effectdata:SetOrigin( Pos ) effectdata:SetScale( 1 ) util.Effect( "BloodImpact", effectdata ) local trace = {}; trace.start = v:GetPos() + Vector(0, 0, 256); trace.endpos = trace.start + Vector(0, 0, -1024); trace.filter = v; trace2 = util.TraceLine(trace); util.Decal("Blood", trace2.HitPos + trace2.HitNormal, trace2.HitPos - trace2.HitNormal) end) end end end hook.Add("Think","Bloodoasdf",bloodtest) hook.Add("PlayerDeath","ClearTimers", function() if timer.IsTimer("NextBleedOut") then timer.Destroy("NextBleedOut") end end)[/lua] Trying to work on some sort of bleeding system where the decal is drawn under the player; However at the moment the Decal only gets drawn when the player dies. Why is this?[/QUOTE] Just checked it for you, I'm pretty sure the decal is applied to the player.
  • What would be the correct way to send a string from the server to all clients? e.g I gave all the players a name server-side and using [I]ply:GetRPName()[/I] returns the name string. Now I want all players in the server to know that players RP name. Should I use NetworkedString (NWString) or usermessages? I just can't find an optimized way to do it. How should I handle new players connecting and receiving that name?
  • [QUOTE=Panto;34632111]What would be the correct way to send a string from the server to all clients? e.g I gave all the players a name server-side and using [I]ply:GetRPName()[/I] returns the name string. Now I want all players in the server to know that players RP name. Should I use NetworkedString (NWString) or usermessages? I just can't find an optimized way to do it. How should I handle new players connecting and receiving that name?[/QUOTE] NWStrings seem like your best bet because all clients need to recieve it. Usermessages are mainly for when sending data to specific clients. If you aren't changing these RP names a lot then you have nothing to worry about.
  • Avatar of pennerlord
  • [QUOTE=Mrkrabz;34625018]What do you mean by running the gmod database?[/QUOTE] Nevermind. I was wrong. Sqlite is serverless. [quote]Most SQL database engines are implemented as a separate server process. Programs that want to access the database communicate with the server using some kind of interprocess communication (typically TCP/IP) to send requests to the server and to receive back results. SQLite does not work this way. With SQLite, the process that wants to access the database reads and writes directly from the database files on disk. There is no intermediary server process.[/quote] Source: [url]http://www.sqlite.org/serverless.html[/url] However you can still use Sqlite with PHP. That might be useful: [url]http://www.php.net/manual/en/book.sqlite.php[/url]
  • Avatar of PencilOnDesk
  • [QUOTE=SFArial;34631396]Just checked it for you, I'm pretty sure the decal is applied to the player.[/QUOTE] How would I fix the issue, I really can't think of another way to place the decal other than that.
  • Avatar of confinedUser
  • how do i define a local variable because according to gmod this isn't enough [lua]local Colors = { border = Color( 255, 255, 255, 255), background = Color( 255, 255, 255, 200 ), shade = Color( 255, 255, 255, 255 ), fill = Color( 0, 0, 0, 255 ), };[/lua]
  • Avatar of pennerlord
  • [QUOTE=confinedUser;34637981]how do i define a local variable because according to gmod this isn't enough [lua]local Colors = { border = Color( 255, 255, 255, 255), background = Color( 255, 255, 255, 200 ), shade = Color( 255, 255, 255, 255 ), fill = Color( 0, 0, 0, 255 ), };[/lua][/QUOTE] Like the way you are doing it now.
  • Avatar of confinedUser
  • [QUOTE=pennerlord;34638431]Like the way you are doing it now.[/QUOTE] I fixed it I guess I had the "C" in colors capitalized
  • Avatar of Jinx786
  • [QUOTE=confinedUser;34638520]I fixed it I guess I had the "C" in colors capitalized[/QUOTE] Get gmod lua syntax highlighter, it will light up correct syntax: [IMG]http://shrani.si/f/1I/1B/3Eec0AV2/capture.png[/IMG]
  • Avatar of Drakehawke
  • [QUOTE=Jinx786;34640175]Get gmod lua syntax highlighter, it will light up correct syntax: [IMG]http://shrani.si/f/1I/1B/3Eec0AV2/capture.png[/IMG][/QUOTE] That only works for GMod functions/variables, his problem was he mistyped his own variable "Colors" (not the GMod object Color) with an incorrect case, which a syntax highlighter wouldn't pick up.
  • Avatar of Jinx786
  • [QUOTE=Drakehawke;34640378]That only works for GMod functions/variables, his problem was he mistyped his own variable "Colors" (not the GMod object Color) with an incorrect case, which a syntax highlighter wouldn't pick up.[/QUOTE] Sorry, my mistake.
  • Avatar of confinedUser
  • ok so as far as errors go, their fixed but as for displaying thats another thing. Oh also Jinx I already have the highlighter
  • I'm trying to set the client's camera position however it doesn't seem to be working. [lua] function PlayerSpawn( ply ) orig = ply:EyePos() ply:EyePos(orig + Vector(0,100,0)) end hook.Add("PlayerSpawn","PlayerSpawn",PlayerSpawn) [/lua] It doesn't do anything.
  • Avatar of PencilOnDesk
  • [QUOTE=PencilOnDesk;34626053][lua]function bloodtest() for k,v in pairs(player.GetAll()) do if v:Health() >= 25 then if timer.IsTimer("NextBleedOut") then timer.Destroy("NextBleedOut") end end if v:Health() <= 24 then if timer.IsTimer("NextBleedOut") then return end timer.Create("NextBleedOut",1,0,function() local Pos = v:GetPos() + Vector(0,0,30) local effectdata = EffectData() effectdata:SetStart( Pos ) effectdata:SetOrigin( Pos ) effectdata:SetScale( 1 ) util.Effect( "BloodImpact", effectdata ) local trace = {}; trace.start = v:GetPos() + Vector(0, 0, 256); trace.endpos = trace.start + Vector(0, 0, -1024); trace.filter = v; trace2 = util.TraceLine(trace); util.Decal("Blood", trace2.HitPos + trace2.HitNormal, trace2.HitPos - trace2.HitNormal) end) end end end hook.Add("Think","Bloodoasdf",bloodtest) hook.Add("PlayerDeath","ClearTimers", function() if timer.IsTimer("NextBleedOut") then timer.Destroy("NextBleedOut") end end)[/lua] Trying to work on some sort of bleeding system where the decal is drawn under the player; However at the moment the Decal only gets drawn when the player dies. Why is this?[/QUOTE] Bump
  • Avatar of lorde banana
  • [QUOTE=Mrkrabz;34642020]I'm trying to set the client's camera position however it doesn't seem to be working. [lua] function PlayerSpawn( ply ) orig = ply:EyePos() ply:EyePos(orig + Vector(0,100,0)) end hook.Add("PlayerSpawn","PlayerSpawn",PlayerSpawn) [/lua] It doesn't do anything.[/QUOTE] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index0ab4.html?title=Player.SetEyeAngles[/url]
  • [QUOTE=Banana Lord.;34643187][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index0ab4.html?title=Player.SetEyeAngles[/url][/QUOTE] I cant seem to get this worked out, I'm playing around with the settings but it's confusing me. What I'm wanting is the camera to be about 100 units or so away from the player facing the side of the player (Z Axis) Ill later then make it so the play can only walk on the X axis.
  • Avatar of marvincmarvin
  • [QUOTE=confinedUser;34637981] ... [/QUOTE] [lua]local Colors = { border = Color( 255, 255, 255, 255), background = Color( 255, 255, 255, 200 ), shade = Color( 255, 255, 255, 255 ), fill = Color( 0, 0, 0, 255 )-- , <- This comma does not belong. };[/lua]
  • [QUOTE=Mrkrabz;34643494]I cant seem to get this worked out, I'm playing around with the settings but it's confusing me. What I'm wanting is the camera to be about 100 units or so away from the player facing the side of the player (Z Axis) Ill later then make it so the play can only walk on the X axis.[/QUOTE] Use [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa5ae.html?title=Gamemode.CalcView"]this[/URL].
  • [QUOTE=SFArial;34643661]Use [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa5ae.html?title=Gamemode.CalcView"]this[/URL].[/QUOTE] Thank you :) Also, this has worked for me: [lua] local view = {} view.origin = pos-(angles:Right()*-300) view.angles = angles + Angle(0,90,0) view.fov = fov return view [/lua] How would I go about locking the camera from moving? Basically rendering the mouse useless.
  • [QUOTE=Mrkrabz;34643973]Thank you :) Also, this has worked for me: [lua] local view = {} view.origin = pos-(angles:Right()*-300) view.angles = angles + Angle(0,90,0) view.fov = fov return view [/lua] How would I go about locking the camera from moving? Basically rendering the mouse useless.[/QUOTE] I'm not quite sure what you mean. Like disabling the ability to look around with the mouse?
  • [QUOTE=SFArial;34644707]I'm not quite sure what you mean. Like disabling the ability to look around with the mouse?[/QUOTE] Yes, the gamemode that I'm doing is based around the side view of a player, ill also need to somehow make A and D do what W and S do as the camera is beside the player (angled to face the player). I don't want people moving the camera as you can bug it out the world.
  • Avatar of Fantym420
  • [QUOTE=Mrkrabz;34644944]Yes, the gamemode that I'm doing is based around the side view of a player, ill also need to somehow make A and D do what W and S do as the camera is beside the player (angled to face the player). I don't want people moving the camera as you can bug it out the world.[/QUOTE] I am also working on a game mode where the camera is on auto with no player interaction, the way I've been locking the view is to set the player's eye angles every calcview run like this [lua] ply:SetEyeAngles(view.angle) [/lua] I do this at the end of calcview and if the player moves the mouse it shakes the screen but it goes back to where it's supposed to look. There is probably a better way to do this, and hopefully someone else can shed some light on the subject.
  • This is a piece of code taken from Ascension, with maybe slight differences: [lua] function GM:CreateMove(cmd) if LocalPlayer():Alive() then gui.EnableScreenClicker(true) local mx,my = gui.MousePos() local pos = LocalPlayer():GetShootPos():ToScreen() pos = Vector(pos.x,pos.y,0) local ang = (Vector(mx,my,0)-pos):Angle() ang.p = ang.y ang:RotateAroundAxis(Vector(0,0,1),180) local move = cmd:GetSideMove() cmd:SetForwardMove(0) cmd:SetSideMove(0) if mx < pos.x then ang.y = 0 cmd:SetForwardMove(-move) else ang.y = 180 cmd:SetForwardMove(move) end cmd:SetViewAngles(ang) end end [/lua] It will take care of all the movement and camera related issues.
  • Avatar of ralle105
  • [QUOTE=marvincmarvin;34643606][lua]local Colors = { border = Color( 255, 255, 255, 255), background = Color( 255, 255, 255, 200 ), shade = Color( 255, 255, 255, 255 ), fill = Color( 0, 0, 0, 255 )-- , <- This comma does not belong. };[/lua][/QUOTE] It doesn't break anything though, lua just ignores it just like it ignores semi colons.
  • Hello [lua]local NoDrop = {"weapon_real_cs_scout", "weapon_real_cs_flash"} -- Drop blacklist local function DropWeapon(ply) local ent = ply:GetActiveWeapon() if not ValidEntity(ent) then return "" end[/lua] Im trying to add this scout sniper and the flashbang to NoDrop but it doesnt work, any idea whats wrong ?
  • Avatar of werewolf0020
  • has anyone done an sort of prop placing system? kinda like in RTS Games where when you select a building if there are no objects colliding with it and the terrain is flat it changes its colour to green/red i am triying to do someting similar but im kinda stuck showing it about a few metters away from the player Sight and well..Spawning/Creating the prop itself on the end point
  • [QUOTE=werewolf0020;34658178]has anyone done an sort of prop placing system? kinda like in RTS Games where when you select a building if there are no objects colliding with it and the terrain is flat it changes its colour to green/red i am triying to do someting similar but im kinda stuck showing it about a few metters away from the player Sight and well..Spawning/Creating the prop itself on the end point[/QUOTE] I don't quite understand where you are stuck, but the way I would make something like this is set up some kind of a grid system for the map and then either setting how many squares a building takes up or using the collision bounds of that prop and then checking if these squares around the prop are already occupied or not. I could draw it in paint if you need me to clarify.
  • Avatar of pennerlord
  • Is it possible to make a rope between a prop and a swep that is hold by a player? My code: [lua] function SWEP:PrimaryAttack() local ent = self:CreateTaser() local phys = ent:GetPhysicsObject() if not phys:IsValid() then return end phys:SetVelocity(self.Owner:GetAimVector() * 3000) -- Rope start local ent1, ent2 = ent, self local wPos1, wPos2 = ent1:GetPos(), ent2:GetPos() local length = (wPos1 - wPos2):Length() local constraint, rope = constraint.Rope(ent1, ent2, 0, 0, Vector(0,0,0), Vector(0,0,0), length, 1000, 0, 3, "cable/cable", false) -- Rope end end [/lua] However when I'm using "self.Owner" instead of "self" it's working, but the rope is parented to the player and not his weapon.