• What do you need help with? V3
    6,419 replies, posted
  • Avatar of Pyth
  • [QUOTE=Mrkrabz;34553151]You will need to define ply in init.lua, for example local ply = self.Entity.dt.owning_ent (This is for my entity) Then do [lua]ply:PrintMessage( HUD_PRINTCENTER, "Out of bounds!")[/lua] Where are you calling that in init.lua?[/QUOTE] [url=http://pastebin.com/n3zb3hxT]Don't think I am, but then nothing should work, right?[/url] [editline].[/editline] Putting this in init.lua [lua] --on player death function player_initdeath( ply, wep, killer ) ply:PrintMessage( HUD_PRINTCHAT, ply:Nick() .. " has fallen off of the stage.\n") ply:PrintMessage( HUD_PRINTCENTER, "Out of bounds!") end [/lua] makes the printcenter appear but not the printchat. Sorry to everyone who's cringing, heh.
  • [QUOTE=Pyth;34553311][url=http://pastebin.com/n3zb3hxT]Don't think I am, but then nothing should work, right?[/url] [editline].[/editline] Putting this in init.lua [lua] --on player death function player_initdeath( ply, wep, killer ) ply:PrintMessage( HUD_PRINTCHAT, ply:Nick() .. " has fallen off of the stage.\n") ply:PrintMessage( HUD_PRINTCENTER, "Out of bounds!") end [/lua] makes the printcenter appear but not the printchat. Sorry to everyone who's cringing, heh.[/QUOTE] The server is calling this function player_initdeath( ply, wep, killer ) function, so ply is registered as the server. If the player was to call that function, ply would be the player.
  • Avatar of ralle105
  • Mrkrabz it's nice that you're trying to help but you obviously have no idea what you're talking about.
  • [QUOTE=ralle105;34556311]Mrkrabz it's nice that you're trying to help but you obviously have no idea what you're talking about.[/QUOTE] Uhr, I've had the same problem in my gamemode and I fixed it by doing local owner = w/e, then doing owner: to send the message. ply would not work because obviously the client didn't call it itself, defining the entity's owner as the client (ply) worked. Also, if you were going to put that, why not also be useful and post the "real" fix for him.
  • Avatar of #NaN
  • [QUOTE=Mrkrabz;34556341]Uhr, I've had the same problem in my gamemode and I fixed it by doing local owner = w/e, then doing owner: to send the message. ply would not work because obviously the client didn't call it itself, defining the entity's owner as the client (ply) worked. Also, if you were going to put that, why not also be useful and post the "real" fix for him.[/QUOTE] What the hell are you talking about? "PlayerDeath" is a serverside function. How should the client call it?
  • [QUOTE=pennerlord;34556408]What the hell are you talking about? "PlayerDeath" is a serverside function. How should the client call it?[/QUOTE] Also no, I read wrong, he put the PlayerDeath function into a clientside file. When the player dies the server calls that function with ply being the player that died. I do understand it however I got confused where he put it into a clientside file.
  • Avatar of ralle105
  • Ah, I apologise for the misunderstanding then. There doesn't seem to be anything wrong with that code so I'm guessing you have another hook somewhere further down uverwriting that one.
  • Avatar of #NaN
  • [QUOTE=aurum481;34558405]How do I get if prop is frozen or unfrozen?[/QUOTE] PhysObj.IsMoveable [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index951b.html?title=PhysObj.IsMoveable[/url] [editline].[/editline] [IMG]http://kingsofbrawl.net63.net/forum/Smileys/default/ninjad.gif[/IMG]
  • [QUOTE=aurum481;34558405]How do I get if prop is frozen or unfrozen?[/QUOTE] Try this [lua] function _R.Entity:IsFrozen() local phys = self:GetPhysicsObject() return (phys:IsValid() and not phys:IsMoveable()) end [/lua]
  • Avatar of shadowndacorner
  • [QUOTE=aurum481;34558405]How do I get if prop is frozen or unfrozen?[/QUOTE] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index13b6.html?title=Entity.SetMoveType[/url]
  • Avatar of G-Enigma
  • I'm going to try to keep this simple, in hopes of someone actually being able to help. Basically, assuming that the v_model itself has both animations and that they work (probably), is there any reason that this: [CODE]function SWEP:Deploy() if ( self.Weapon:Clip1() > 0 ) then self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) else self.Weapon:SendWeaponAnim( ACT_VM_DRAW_EMPTY ) end end[/CODE] would not work? Because its playing ACT_VM_DRAW even when the launcher is out of ammo, which is something it shouldn't be doing. Any help would be appreciated :suicide:
  • 1. What would be the best way to draw a border of a [B]rounded[/B] rectangle? Drawing another rounded rectangle atop of the "border rectangle" blends the two colors together if alpha is below 255. Perhaps anyone can give me tips on how to achieve this? 2. I decided to scoure and optimize my gamemode's code. I remember that garry's code had variables such as these ... [lua] local table = table local string = string local umsg = umsg local concommand = concommand [/lua] ... defined. Can anyone explain as to why? Does it make the code run faster?
  • Avatar of ralle105
  • 1. Somebody made a rounded rectangle alternative using surface.DrawPoly (don't remember who, sorry) You could use that along with the stencil buffer. [lua] render.ClearStencil() render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS) render.SetStencilPassOperation(STENCILOPERATION_REPLACE) render.SetStencilWriteMask(1) render.SetStencilReferenceValue(1) --Draw center rect render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL) --Draw outline rect [/lua] 2. You have to do that in modules to place the variables in the modules local environment (modules don't have access to the global environment unless you create them using the package.seeall parameter)
  • Avatar of _nonSENSE
  • [QUOTE=Panto;34572190]1. What would be the best way to draw a border of a [B]rounded[/B] rectangle? Drawing another rounded rectangle atop of the "border rectangle" blends the two colors together if alpha is below 255. Perhaps anyone can give me tips on how to achieve this?[/QUOTE] Divran sent me a [URL="https://wiremod.svn.sourceforge.net/svnroot/wiremod/trunk/wire/lua/entities/gmod_wire_egp/lib/objects/roundedboxoutline.lua"]code sample[/URL] for an outlined rounded box. Credits to sk8 and Divran.
  • Avatar of Rimbas
  • How do I get a Stools owner? Swep works with self.Owner but I can't seem to do that with Stool.
  • Avatar of Fishbrain
  • [IMG]http://www.adamncasey.co.uk/upload/image/3839/d/o/[/IMG] How can I make this so when I press the Pistols category the Submachine gun category will move down so it doesn't get in the way?
  • Avatar of JustSoFaded
  • [QUOTE=ralle105;34572310]1. Somebody made a rounded rectangle alternative using surface.DrawPoly (don't remember who, sorry) You could use that along with the stencil buffer. [lua] render.ClearStencil() render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS) render.SetStencilPassOperation(STENCILOPERATION_REPLACE) render.SetStencilWriteMask(1) render.SetStencilReferenceValue(1) --Draw center rect render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL) --Draw outline rect [/lua] 2. You have to do that in modules to place the variables in the modules local environment (modules don't have access to the global environment unless you create them using the package.seeall parameter)[/QUOTE] Was that to me or to Panto? Also, if it was to Panto, how would you suggest doing a gradient outlined rect (I ask you because you seem to be pretty knowledgeable in the rendering section)?
  • Avatar of R@Rdeathmatch
  • Is there any tutorial how to make a scoreboard from 0% ?? I mean how to make it to open, how to show the player name,death,ping,kill.
  • Avatar of Drakehawke
  • [QUOTE=R@Rdeathmatch;34587103]Is there any tutorial how to make a scoreboard from 0% ?? I mean how to make it to open, how to show the player name,death,ping,kill.[/QUOTE] I've never been able to find a decent tutorial on it. Take a look at the GMod Lua source and how it's done in sandbox (for how to make one using custom vgui) or base (for how to make a simple one using just surface/draw). I recommend you use the custom vgui method, when I made mine I used surface/draw and then when I went to improve it and add more features, I had to convert it all to custom vgui anyway. But if you're new to Lua vgui can be quite hard to understand.
  • Avatar of R@Rdeathmatch
  • [QUOTE=Drakehawke;34587520]I've never been able to find a decent tutorial on it. Take a look at the GMod Lua source and how it's done in sandbox (for how to make one using custom vgui) or base (for how to make a simple one using just surface/draw). I recommend you use the custom vgui method, when I made mine I used surface/draw and then when I went to improve it and add more features, I had to convert it all to custom vgui anyway. But if you're new to Lua vgui can be quite hard to understand.[/QUOTE] I creat all ready the VGUI but I don't know how to add Name,Score,Play Time,Ping and 2 other thing. [b]This is how is looking for moment = [/b] [img]http://cloud.steampowered.com/ugc/614975698525714821/7689DDE65B4DD0A93F0A918EFBC945A7917561E2/[/img]
  • Avatar of Drakehawke
  • Create a vgui panel for a players row, then loop through all the created players and create a panel for each one and add it to your scoreboard.
  • Avatar of Fishbrain
  • [QUOTE=Fishbrain;34575836][IMG]http://www.adamncasey.co.uk/upload/image/3839/d/o/[/IMG] How can I make this so when I press the Pistols category the Submachine gun category will move down so it doesn't get in the way?[/QUOTE] Anyone help me on this?
  • Avatar of R@Rdeathmatch
  • [QUOTE=Fishbrain;34588765]Anyone help me on this?[/QUOTE] Nobody answered to your first post.And now you quoted your own post ? [editline]7th February 2012[/editline] [QUOTE=Fishbrain;34588765]Anyone help me on this?[/QUOTE] I think if someone would answers to this 1 :D
  • Avatar of Fishbrain
  • Ermm yes because I would like to know a way to fix this seen as though I'm sure it's not hard.