• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
Does Lerp delay the rest of the code from executing the first time it's ran? Sometimes when I refresh my cl_init file and press the scoreboard key straight away the scoreboard stays there.
[QUOTE=LUModder;47328464]Is there a way I can ping a server without 1. Being on it 2. SourceQuery because I do not have a webserver I can host it on Trying to add it to my menu so I can check if one of the server's I'm always on is up or not.[/QUOTE] [url]https://www.gametracker.com/servers/[/url]
[QUOTE=kulcris;47328586][url]https://www.gametracker.com/servers/[/url][/QUOTE] I'm trying to add it to my main menu so if one of the server's I go to is down, it'll tell me.
[QUOTE=Robotboy655;47326602]There's a setting in wiremod that does this.[/QUOTE] Not sure what it is, unfortunately.
[QUOTE=LUModder;47328464]Is there a way I can ping a server without 1. Being on it 2. SourceQuery because I do not have a webserver I can host it on Trying to add it to my menu so I can check if one of the server's I'm always on is up or not.[/QUOTE] [url]http://wiki.garrysmod.com/page/serverlist/Query[/url] It's what the Garry's mod default menu uses, too. Only problem with it is, it's in the menu realm.
Im making a custom money printer, but people with long usernames seem to overflow the bounds that they should, Does anyone know how to take a string(username) and see if it is beyond a certain length(X) and remove all the characters after that point? So [I]Reallylongusername[/I] would become [I]Reallylong[/I] depending on what X was. Thank you! =)
[QUOTE=Deathbypwnage;47329494]Im making a custom money printer, but people with long usernames seem to overflow the bounds that they should, Does anyone know how to take a string(username) and see if it is beyond a certain length(X) and remove all the characters after that point? So [I]Reallylongusername[/I] would become [I]Reallylong[/I] depending on what X was. Thank you! =)[/QUOTE] [code] str = str:sub(1, X) [/code]
I'm trying to make a toolgun STool that attaches a rope from the player's toolgun muzzle (vector) to wherever the player shoots the toolgun. I don't want to attempt a SWEP as I'm just testing some things out. I tried converting the toolgun muzzle vector to a vector local to the player, but that didn't work. The code is pretty horrible, so I'm sure someone will point out some stupidly obvious mistake. It's like the wiremod laser, except it's a rope that needs an entity to attach to (the player) and a vector local to the player to change the position of it. And no, I don't want to render a line as the laser does. [CODE] local viewm = self:GetOwner():GetViewModel() local obj = viewm:LookupAttachment( "muzzle" ) local muzzlepos = viewm:GetAttachment( obj ) local muzzlevector = muzzlepos["Pos"] local noangle = Angle( 0, 0, 0 ) local betatest = WorldToLocal( muzzlevector, noangle, self:GetOwner():GetPos(), noangle ) Rope = constraint.Rope(self:GetOwner(), trace.Entity, 0, trace.PhysicsBone or 0, betatest, trace.Entity:WorldToLocal(trace.HitPos), (self:GetOwner():GetPos()+Vector(0, 0, 35)):Distance(trace.HitPos), 0, 0, 20, "MATERIAL PATH", false) [/CODE] Note that isn't all the code of the tool (obviously), and this part is inside TOOL:LeftClick, with a few if statements to stop the rope being unjoinable to the target and such.
[QUOTE=MPan1;47332144]I'm trying to make a toolgun STool that attaches a rope from the player's toolgun muzzle (vector) to wherever the player shoots the toolgun. I don't want to attempt a SWEP as I'm just testing some things out. I tried converting the toolgun muzzle vector to a vector local to the player, but that didn't work. The code is pretty horrible, so I'm sure someone will point out some stupidly obvious mistake. It's like the wiremod laser, except it's a rope that needs an entity to attach to (the player) and a vector local to the player to change the position of it. And no, I don't want to render a line as the laser does. [CODE] local viewm = self:GetOwner():GetViewModel() local obj = viewm:LookupAttachment( "muzzle" ) local muzzlepos = viewm:GetAttachment( obj ) local muzzlevector = muzzlepos["Pos"] local noangle = Angle( 0, 0, 0 ) local betatest = WorldToLocal( muzzlevector, noangle, self:GetOwner():GetPos(), noangle ) Rope = constraint.Rope(self:GetOwner(), trace.Entity, 0, trace.PhysicsBone or 0, betatest, trace.Entity:WorldToLocal(trace.HitPos), (self:GetOwner():GetPos()+Vector(0, 0, 35)):Distance(trace.HitPos), 0, 0, 20, "MATERIAL PATH", false) [/CODE] Note that isn't all the code of the tool (obviously), and this part is inside TOOL:LeftClick, with a few if statements to stop the rope being unjoinable to the target and such.[/QUOTE] Well this is awkwardly similar to exactly what I am planning on [I]trying[/I] to achieve in the next couple of days as part of a bigger project. Don't know how to do it as well though because I didn't look into it yet. Also interested.
I have a question regarding tables and usergroups. If i have a table like this: [CODE] local users = { [ "admin" ] = Color( 255, 0, 0, 255 ) [ "superadmin" ] = Color( 0, 255, 0, 255 ) } [/CODE] how can i make it so if player is admin then return admin color in chat.AddText()? else if the player is superadmin then return superadmin color, etc etc. Thanks in advance :)
[lua]users[ply:GetUserGroup()][/lua]? We don't know the structure of whatever admin mod you are using so we can't really help much.
[QUOTE=G4MB!T;47332210][lua]users[ply:GetUserGroup()][/lua]? We don't know the structure of whatever admin mod you are using so we can't really help much.[/QUOTE] Ulx, so by just adding users[ ply:GetUserGroup() ] it will auto return the color?
VIoxtar, what are you trying to do with a rope and the toolgun? I want to make sure I'm not going to be copying an already existing idea if I get help from you (or figure it out myself) Ooh, if it's a toolgun lasso instead of a weld, that'd be interesting... (not what I'm trying to do by the way, I just saw that you were making a gamemode based on sandbox)
[QUOTE=Invule;47332215]Ulx, so by just adding users[ ply:GetUserGroup() ] it will auto return the color?[/QUOTE] kinda, your code should look like this: [lua] if ( ply and users[ply:GetUserGroup()] ) then chat.AddText ( users[ply:GetUserGroup()], text ) end [/lua]
Works like a charm, thanks guys.
Actually, nevermind. I think I might have figured it out myself (but I'm not sure, gotta check). [editline]16th March 2015[/editline] Yep, still not working.
[QUOTE=MPan1;47332144]-snip-[/QUOTE] Try this: [code] local vStartPos = self.Owner:GetAimVector() local bone = self.Owner:LookupBone("ValveBiped.Bip01_Head1") local tr = util.TraceLine( { start = vStartPos, endpos = vStartPos * 1000, filter = self.Owner, } ) if ( bone ) then local objRope = constraint.Rope(self.Owner, tr.Entity, bone, tr.PhysicsBone or 0, (self.Owner:GetPos()+Vector(0, 0, 35)), tr.Entity:WorldToLocal(tr.HitPos), self.Owner:GetPos():Distance( tr.Entity:GetPos() ), 0, 20, "MATERIAL PATH", false) end [/code] untested and there are probably some mistakes in there but i did my best with your code and the wiki. this should ( hopefully ) attach a rope from your head to the entity ( din't know the hand bone name :v: )
Anyone know the easiest way to figure out if a vector is in your visleaf client-side? Preferably without the use of entities.. I know about [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/VisibleVec]Entity:VisibleVec[/url], but it's server-side only.
If _R is undefined, can you still define it yourself as debug.getregistry()?
- snipped, my fault -
How can you set a player's speed when walking (+walk)?
[QUOTE=cam_;47333457]How can you set a player's speed when walking (+walk)?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SetWalkSpeed]Player:SetWalkSpeed[/url] ?
[QUOTE=ms333;47333490][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SetWalkSpeed]Player:SetWalkSpeed[/url] ?[/QUOTE] That sets the speed for normally walking (without sprinting or walking, just typical every-day movement). Which is what makes it hard to find what I'm looking for.
You can set up a bind that attaches to +walk and -walk that sets the walk speed. I'm doing this for my gamemode with +speed and +attack2. The functions you need: Player:KeyDown (or pressed/released) The enum you need: IN_WALK [url]http://wiki.garrysmod.com/page/Enums/IN[/url] I prefer using SetPlayerSpeed and having both inputs be equal, that way they can't mix binds and the speed bind to go faster. [url]http://wiki.garrysmod.com/page/GM/SetPlayerSpeed[/url]
[QUOTE=cam_;47332764]If _R is undefined, can you still define it yourself as debug.getregistry()?[/QUOTE] Yes
Thank you both. I have another question, though :v: I have this in cl_init.lua [code]local DontDraw = { "CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo", "CHudSuitPower" } function GM:HudShouldDraw(huditem) if(DontDraw[huditem])then return false; end end[/code] It's not working. I don't understand why. I feel like this is exactly how the wiki does it essentially.
[QUOTE=cam_;47333929]Thank you both. I have another question, though :v: I have this in cl_init.lua [code]local DontDraw = { "CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo", "CHudSuitPower" } function GM:HudShouldDraw(huditem) if(DontDraw[huditem])then return false; end end[/code] It's not working. I don't understand why. I feel like this is exactly how the wiki does it essentially.[/QUOTE] It's HUDShouldDraw not HudShouldDraw - case matters.
Wish I could rate myself dumb. :suicide:
[QUOTE=cam_;47334040]Wish I could rate myself dumb. :suicide:[/QUOTE] [del]I believe you can :v:[/del]
Now, with the caps fixed, it works but it also prevents my GM:HUDPaint() from running? :downs:
Sorry, you need to Log In to post a reply to this thread.