• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
A question more than a problem, but I want to know which addon is more lightweight and likely to perform better on a server when put under stress? I want custom vehicles that are as lightweight as possible. Edit: Wow, I shouldn't post at 4am anymore. The addons I'm trying to choose between are TDMCars and SCars. Also, unrelated question - is it best to test things you are developing on a 2 player listen server or singleplayer, if you plan on eventually adding them to a dedi?
[QUOTE=scipherneo;45656264]A question more than a problem, but I want to know which addon is more lightweight and likely to perform better on a server when put under stress? I want custom vehicles that are as lightweight as possible. Edit: Wow, I shouldn't post at 4am anymore. The addons I'm trying to choose between are TDMCars and SCars. Also, unrelated question - is it best to test things you are developing on a 2 player listen server or singleplayer, if you plan on eventually adding them to a dedi?[/QUOTE] Local SRCDS install, I wouldn't really trust coding in singleplayer or listen servers. Sometimes things fuck up, and I have no clue why.
If I use SetColour on a player, it usually does their face too which is a little odd. Is there another method to colour players where it just does clothing or whatever you can do in the sandbox C menu? I have a feeling there is and probably do know this, but my mind is blank.
[QUOTE=NiandraLades;45657816]If I use SetColour on a player, it usually does their face too which is a little odd. Is there another method to colour players where it just does clothing or whatever you can do in the sandbox C menu? I have a feeling there is and probably do know this, but my mind is blank.[/QUOTE] ply:SetPlayerColor(Vector(r,g,b)) r,g,b has to be between 0.0 and 1.0
[QUOTE=Arizard;45656031]Are you using TTF ?[/QUOTE] Not actually...Now that you mention this, it's blacklisted on workshop items...But anyway, i had this issue with EUROCAPS.TTF [editline]11th August 2014[/editline] [QUOTE=scipherneo;45656264] Also, unrelated question - is it best to test things you are developing on a 2 player listen server or singleplayer, if you plan on eventually adding them to a dedi?[/QUOTE] Don't code on a SP game...You always will be server, and you will adapt your code for that, and this could cause problems after you test it on a DEDI Don't code on Listen when you need to work on stuff that require communication with gmod folder itself like data won't work, because you'll be the server and other people will be the client Also few functions on SWEP won't be called properly You really should setup your SRCDS like phoenix said
I cannot seem to remove a clientside model. They don't die from ENT:Remove() or SafeRemoveEntity(ENT) and they return userdata if printed (What even is userdata?) Any idea how I would remove clientside models?
[QUOTE=a1steaksa;45659459]I cannot seem to remove a clientside model. They don't die from ENT:Remove() or SafeRemoveEntity(ENT) and they return userdata if printed (What even is userdata?) Any idea how I would remove clientside models?[/QUOTE] Show us your code.
[QUOTE=EvacX;45659648]Show us your code.[/QUOTE] I don't want to fill the page or anything so the code is here: [url]http://pastebin.com/PagnxDQv[/url] [editline]11th August 2014[/editline] False alarm I fixed it with a ply:Alive(). You know when you spend an entire afternoon rewriting something because what needed to be clientside was serverside and then it doesn't work and you can't figure out why so you try things that make sense but then you run out of those and begin making wild furious changes until you basically lose your shit and go to bed angry until the next day when you try again and can't get it so you post to facepunch and immediately after posting to facepunch you solve the problem but it might be too late to not have strangers on the internet make fun of your code? Yeah that's a terrible feeling.
I heard some people mentioning "fixing map inefficiencies with clientside Lua". Does anyone know what they were talking about?
how should I check if all the tablevalues in one table are the same? any ideas?
Not sure if there is a better way, but you could try this. [LUA] function table.SameValues( tbl ) local lastCheck = NULL for _, value in pairs( table ) do if( lastCheck == NULL ) then lastCheck = value continue end if( lastCheck ~= value ) then return false end lastCheck = value end return true end [/LUA] Edit: Eh, in-case of a table as the value you might want to keep looping through them too. :(
[QUOTE=frietje2008;45660332]how should I check if all the tablevalues in one table are the same? any ideas?[/QUOTE] [url]http://snippets.luacode.org/snippets/Deep_Comparison_of_Two_Values_3[/url]
Does anybody know if there is a way to make weapons switching with mouse wheel disabled? Basically in my server mouse wheel is used for something else and I would need weapons to be only switched by pressing numbers. Thanks!
I'm trying to make an npc that the player can talk to. So far everything works except the model is stuck in T-Pose as opposed to having the idle animation. Can anyone tell me where I went wrong? [lua] self:SetModel( self.Model ) local sequence = self:LookupSequence("idle") self:SetSequence(sequence) self.Entity:PhysicsInit( SOLID_BBOX ) self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_BBOX ) self:DrawShadow(true) self.Entity:SetCollisionGroup( COLLISION_GROUP_NONE ) self.Entity:SetUseType(ONOFF_USE) self.Entity:DropToFloor() self.DieTime = CurTime() + 30[/lua]
[QUOTE=solid_jake;45660973]I'm trying to make an npc that the player can talk to. So far everything works except the model is stuck in T-Pose as opposed to having the idle animation. Can anyone tell me where I went wrong? [lua] self:SetModel( self.Model ) local sequence = self:LookupSequence("idle") self:SetSequence(sequence) self.Entity:PhysicsInit( SOLID_BBOX ) self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_BBOX ) self:DrawShadow(true) self.Entity:SetCollisionGroup( COLLISION_GROUP_NONE ) self.Entity:SetUseType(ONOFF_USE) self.Entity:DropToFloor() self.DieTime = CurTime() + 30[/lua][/QUOTE] idle must not be a valid sequence I guess? print the sequence variable.
[QUOTE=AnonTakesOver;45661887]idle must not be a valid sequence I guess? print the sequence variable.[/QUOTE] Of course, it was printing -1 it was lineidle, not just idle. Useful to you
Im making a custom HUD and currently I have it Show The Health, The Current Armor/Suit, now what I need is for it to show the ammo, I read up on [url]http://wiki.garrysmod.com/page/Player/GetAmmoCount[/url] about get ammo count but the functions I see there don't seem to work, here is my cl_init.lua: [CODE]//Custom HUD Start local function HUD() local ply = LocalPlayer() if ( not IsValid( ply ) ) then return end local ply = LocalPlayer() local HP = ply:Health() local Armor = ply:Armor() local Ammo = 0 local YEL = Color( 255, 150, 0 ) local ADMINCOL = Color( 255, 236, 66 ) local WHT = Color( 255, 255, 255 ) local BLUG = Color( 0, 166, 99 ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) + 235 , ScrH() - 115, 240, 40, Color( 40, 40, 40, 255 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) - 235 , ScrH() - 115, 240, 40, Color( 40, 40, 40, 255 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) - 240, ScrH() - 80, 720, 45, Color( 30, 30, 30, 255 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6), ScrH() - 185, 240, 115, Color( 30, 30, 30, 255 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) + 20 - 235, ScrH() - 105, 200, 20, Color( 255, 255, 255, 15 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) + 20 - 235, ScrH() - 105, math.Clamp( Armor, 1, 100 )*2, 20, Color( 0, 172, 221, 255 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) + 20 + 235, ScrH() - 105, 200, 20, Color( 255, 255, 255, 15 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) + 20 + 235, ScrH() - 105, math.Clamp( Ammo, 1, 100 )*2, 20, YEL ) draw.DrawText("Armor", "DebugFixed", (ScrW() / 4) + (ScrW() / 6) + 50 - 235, ScrH() - 105, Color( 255, 255, 255, 255 ),TEXT_ALIGN_CENTER) draw.DrawText( Armor, "DebugFixed", (ScrW() / 4) + (ScrW() / 6) + 80 -235, ScrH() - 105, Color( 255, 255, 255, 255 ),TEXT_ALIGN_CENTER) draw.DrawText("(Broken)", "DebugFixed", (ScrW() / 4) + (ScrW() / 6) + 520 - 235, ScrH() - 105, Color( 255, 255, 255, 255 ),TEXT_ALIGN_CENTER) draw.DrawText( Ammo, "DebugFixed", (ScrW() / 4) + (ScrW() / 6) + 550 -235, ScrH() - 105, Color( 255, 255, 255, 255 ),TEXT_ALIGN_CENTER) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) - 230, ScrH() - 70, 700, 20, Color( 255, 255, 255, 15 ) ) draw.RoundedBox( 4, (ScrW() / 4) + (ScrW() / 6) - 230, ScrH() - 70, math.Clamp( HP, 1, 100 )*7, 20, Color( 255, 41, 33, 255 ) ) draw.DrawText("Health", "DebugFixed", (ScrW() / 4) + (ScrW() / 6) - 200, ScrH() - 70, Color( 255, 255, 255, 255 ),TEXT_ALIGN_CENTER) draw.DrawText( HP, "DebugFixed", (ScrW() / 4) + (ScrW() / 6) - 150, ScrH() - 70, Color( 255, 255, 255, 255 ),TEXT_ALIGN_CENTER) draw.TexturedQuad { texture = surface.GetTextureID "vgui/logo", color = Color(255, 255, 255, 255), x = (ScrW() / 4) + (ScrW() / 6) + 20, y = ScrH() - 215, w = 200, h = 180 } end hook.Add( "HUDPaint", "HUD", HUD ) //Custom HUD End[/CODE] (I know its probably un-neat and also probably bad coding, but im a beginner :eng101: and we all start/started somewhere.) Hope Someone can help! -Jacklin
[QUOTE=In response to Jacklin_G, WalkingZombie;45662767]:words:[/QUOTE] Uh... SWEP:Clip1() returns the amount of ammo in that weapon's magazine. [code]local clipLoad = LocalPlayer():GetActiveWeapon():Clip1()[/code] SWEP:Ammo1() returns the amount of ammo the player has in reserve for that weapon. Of course, if more than one gun uses pistol ammo it'll return the same value. [code]local ammoReserve = LocalPlayer():GetActiveWeapon():Ammo1()[/code] you could also do [code]local ammoReserve = LocalPlayer():GetAmmoCount( LocalPlayer():GetActiveWeapon().Primary.Ammo )[/code] of course, that'd look neater if you used more variables, such as [code]local ply = LocalPlayer() -- You used this already local wep = LocalPlayer():GetActiveWeapon() local ammo = wep.Primary.Ammo[/code]
Is there any way to check if an entity has been deleted on the same frame without needing to do some really hacky shit involving detouring Entity.Remove? IsValid still returns true until the next frame when the entity gets truly deleted. edit: Entity:IsEFlagSet( EFL_KILLME ) should accomplish what I want but it doesn't seem to return true even after Entity.Remove has been called?
How do I set a console variable in Lua? For instance, I want to make phys_timescale 0.1, or sv_cheats 1, or player_old_armor 1, even host_timescale 0.5. I know there's a menu in SandBox where you can change a few, but I can't find the code!
[QUOTE=Joeyl10;45663804]Is there any way to check if an entity has been deleted on the same frame without needing to do some really hacky shit involving detouring Entity.Remove? IsValid still returns true until the next frame when the entity gets truly deleted.[/QUOTE]Perhaps you could hook into EntityRemoved?
[QUOTE=ShadowRanger;45664021]Perhaps you could hook into EntityRemoved?[/QUOTE] I think EntityRemoved was the reason the IsValid change got reverted in the first place.
how would I go about creating a scroll panel with a horizontal scroll bar?
[QUOTE=jack10685;45665523]how would I go about creating a scroll panel with a horizontal scroll bar?[/QUOTE] if you want just a horizontal scrollbar, look into [url=https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dhorizontalscroller.lua]DHorizontalScroller[/url] if you want horizontal and vertical, you have to make it yourself
[QUOTE=a1steaksa;45626081]:words:[/QUOTE] try using [lua] ENT.RenderGroup = RENDERGROUP_TRANSLUCENT; function ENT:DrawTranslucent() end [/lua]
I am creating a new traitor weapon but it uses allot of entities so I don't want heaps of traitors purchasing the weapon and causing lag when using it. What would be the best way to go about making a Traitor weapon only purchasable by one person so other players can't purchase it from the Traitor shop / menu. Should I use this older method [url]http://wiki.garrysmod.com/page/Networking_Entities[/url] and create a boolean to check if another player has purchased it.
[QUOTE=PortalGod;45665664]if you want just a horizontal scrollbar, look into [url=https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dhorizontalscroller.lua]DHorizontalScroller[/url] if you want horizontal and vertical, you have to make it yourself[/QUOTE] I ended up making the system to where it does not need a scrollbar, but I will remember this for future use :)
Ok I'm using derma adjustable model panel and having troubles moving the model and zooming on it. Don't have any code in on my phone but what get I use. Half the Time it's almost outside the panel :L
Whats the difference between playing sound in serverside and clientside, I mean does not serverside sound pathname being send to client and client plays sound?
it's which players play the sound. When you play a sound serverside, all clients will hear it. When you play a sound on the client, the clients on which the code is run will hear the sound.
Sorry, you need to Log In to post a reply to this thread.