[QUOTE=wauterboi;52462233]How would I separate vertexes into surfaces? That's what I'm stuck on right now. I can make cubes just fine because I can control the order of points, but if someone is going to delete an edge then I'm very unsure of how to handle that.[/QUOTE]
You should change a long list of verticies into structs that order the points for you. In Lua, that would just be a table with the points in whichever order (CC or CCW) you want to draw them in.
Is there an easy way to change the "brightness" of a color?
Converting the color using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/ColorToHSV]ColorToHSV[/url] and then changing one of the HSV values, followed by changing it back, doesn't seem to do much.
[QUOTE=thelurker1234;52459531]De-compiling shouldn't be necessary because it's already a player-model (at models/player/charple.mdl)
Moreover, when the model has been set before the player is killed, the corpse behaves as it should.
[vid]https://s.gvid.me/s/2017/07/11/playermodelcharp.webm[/vid][/QUOTE]
Did you re-create the physics object of the ragdoll so it uses the correct settings? I may be wrong but it's a possibility.
[QUOTE=mib999;52462517]Did you re-create the physics object of the ragdoll so it uses the correct settings? I may be wrong but it's a possibility.[/QUOTE]
I just changed the model of the ragdoll after it was ragdoll'd.
Creating a new ragdoll in its place after deleting the old one just sets it in T-Pose. Plus, we'd have to re-assign all the data from the previous ragdoll like who killed it etc. Though, the priority right now is just changing the model without it freaking out.
[QUOTE=Fillipuster;52462508]Is there an easy way to change the "brightness" of a color?
Converting the color using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/ColorToHSV]ColorToHSV[/url] and then changing one of the HSV values, followed by changing it back, doesn't seem to do much.[/QUOTE]
[url]https://github.com/Facepunch/garrysmod/pull/1202[/url]
I'm having a small problem when playing a run anim using CalcMainActivity, it work fine but when the player walk and turn at the same time the speed go up and the anim play, anyway to stop it when you are walking?
[editline]13th July 2017[/editline]
Nvm added [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/KeyDown]Player:KeyDown[/url] to the check work
I'm making a SWEP that uses a custom model for the worldmodel view.
Simply setting the SWEPs worldmodel to the correct model, places the model in the center of the player's torso.
How would I go about positioning it correctly? Is it done in the modelling phase or the lua phase?
[QUOTE=Fillipuster;52464863]I'm making a SWEP that uses a custom model for the worldmodel view.
Simply setting the SWEPs worldmodel to the correct model, places the model in the center of the player's torso.
How would I go about positioning it correctly? Is it done in the modelling phase or the lua phase?[/QUOTE]
You'll either have to manually position it in a BuildBonePositions callback or add the Bip01_R_Hand bone to the model.
[QUOTE=code_gs;52465249]You'll either have to manually position it in a BuildBonePositions callback or add the Bip01_R_Hand bone to the model.[/QUOTE]
I see, thanks :D I'll ask my modeller about the model bone thing. As for BuildBonePositions, it seems to have to do with the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetupBones]Entity:SetupBones[/url] method, which is clientside. How would I "target" the weapon model specifically and change it's position? And will this change be visible for all clients - it being clientside and all.
Is there a way I can mute a HTML panel?
[QUOTE=Fillipuster;52465270]I see, thanks :D I'll ask my modeller about the model bone thing. As for BuildBonePositions, it seems to have to do with the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetupBones]Entity:SetupBones[/url] method, which is clientside. How would I "target" the weapon model specifically and change it's position? And will this change be visible for all clients - it being clientside and all.[/QUOTE]
Although SetupBones will call BuildBonePositions, it will be called automatically for weapons already. Add the method clientside in the weapon's Initialize method using AddCallback. From there, you transform the position of the gun using SetBonePosition inside of the callback.
Is there anyway to play an animation with SendWeaponAnim twice without have to place the idle anim in the middle? cuz my Idle anim on my swep look odd
[QUOTE=YoutoYokodera;52469964]Is there anyway to play an animation with SendWeaponAnim twice without have to place the idle anim in the middle? cuz my Idle anim on my swep look odd[/QUOTE]
It doesn't necessarily have to be the idle anim, I don't think, just any anim. Let me guess - repeated reloading anims look twitchy?
[QUOTE=Luni;52470102]It doesn't necessarily have to be the idle anim, I don't think, just any anim. Let me guess - repeated reloading anims look twitchy?[/QUOTE]
I have no other anim that look good enough for that sadly
Can someone give me an example of how to do a button in cam 3D2D, please?
Is there a preference when using pairs or ipairs for player.GetAll()?
[QUOTE=PigeonTroll;52471548]Is there a preference when using pairs or ipairs for player.GetAll()?[/QUOTE]
No. Do whatever suits you. Even if you look at the tiny amount of micro-optimization there is to be done there, it doesn't matter with player.GetAll as the table returned will always be relatively small
[QUOTE=PigeonTroll;52471548]Is there a preference when using pairs or ipairs for player.GetAll()?[/QUOTE]
ipairs is generally better for tables like player.GetAll().
[QUOTE=Sean Bean;52471574]ipairs is generally better for tables like player.GetAll().[/QUOTE]
[URL="https://facepunch.com/showthread.php?t=875909"]Not necessarily[/URL], and again - The tiny amount of micro-optimization doesn't matter with such a small table
[URL="https://springrts.com/wiki/Lua_Performance#TEST_9:_for-loops"]Also this[/URL]
[QUOTE=JasonMan34;52471591][URL="https://facepunch.com/showthread.php?t=875909"]Not necessarily[/URL], and again - The tiny amount of micro-optimization doesn't matter with such a small table
[URL="https://springrts.com/wiki/Lua_Performance#TEST_9:_for-loops"]Also this[/URL][/QUOTE]
Neither of those accounts for LuaJIT. ipairs and numeric-for are noticeably more efficient for mid to large-sized tables in GMod.
How do you get a cursor's X & Y separately? DFrame:CursorPos().x doesn't seem to work. I'm using the draw.Circle function found on the wiki to try to get an affect like in [URL="https://facepunch.com/showthread.php?t=1541501"]this thread[/URL].
[CODE]
Btn.DoClick = function()
surface.SetDrawColor(Color(255, 255, 255, 0.50))
draw.NoTexture()
draw.Circle(DFrame:CursorPos().x, DFrame:CursorPos().y, Lerp(1, 0, 20), 360) // I get a "attempt to index a number value" error on this line
end
[/CODE]
[QUOTE=MexicanR;52471840]How do you get a cursor's X & Y separately? DFrame:CursorPos().x doesn't seem to work. I'm using the draw.Circle function found on the wiki to try to get an affect like in [URL="https://facepunch.com/showthread.php?t=1541501"]this thread[/URL].
[CODE]
Btn.DoClick = function()
surface.SetDrawColor(Color(255, 255, 255, 0.50))
draw.NoTexture()
draw.Circle(DFrame:CursorPos().x, DFrame:CursorPos().y, Lerp(1, 0, 20), 360) // I get a "attempt to index a number value" error on this line
end
[/CODE][/QUOTE]
[lua]local x, y = DFrame:CursorPos()[/lua]
[QUOTE=JasonMan34;52471917][lua]local x, y = DFrame:CursorPos()[/lua][/QUOTE]
That removes the error but nothing draws when the button is clicked. Maybe I need to slow the Lerp?
[QUOTE=code_gs;52471637]Neither of those accounts for LuaJIT. ipairs and numeric-for are noticeably more efficient for mid to large-sized tables in GMod.[/QUOTE]
I thought ipairs was being deprecated in Lua?
[QUOTE=Banana Lord.;52471988]I thought ipairs was being deprecated in Lua?[/QUOTE]
The meta method __ipairs is being deprecated in Lua 5.3, maybe you're confusing it with that?
[QUOTE=bigdogmat;52472008]The meta method __ipairs is being deprecated in Lua 5.3, maybe you're confusing it with that?[/QUOTE]
I don't think so - I remember arguments from years ago because ipairs was being deprecated.
[editline]15th July 2017[/editline]
Maybe I am going crazy, idk
[QUOTE=Banana Lord.;52472035]I don't think so - I remember arguments from years ago because ipairs was being deprecated.
[editline]15th July 2017[/editline]
Maybe I am going crazy, idk[/QUOTE]
I also remember that around 2013, but I believe the deprecation was redacted. This thread seems to imply the same thing: [url]http://lua.2524044.n2.nabble.com/ipairs-deprecated-td7647152.html[/url]
What's a simple way to only allow admins to use a command without having to cater to every different permission plugin?
Ideally I want a check that only works for owner/superadmins but allowing moderators wouldn't be the end of the world.
Will player:IsAdmin() work regardless of the server's permission system? If so, will it return true for just superadmins or moderators too?
You can use IsAdmin() or check the permission with [url=https://github.com/glua/CAMI/blob/master/sh_cami.lua]CAMI[/url].
so i have been trying to make message apear on peoples screens if person whit certain steam id joins but i get this error [LUA][ERROR] gamemodes/metro_online/gamemode/init.lua:48: 'then' expected near 'PrintMessage'
1. unknown - gamemodes/metro_online/gamemode/init.lua:0
[/LUA]
code:
[LUA]if ply:SteamID("STEAM_0:0:75977657")
PrintMessage( HUD_PRINTTALK, "I'm new here." )
end[/LUA]
i have it inside GM:PlayerSpawn
Sorry, you need to Log In to post a reply to this thread.