• What do you need help with? V3
    6,419 replies, posted
Don't override it, just hook into it. [editline]22nd August 2012[/editline] Is there anyway to remove a key and then sort them back so that when tbl[1] is removed tbl[2]'s key is set to tbl[1]?
table.remove(yourTable, 1);
I need to do some kind of decapitation script, on a server file... I know that most of the methods I'll have to use are client side, and I am having problems with them. [CODE]target:Kill() local ragdoll = target:GetRagdollEntity() for k, v in ipairs (player.GetAll()) do v:SendLua("local bone = Entity(" .. ragdoll:EntIndex() .. "):GetBoneMatrix(6); bone:Scale(Vector(0, 0, 0)); Entity(" .. ragdoll:EntIndex() .. "):SetBoneMatrix(6, bone)") end[/CODE] It says the entity is NULL.
[QUOTE=walkmanguy;37348194]Sorry Lexic, I'm very tired at the time. I'll try to be as detailed as possible. So what the problem is, It's the Middle text that's supposed to appear. And Fade away, there should be two bars like on a 16:9 movie. And gray background until it fades away with that timer. Oh and this is on Gmod13.[/QUOTE] You forgot to create the panel. vgui.Create("darkrp_cinematic_intro")
Is there any possible way to make an entity spawn randomly on a specific material type? I've already attempted but it didn't return the vector fast enough to do so, I already have it so that the entity deletes itself if it doesn't spawn properly but that's just code to make sure it won't fail.
How can I issue console commands on bots? I thought you could do that before but it seems you can't anymore.
Quick question, on my gamemode one of my beta testers showed me that some icons on the menus, (they are materials) were black. I do not have this issue connecting through srcds, I even redownloaded the materials from the server and still do not have black materials. Does anyone know why this is happening or what completely Black Materials mean? [B]Edit: [/B]He is getting ShaderAPIDX8::CreateD3DTexture: Invalid color format! errors. I don't. However, I can view these materials perfectly fine. [B]Edit: [/B] Never mind, figured it out. It dealt with the materials .vtf compression. The ones he couldn't see were ABGR8888, while the ones he could see were BGRAB8888. Odd. lol
Hey guys, I was wondering if there's any way to increase the limit of the prop search results. Currently it's capped to 128 props. I tried looking for myself and eventually found a file called "SearchGuts.lua", and in it, this: [CODE]/*--------------------------------------------------------- ModelSearch ---------------------------------------------------------*/ function ModelSearch( SearchString, iLimit ) [I]iLimit = iLimit or 128[/I] SearchString = SQLStr( SearchString, true ) local result = sql.Query( "SELECT modelname FROM searchcache WHERE modelname LIKE '%"..SearchString.."%' LIMIT "..iLimit ) if (!result) then return {} end local ret = {} for k, v in pairs( result ) do table.insert( ret, v.modelname ) end table.sort( ret ) return ret end[/CODE] Tried changing the 128 to 512, but no luck, ideas? Thanks in advance.
Change it to [lua]iLimit = 512[/lua]
[QUOTE=Banana Lord.;37367036]Change it to iLimit = 512[/QUOTE] I gave it a go, unfortunately it didn't work. Should I post the entire file?
Anyone care to explain how sound.Add works?
[QUOTE=Crap-Head;37371131]Anyone care to explain how sound.Add works?[/QUOTE] [url]http://wiki.garrysmod.com/page/Libraries/sound/Add[/url] might be of help.
Could someone explain to me the difference between using ply:Spawn() and ply:Respawn() on a player to spawn them at the end of the round? Would one have a different effect than the other? The reason I ask: I'm using this script to find player spawn points: [lua] function GM:PlayerSelectSpawn( pl ) local ctspawns = ents.FindByClass("info_player_counterterrorist") local tspawns = ents.FindByClass("info_player_terrorist") local random_1 = math.random(#ctspawns) local random_2 = math.random(#tspawns) if pl:Team() == 2 then return tspawns[random_2] elseif pl:Team() == 1 then return ctspawns[random_1] end end [/lua] and I'm currently spawning the player with ply:Spawn() in another function Sometimes, players spawn at places where there is no spawn point. Can anyone see why? Do I need to adjust the math.random parameter? I don't even get an error in the console, it just spawns them where their free spectate camera was (they go to free spectate when they die). It doesn't happen every round, but in each round probably about 1 in 10 players spawn incorrectly. Thanks!
[url]http://glua.me/search/?keywords=Entity.Respawn[/url]
Yeah I read that, it just doesn't seem to tell the different effect over what Spawn does. Spawn can be used on an already Spawned entity, too. This is where my confusion stems from Cheers
I think Respawn is for entities and not players
I was under the impression Players were subclasses of entities?
[QUOTE=Trumple;37373614]I was under the impression Players were subclasses of entities?[/QUOTE] yes but from the description I can't imagine good things can happen by calling Respawn on a player [editline]23rd August 2012[/editline] [code]Banana Lord ran Lua 'print(_R.Player.Respawn)' nil[/code]
[QUOTE=Banana Lord.;37373880]yes but from the description I can't imagine good things can happen by calling Respawn on a player [editline]23rd August 2012[/editline] [code]Banana Lord ran Lua 'print(_R.Player.Respawn)' nil[/code][/QUOTE] Ah, ok thanks
Atm I'm trying to create a simple entity with sphere physics, it has an effect attached to it so I can see where it is, but the problem is; I can't see it anywhere.. Even if I create it right in front of myself floating in mid air. (It won't set the position) It works perfectly in single player, but when I change it to multiplayer it won't work. This is its Initialize() function: [code]function ENT:Initialize() local d = self:GetDiameter(); local r = d / 2; self.Entity:PhysicsInitSphere(r) self.Entity:SetCollisionBounds(Vector(-r, -r, -r),Vector(r, r, r)) self.Entity:SetMoveType(MOVETYPE_VPHYSICS); local phys = self.Entity:GetPhysicsObject(); if (phys:IsValid()) then phys:SetMass(1); phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG); phys:AddGameFlag(FVPHYSICS_NO_PLAYER_PICKUP); phys:EnableGravity(false); phys:Wake(); end local fx = EffectData(); fx:SetOrigin(self.Entity:GetPos()); fx:SetEntity(self.Entity); util.Effect(self:GetProjectileEffect(), fx); self:GetOwner():EmitSound(self:GetCastSound()); end[/code] Also it's set to have a constant velocity in a direction, which appears to work just fine! I have a swep that fires it forward, and when it collides; the collision effect works just fine and where it's suppose to be. So it's like the entity isn't being created properly or something? Here's what I'm using to create it: (By the way, CreateMagic is only being called server side.) [code]-- Being called by SWEP:PrimaryAttack() within an if (SERVER) statement. function SWEP:Cast() local Caster = self.Owner; if (!ValidEntity(Caster)) then return; end local EyeAngle = Caster:EyeAngles(); local Forward = EyeAngle:Forward(); local Right = EyeAngle:Right(); local Up = EyeAngle:Up(); local Source = Caster:GetPos() + (Caster:Crouching() and Caster:GetViewOffsetDucked() or Caster:GetViewOffset()) Source = Source + (Forward * 32) + (Right * 9) + (Up * -1); self:CreateMagic(Source, EyeAngle, Caster); end[/code] [code]function SWEP:CreateMagic(Source, Angles, Caster) local Spell = ents.Create("ent_spell_projectile"); if (!ValidEntity(Spell)) then return; end local SpellData = { Caster = self.Owner, Damage = 10, Velocity = 500, Scale = 8, ProjectileEffect = "fire", CollideEffect = "fire_explode", CastSound = "dungeonsiege/spell/fireball_cast.wav", CollideSound = "dungeonsiege/spell/fireball_hit.wav" }; Spell:SetupTable(SpellData); Spell:SetPos(Source); Spell:SetAngles(Angles); Spell:Spawn(); Spell:Activate(); return Spell; end[/code]
Remind me what the proper way of detecting GM13 is? I've been checking if net ~= nil, but I'm pretty sure there's a _VERSION or something global.
[img]http://puu.sh/YlTm[/img] _VERSION is the Lua version
If you guys could help me, I'm having a bit of a problem but I didn't want to make a thread for it seeing as it doesn't seem like something worth it. Anyway, how would I go about adding icons next to users on my server that display what rank they are? I already made the icons, I just need to put them next to the player's name when you press TAB to display them, such as putting my "ADMIN" icon next to my name.
[QUOTE=Splambob;37347320]Here's a weird problem (or maybe it isn't, I can't explain it); Sometimes the arrow-texture I'm using in Holopad becomes corrupt. The texture fixes itself if I change to another texture and then switch back; Those fuzzy blobs at the end of each line should be coloured arrows. Here's the draw code I'm using; [lua] surface.SetTexture(surface.GetTextureID("holopad/arrowup_solid")) surface.SetDrawColor(colour) surface.DrawLine(centrepos.x, centrepos.y, pos.x, pos.y) surface.DrawTexturedRectRotated(pos.x, pos.y, 16, 16, ang) [/lua] And here's the texture in question (all the textures I use for the arrow suffer from this problem, and are similar) [url=https://dl.dropbox.com/u/902553/Misc%20Files/arrowup_solid.zip]arrowup_solid.zip[/url] I know this isn't much to go on but I really don't have any other info to give, I'm at a loss here.[/QUOTE] try setting a local for the surface.GetTextureID("holopad/arrowup_solid"), i don't think its a good idea to use it in the paint hook.
It is held as a local in a table elsewhere, I put that in there to cut down on the amount of code you guys would have to read. Sorry about that, I guess that bit me in the ass :v:
How do I convert from a language identifier, eg "SMG1_Grenade", to the nice name?
[QUOTE=Drakehawke;37390343]How do I convert from a language identifier, eg "SMG1_Grenade", to the nice name?[/QUOTE] [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index1c47.html"]language.Add[/URL]
[QUOTE=Coffeee;37390825][URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index1c47.html"]language.Add[/URL][/QUOTE] Yeah, but then what do I do to convert from the identifier to the nice name when I want to display it? Example: [img]http://puu.sh/YqVa[/img]
Whenever changing the position of a DImage it dupes the image. [img]http://cloud.steampowered.com/ugc/900972751221460341/C17FAAE5DF14FA38A7D3D356A3A671B2C576ADD2/1024x480.resizedimage[/img] [lua]local icon_man = vgui.Create("DImage") icon_man:SetImage( "vrondakis/man" ) icon_man:SetSize(32,64) icon_man:SetPos(calc)[/lua] How do I fix this?
Can you post some more code? It looks there like you're recreating it every frame..
Sorry, you need to Log In to post a reply to this thread.