• What do you need help with? V3
    6,419 replies, posted
Is render.SetScissorRect supposed to work in 3D2D?
I'm working on some swep in which I need to change holdtypes when I hold mouse2 button, the problem is that when I change it from "normal" to "revolver", the holdtype stance just won't update in MP when I look at other players, it's still "normal" instead of "revolver". Any help?
- snip -
Ok Guys Im Going To Solve All Of Your Problems With One Link [url]http://www.lua.org/pil/[/url]
Hello, I have an entity, and everything works fine, but when I undone this, I get this error. [CODE][Drivable Halo Pelican] lua/entities/pelican/init.lua:55: attempt to index field 'Pilot' (a nil value) 1. DoKill - lua/entities/pelican/init.lua:55 2. unknown - lua/entities/pelican/init.lua:80[/CODE] If anyone can help me please, here's the init.lua: [HTML]AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') local DESTROYABLE=true local HEALTH=500 local FLAMETRAIL=false local HOVERMODE=true local soundx=Sound("ambient/atmosphere/undercity_loop1.wav") function ENT:SpawnFunction( ply, tr) local SpawnPos = tr.HitPos + tr.HitNormal * 100 local ent = ents.Create( "pelican" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() self.Entity:SetNetworkedInt("health",HEALTH) if (!self.Sound) then self.Sound = CreateSound( self.Entity, soundx ) end self.Entity:SetUseType( SIMPLE_USE ) self.Firee=nil self.Inflight=false self.Pilot=nil self.Entity:SetModel("models/pelican.mdl") self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() phys:SetMass(10000) end self.Entity:StartMotionController() self.Accel=0 self.Roll=0 end function ENT:DoKill() local effectdata = EffectData() effectdata:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", effectdata, true, true ) self.Sound:Stop() self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetNetworkedBool("isDriveShuttle",false) self.Pilot:SetPos(self.Entity:GetPos()+Vector(0,0,100)) end function ENT:OnTakeDamage(dmg) if self.Inflight and DESTROYABLE and not self.Done then local health=self.Entity:GetNetworkedInt("health") self.Entity:SetNetworkedInt("health",health-dmg:GetDamage()) local health=self.Entity:GetNetworkedInt("health") if health<1 then self.Entity:DoKill() self.Done=true self.Entity:Remove() end end end function ENT:OnRemove() if (self.Sound) then self.Sound:Stop() end self.Entity:DoKill() end function ENT:Think() if not IsValid(self.Pilot) then self.Pilot=nil self.Inflight=false end if self.Inflight and self.Pilot and self.Pilot:IsValid() then if self.Sound then self.Sound:ChangePitch(math.Clamp(self.Entity:GetVelocity():Length()/5,1,200),0.001) end self.Pilot:SetPos(self.Entity:GetPos()) if self.Pilot:KeyDown(IN_USE) then self.Sound:Stop() self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetNetworkedBool("isDriveShuttle",false) self.Pilot:SetPos(self.Entity:GetPos()+Vector(0,0,200)) self.Accel=0 self.Inflight=false if self.Firee then self.Firee:Remove() end self.Entity:SetLocalVelocity(Vector(0,0,0)) self.Pilot=nil end self.Entity:NextThink(CurTime()) else self.Entity:NextThink(CurTime()+1) end return true end function ENT:Use(ply,caller) if not self.Inflight then self.Sound:Play() self.Entity:GetPhysicsObject():Wake() self.Entity:GetPhysicsObject():EnableMotion(true) self.Inflight=true self.Pilot=ply ply:Spectate( OBS_MODE_ROAMING ) ply:DrawViewModel(false) ply:DrawWorldModel(false) ply:StripWeapons() ply:SetNetworkedBool("isDriveShuttle",true) ply:SetNetworkedEntity("Shuttle",self.Entity) if not FLAMETRAIL then return end self.Firee = ents.Create("env_fire_trail") if !self.Firee then return end self.Firee:SetKeyValue("spawnrate","3") self.Firee:SetKeyValue("firesprite","sprites/firetrail.spr" ) self.Firee:SetPos(self.Entity:GetPos()) self.Firee:SetParent(self.Entity) self.Firee:Spawn() self.Firee:Activate() end end function ENT:PhysicsSimulate( phys, deltatime ) if self.Inflight then local hovering=false if HOVERMODE and self.Pilot:KeyDown(IN_SPEED) then hovering=true end self.Entity:SetNetworkedBool("hover",hovering) local num=0 if self.Pilot:KeyDown(IN_ATTACK) then num=700 elseif self.Pilot:KeyDown(IN_ATTACK2) then num=-700 elseif self.Pilot:KeyDown(IN_FORWARD) then num=700 end if self.Pilot:KeyDown(IN_MOVELEFT) then //self.Roll=self.Roll-3 elseif self.Pilot:KeyDown(IN_MOVERIGHT) then //self.Roll=self.Roll+3 end phys:Wake() self.Accel=math.Approach(self.Accel,num,10) if self.Accel>-200 and self.Accel < 200 and not self.Pilot:KeyDown(IN_ATTACK) and not self.Pilot:KeyDown(IN_ATTACK2) and not self.Pilot:KeyDown(IN_FORWARD) and not hovering then return end local pr={} pr.secondstoarrive = 1 pr.pos = self.Entity:GetPos()+self.Entity:GetForward()*self.Accel pr.maxangular = 5000 pr.maxangulardamp = 10000 pr.maxspeed = 1000000 pr.maxspeeddamp = 10000 pr.dampfactor = 0.8 pr.teleportdistance = 5000 local ang = self.Pilot:GetAimVector():Angle() ang.r=ang.r+self.Roll pr.angle = ang if self.Pilot:KeyDown(IN_SPEED) then if HOVERMODE and num>0 then pr.angle=self.Entity:GetAngles() elseif not HOVERMODE then pr.angle=self.Entity:GetAngles() end end pr.deltatime = deltatime phys:ComputeShadowControl(pr) end end[/HTML]
[QUOTE=runamagic;38219059]file.Read("basics.txt","DATA") Is this line wrong? I put my file to ..\content\data\basics.txt[/QUOTE] Correct me if I'm wrong but AFAIK "DATA" doesn't include mounted games/addons/gamemode content. You're going to have to use file.Read("data/basics.txt", "GAME").
I have an entity that cannot find its shared.lua for some reason. "Couldn't include file 'shared.lua' (File not found) (@addons/goremod/lua/entities/chappi_gib/cl_init.lua (line 1))" Here's cl_init: [CODE]include('shared.lua') function ENT:Draw() self:DrawModel() end[/CODE]
[QUOTE=G4MB!T;38221011]pitty you removed me :) its tmysql.query not tsql:Query[/QUOTE] I'm using tmysql4 so its tsql:Query. And i asked for your help and you were being a dick.
[IMG]http://img7.imageshack.us/img7/1490/omfogf.png[/IMG] uhuhhh yeah ok... Just a quick lua question because I'm a noob modifying the chat box.. How to have quotes around whatever a player says example Dude: "hehyuehyeuhy"
[QUOTE=ColonelTwisty;38224091][IMG]http://img7.imageshack.us/img7/1490/omfogf.png[/IMG] uhuhhh yeah ok... Just a quick lua question because I'm a noob modifying the chat box.. How to have quotes around whatever a player says example Dude: "hehyuehyeuhy"[/QUOTE] Something like this should do it: [lua] hook.Add("PlayerSay", "PlayerSayQuotes", function(ply,text) return "\""..text.."\"" end) [/lua]
[QUOTE=ColonelTwisty;38224091][IMG]http://img7.imageshack.us/img7/1490/omfogf.png[/IMG] uhuhhh yeah ok... Just a quick lua question because I'm a noob modifying the chat box.. How to have quotes around whatever a player says example Dude: "hehyuehyeuhy"[/QUOTE] also [url]http://wiki.garrysmod.com/page/Lua/Tutorials[/url]
I'm just wondering, How do I make an object glow like the physgun?
Hm I had to miss something, but self.Entity:SetUseType(SIMPLE_USE) gives me errors [code] [ERROR] lua/entities/gb_base.lua:57: attempt to call method 'SetUseType' (a nil value) 1. unknown - lua/entities/gb_base.lua:57 [/code] This is the part of my code [code] self.Entity:SetModel(self.Model) self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetUseType( SIMPLE_USE ) [/code]
[QUOTE=Failure;38224953]Hm I had to miss something, but self.Entity:SetUseType(SIMPLE_USE) gives me errors [code] [ERROR] lua/entities/gb_base.lua:57: attempt to call method 'SetUseType' (a nil value) 1. unknown - lua/entities/gb_base.lua:57 [/code] This is the part of my code [code] self.Entity:SetModel(self.Model) self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetUseType( SIMPLE_USE ) [/code][/QUOTE] What's the entities base & type?
It's a base for other entities and it's at the same time base_anim.
[QUOTE=LegoGuy;38224353]I'm just wondering, How do I make an object glow like the physgun?[/QUOTE] Hello? did people skip this?
[QUOTE=LegoGuy;38225500]Hello? did people skip this?[/QUOTE] [url]http://wiki.garrysmod.com/page/Libraries/halo/Add[/url]
[QUOTE=Failure;38224953]Stuff and use type error[/QUOTE] Just saying, you don't need self.Entity, just use self. The self.Entity thing is old and deprecated.
[ERROR] gamemodes/terrortown/gamemode/cl_custommenu.lua:65: attempt to index global 'vgui' (a nil value) [PHP] function dermapanels( vgui, Create, vgui.Create, DermaPanel, DFrame) local DermaPanel = vgui.Create( "DFrame" ) -- Creates the frame itself DermaPanel:SetMouseInputEnabled(true) DermaPanel:SetKeyboardInputEnabled(true) DermaPanel:SetPos( 50,50 ) -- Position on the players screen DermaPanel:SetSize( 1000, 900 ) -- Size of the frame DermaPanel:SetTitle( "Sarnat Admin Menu" ) -- Title of the frame DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) -- Draggable by mouse? DermaPanel:ShowCloseButton( true ) -- Show the close button? DermaPanel:MakePopup() -- Show the frame local DermaButton = vgui.Create( "DButton" ) DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel" DermaButton:SetText( "Kill yourself" ) DermaButton:SetPos( 25, 50 ) DermaButton:SetSize( 130, 30 ) DermaButton.DoClick = function () RunConsoleCommand( "kill" ) -- What happens when you press the button end local DermaButton = vgui.Create( "DButton" ) DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel" DermaButton:SetText( "(Out Of Order)" ) DermaButton:SetPos( 25, 100 ) DermaButton:SetSize( 130, 30 ) DermaButton.DoClick = function () RunConsoleCommand( "ping" ) -- What happens when you press the button end local DermaFart = vgui.Create( "DButton", LocalPlayer ) DermaFart:SetParent( DermaPanel ) -- Set parent to our "DermaPanel" DermaFart:SetText( "Let everyone know you're admin" ) DermaFart:SetPos( 25, 150 ) DermaFart:SetSize( 150, 50 ) DermaFart.DoClick = function () LocalPlayer:SetName("An Admin") end local MenuButton = vgui.Create("DButton") MenuButton:SetParent( DermaPanel ) MenuButton:SetText( "Kick Player(RCON)" ) MenuButton:SetPos(25, 200) MenuButton:SetSize( 150, 50 ) MenuButton.DoClick = function ( btn ) for k,v in pairs(player.GetAll()) do MenuButtonOptions:AddOption(v:Nick(), function( v ) RunConsoleCommand( "rcon_password ronan123;rcon kick " .. v:Nick() .. "") end) -- Add lines MenuButtonOptions:Open() -- Open the menu AFTER adding your options end end end[/PHP] ples halp
[QUOTE=Willox;38225704][url]http://wiki.garrysmod.com/page/Libraries/halo/Add[/url][/QUOTE] Alright... now how do I use it for a my entity?
Em, anyone know why my server's addon may not be loading? There's no errors or anything ( YES I DID CHANGE info.txt TO addon.txt )...
Anyone know if SetModelScale has been replaced or something? It has a bad argument with #2, number expected, got no value...or something. [CODE]local Kicking = v.Kicking if GetViewEntity() == v and Kicking and v.StopKick and v.StopKick > CurTime() then if v.CreateLegs == nil then v.CreateLegs = ClientsideModel("models/weapons/v_kick.mdl", RENDERGROUP_TRANSLUCENT) v.CreateLegs:Spawn() v.CreateLegs:SetPos(v:GetShootPos()) v.CreateLegs:SetAngles(v:EyeAngles()) v.CreateLegs:SetParent(v) v.CreateLegs:SetNoDraw(false) v.CreateLegs:DrawModel() v.CreateLegs:SetPlaybackRate( 1 ) v.CreateLegs.LastTick = CurTime() else v.CreateLegs:SetPos(v:GetShootPos()) v.CreateLegs:SetAngles(v:EyeAngles()) v.CreateLegs:SetModelScale(Vector(1, 1, 1)) v.CreateLegs:FrameAdvance( CurTime() - v.CreateLegs.LastTick ) v.CreateLegs:DrawModel() v.CreateLegs.LastTick = CurTime() end elseif v.CreateLegs and GetViewEntity() != v or Kicking and v.StopKick and v.StopKick < CurTime() then v.CreateLegs:SetNoDraw(true) v.CreateLegs:SetPos(Vector(0, 0, 0)) v.CreateLegs:SetAngles(Angle(0,0,0)) v.CreateLegs:SetRenderOrigin(Vector(0, 0, 0)) v.CreateLegs:SetRenderAngles(Angle(0,0,0)) v.CreateLegs:SetModelScale(Vector(0, 0, 0)) v.CreateLegs = nil v.Kicking = false end end end[/CODE]
[QUOTE=Jayden;38223999]I'm using tmysql4 so its tsql:Query. And i asked for your help and you were being a dick.[/QUOTE] Because no one wants to help you setup perp for gmod
[QUOTE=RonanZer0;38227048][ERROR] gamemodes/terrortown/gamemode/cl_custommenu.lua:65: attempt to index global 'vgui' (a nil value) ... ples halp[/QUOTE] Okay, I'll try. [lua]function dermapanels( vgui, Create, vgui.Create, DermaPanel, DFrame)[/lua] What? [lua]local DermaFart = vgui.Create( "DButton", LocalPlayer )[/lua] What? Why are you putting LocalPlayer as the second arg? [lua]LocalPlayer:SetName("An Admin")[/lua] LocalPlayer() <- needs () Also, there is no line 65 in that code nor is there any indication as to which line is line 65. My guess is if that particular error is showing up you're including it serverside. In which case, don't include it serverside.
[QUOTE=LegoGuy;38227151]Alright... now how do I use it for a my entity?[/QUOTE] You can use it within a think hook, so it could be as simple as: [lua] function ENT:Think() effects.halo.Add(self, Color(0, 0, 255), 5, 5, 2) end [/lua]
[QUOTE=Jayden;38223999]i asked for your help and you were being a dick.[/QUOTE] He's trying to be one of those elitist lua assholes, when in reality he's not all that great of a scripter.
[QUOTE=Fidchell;38227498]Anyone know if SetModelScale has been replaced or something? It has a bad argument with #2, number expected, got no value...or something. [CODE][/QUOTE] SetModelScale doesn't take a Vector anymore it takes two numbers, one is the scale and the second is the delta time for scale change ie: [lua]v.CreateLegs:SetModelScale(Vector(1, 1, 1))[/lua] becomes: [lua] v.CreateLegs:SetModelScale(1, 1)[/lua] old: [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexcdfe.html[/url] new: [url]http://wiki.garrysmod.com/page/Classes/Entity/SetModelScale[/url]
You want the second number to be 0 actually otherwise you're changing it over the course of 1 second.
[ERROR] gamemodes/terrortown/gamemode/cl_hackmenu.lua:5: attempt to call field 'Create' (a nil value) *same code but fixed*
[QUOTE=JustSoFaded;38228442]He's trying to be one of those elitist lua assholes, when in reality he's not all that great of a scripter.[/QUOTE] 0 for 1 :)
Sorry, you need to Log In to post a reply to this thread.