[QUOTE=NeatNit;52119732][lua]if x and y then
-- do stuff
end
y = not x[/lua][/QUOTE]
[URL="https://github.com/Mysterypancake1/GMod-Binding/commit/1edf45cb9edfb62ba745902c36b8985b1ce4c2f7"]That made it a hell of a lot shorter[/URL], thanks so much!
[QUOTE=MPan1;52122540][URL="https://github.com/Mysterypancake1/GMod-Binding/commit/1edf45cb9edfb62ba745902c36b8985b1ce4c2f7"]That made it a hell of a lot shorter[/URL], thanks so much![/QUOTE]
Cache the result of input.IsButtonDown so you don't have to call it twice.
[QUOTE=MPan1;52122540][URL="https://github.com/Mysterypancake1/GMod-Binding/commit/1edf45cb9edfb62ba745902c36b8985b1ce4c2f7"]That made it a hell of a lot shorter[/URL], thanks so much![/QUOTE]
[del]Hey, listen. You're going to completely hate me and yourself for this. I'm really, truly sorry for what I'm about to say.
You're reinventing the [url=http://wiki.garrysmod.com/page/Category:numpad]numpad library[/url].[/del]
Oh, numpad is serverside and your library is clientside. Okay then!
[QUOTE=code_gs;52123252]Cache the result of input.IsButtonDown so you don't have to call it twice.[/QUOTE]
I doubt it'll make that much of a difference but THE FASTER THE BETTER
[editline]19th April 2017[/editline]
[QUOTE=NeatNit;52123457]You're reinventing the [url=http://wiki.garrysmod.com/page/Category:numpad]numpad library[/url][/QUOTE]
the only thing I'm reinventing is the meaning of bad hacky code - hopefully nobody will need to use it unless they're really lazy like me
Perhaps I made a mistake of already having made a new thread for this, but here goes:
Hello,
I am looking for a way to return the available bodygroups of a certain model, specified either by a model string (like [url]http://wiki.garrysmod.com/page/Global/NumModelSkins[/url] does for skins) or directly from an already created [url]http://wiki.garrysmod.com/page/Category:SpawnIcon[/url].
I know that the SpawnIcon contains a [url]http://wiki.garrysmod.com/page/Category:ModelImage[/url] panel, but I do not see a way to access the entity contained within it.
Is this impossible to do? If so, what would you recommend to do instead? I was thinking of creating an invisible [url]http://wiki.garrysmod.com/page/Category:DModelPanel[/url] using the model string and get the bodygroups from that via [url]http://wiki.garrysmod.com/page/Entity/GetBodyGroups[/url].
What would be a reason for a server to crash with the error
"Model models/props_lab/huladoll.mdl not found and models/error.mdl couldn't be loaded"
When both of the models load fine on the server and seem to end up not being so fine around 8 - 10 hours later?
[QUOTE=DevKin;52124615]Perhaps I made a mistake of already having made a new thread for this, but here goes:
Hello,
I am looking for a way to return the available bodygroups of a certain model, specified either by a model string (like [url]http://wiki.garrysmod.com/page/Global/NumModelSkins[/url] does for skins) or directly from an already created [url]http://wiki.garrysmod.com/page/Category:SpawnIcon[/url].
I know that the SpawnIcon contains a [url]http://wiki.garrysmod.com/page/Category:ModelImage[/url] panel, but I do not see a way to access the entity contained within it.
Is this impossible to do? If so, what would you recommend to do instead? I was thinking of creating an invisible [url]http://wiki.garrysmod.com/page/Category:DModelPanel[/url] using the model string and get the bodygroups from that via [url]http://wiki.garrysmod.com/page/Entity/GetBodyGroups[/url].[/QUOTE]
Have you checked [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/GetModelInfo]util.GetModelInfo[/url]? The output isn't actually documented on the wiki (I'll try to do this tonight, at work now) but it might give you the data you need.
Edit: If that fails and you end up using your second approach, you should just use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/ClientsideModel]ClientsideModel[/url]. That's what DModelPanel uses internally.
[QUOTE=NeatNit;52124680]-snip-[/QUOTE]
Thank you very much for the help, it's exactly what I was looking for!
LOL selling lua is killing gmod amirite
[highlight](User was banned for this post ("Why reply" - Reagy))[/highlight]
I'm trying to make some Pointshop 1 code to replace a SWEP with another SWEP, but only if a specific SWEP is equipped or picked up, I've tried this:
[CODE]function ITEM:OnEquip(ply)
if ply:HasWeapon( "weapon_name" ) then
ply:StripWeapon('weapon_name')
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
end[/CODE]
This only works if the weapon is currently in use (not just in your inventory) when you buy the SWEP in Pointshop.
I also tried this:
[CODE]function ITEM:PlayerCanPickupWeapon(psply, mods, ply, wep)
if (psply == ply and wep:GetClass() == "weapon_name") then
ply:Give(self.WeaponClass)
wep:Remove()
return false
end
end[/CODE]
This works perfectly, but everytime the replaced SWEP is dropped from inventory, infinite replacements of "weapon_name" are created in inventory and this issue never goes away even if the SWEP is holstered in Pointshop.
I'm not sure how to fix this, I've tried a combination of both, but then the purchase does nothing.
:snip:
I am trying to generate multiple entities within close proximity of each other, without overlapping. Such as a grouping of trees or rocks. I can't figure out how to achieve this... It sounds simple in my mind but I can't figure it out. What kind of math would I use, or is there some kind of algorithm that might help?
Is it possible to utilize an entity already on a map if it has a target name? I want to know so I can attach a menu to it on touch.
How best can I change the speed at which a player accelerates when walking/sprinting? This needs to be able to have a unique value for every player, so sv_accelerate isn't an option.
So I'm a bit of a novice at lua scripting but I'm trying my best to teach myself. I've got a bit of an issue that I've tried to crack but I cant figure it out.
Basically, I have a scoreboard addon that has a few buttons on it that can make functions happen, I have another separate addon that brings up a taunt menu if someone presses the C key but I cant seem to get it to be called by pressing the button on the scoreboard.
Its not really essential but its just really bugging me that I cant make it work more than anything.
Scoreboard button code:
(I set it to false to disable it until I fix it)
[CODE] {
control = "C",
description = "Taunt Menu",
color = Color(64, 105, 126, 190),
colorHover = Color(64, 105, 126, 240),
enabled = false,
func = function()
end
},[/CODE]
[QUOTE=orcywoo6;52132051]So I'm a bit of a novice at lua scripting but I'm trying my best to teach myself. I've got a bit of an issue that I've tried to crack but I cant figure it out.
Basically, I have a scoreboard addon that has a few buttons on it that can make functions happen, I have another separate addon that brings up a taunt menu if someone presses the C key but I cant seem to get it to be called by pressing the button on the scoreboard.
Its not really essential but its just really bugging me that I cant make it work more than anything.
Scoreboard button code:
(I set it to false to disable it until I fix it)
[CODE] {
control = "C",
description = "Taunt Menu",
color = Color(64, 105, 126, 190),
colorHover = Color(64, 105, 126, 240),
enabled = false,
func = function()
end
},[/CODE][/QUOTE]
You could use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/InternalKeyCodeTyped]gui.InternalKeyCodeTyped[/url]
If the taunt menu is opened while holding down C then closed while letting go of C, I guess you could add in a concommand clientside or any other function to open the menu in the taunt addon and just call that with LocalPlayer():ConCommand("commandyoumadeit")
I figured this out, painfully simple.
[CODE]
function ITEM:OnEquip(ply, modifications)
timer.Create("weaponcheck_"..ply:SteamID(), 1, 0, function()
if ply:HasWeapon( "weapon_name" ) then
ply:StripWeapon('weapon_name')
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
end)
end
function ITEM:OnHolster(ply)
timer.Destroy("weaponcheck_"..ply:SteamID())
end
[/CODE]
Could anyone here suggest the best way to draw 2d textures between 2 vectors in PostDrawOpaqueRenderables? (cant wrap my head around attempting this)
I'm looking for something that uses a similar method to render.DrawBeam. (Without the specific rounded object)
So...Do you want to draw a poly?
How do i center text around a certain point?
As you can see here, some of the text on my scoreboard is not centered to the label above it. If i change the length of the text underneath the label, it's no longer centered:
[IMG]https://puu.sh/vsl0j/5e3ec56bc0.png[/IMG]
Here i changed the name of the "Gang", now the text is no longer centered:
[IMG]https://puu.sh/vslcC/f4ce8e0f8c.png[/IMG]
How do i go about fixing that?
Post code for the label creation
[QUOTE=MPan1;52135419]Post code for the label creation[/QUOTE]
It's using draw.SimpleText
[code]draw.SimpleText("Gang", "scoreboard.info", w - 350, 115, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) [/code]
[QUOTE=SkitZz;52135428]It's using draw.SimpleText
[code]draw.SimpleText("Gang", "scoreboard.info", w - 350, 115, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) [/code][/QUOTE]
Try:
[code]draw.SimpleText("Gang", "scoreboard.info", w - 350, 115, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) [/code]
[QUOTE=Promptitude;52135449]Try:
[code]draw.SimpleText("Gang", "scoreboard.info", w - 350, 115, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) [/code][/QUOTE]
Did not change anything, sadly.
Any way to remove the boosting from vehicles without editing the scripts?
[QUOTE=bilbasio;52137497]Any way to remove the boosting from vehicles without editing the scripts?[/QUOTE]
In setupmove check if they're pressing shift, if they are then remove it from their keys pressed.
why does my function to detect even numbers lag? :frown:
[url]https://pastebin.com/6VM92i4H[/url]
[QUOTE=kaliii;52138406]why does my function to detect even numbers lag? :frown:
[url]https://pastebin.com/6VM92i4H[/url][/QUOTE]
you sir, have just made my day
[url]https://www.lua.org/manual/5.1/manual.html#2.5.1[/url]
[QUOTE=Promptitude;52138310]In setupmove check if they're pressing shift, if they are then remove it from their keys pressed.[/QUOTE]
Thank you.
Hey. I want to create combat scripts and movement scripts without using a weapon, but rather by using hooks. Is this possible?
Example: Hooking KEY_Q to be shot forward at 5000 ups.
I've done something like this before, for [del]opening a menu[/del] picking up objects and placing them in an inventory. I used input.IsKeyDown and net.Send / net.Receive
I guess my real question is, I need to know how well this would Synchronize online.
Sorry, you need to Log In to post a reply to this thread.