• What do you need help with? V3
    6,419 replies, posted
[QUOTE=mil0001;37803124]Yeah similar but that just gets all the doors with "prop_door_rotating" or whatever it is and would lock all of them. What about specific doors on the map?[/QUOTE] well, the doors would need to have names or some other keyvalue/identifier
I know wiremod has an 'Entity ID' option on the rangers and stuff but couldn't find what it used in lua.
[QUOTE=mil0001;37803124]Yeah similar but that just gets all the doors with "prop_door_rotating" or whatever it is and would lock all of them. What about specific doors on the map?[/QUOTE] [lua] local autolockDoors = { {Vector(), 'model'} } function LockDoors() for k, v in pairs(AutoLockDoors) do for _, ent in pairs(ents.FindInSphere(v[1], 50)) do if (ent:IsDoor() && ent:GetModel() == v[2]) then ent:Fire("lock", "", 0); end end end end function GetEyeTraceInfo( user ) local ent = user:GetEyeTrace().Entity Msg("{Vector(" .. ent:GetPos().x .. ", " .. ent:GetPos().y .. ", " .. ent:GetPos().z .. "), '" .. ent:GetModel() .. "'},\n") end concommand.Add("Get_Info", GetEyeTraceInfo) [/lua]
Fixed it <yay>. I will post it here just in-case someone else has this issue. [lua] for k, v in pairs( _player.GetAll() ) do if (v:Alive() and v:IsPlayer() and v:GetEyeTraceNoCursor().Entity == self) then if( v:GetViewEntity() ) then local teleport = math.random(1, 2); if (teleport == 1) then v:EmitSound("apoc/emily/fear_movesound.mp3", 100, 100) self:SetPos(Vector(-1056.117188, -1054.273682, 256.031250)) elseif (teleport == 2) then v:EmitSound("apoc/emily/fear_movesound.mp3", 100, 100) self:SetPos(Vector(-1241.035889, -277.033936, -81.434555)) end; end; end; end; [/lua]
how the crap do i disable muzzleflashes? i mean the ones caused by ACT_VM_PRIMARYATTACK and such the thing is, in thirdperson, theres nothing in first person, theres a muzzleflash at the point of the thirdperson models muzzle
Hey i was wondering if there is a code out there for TTT that stops damagelogs untill your dead or specatator
how to bind keys to a animation of a SWEP?
The question i asked on page 44 was pretty much stupid, i am now trying to get another code to work (Cremator SNPC) and it is basically not running, the SNPC has no errors but it won't do what it is intended to do. Here's the code for the cremator's immolation beam... [CODE]function ImmolationBeam() self.schdGetToTargetBeam.StartTask( self, task ) local props = ents.FindByClass("prop_physics") local ragdolls = ents.FindByClass("prop_ragdoll") self:SetTarget( ragdolls ) self:SetTarget( props ) local BeamSPos = LookUpAttachment("muzzle") local Beama = ents.Create("env_laser") local Beamb = ents.Create("env_entity_dissolver") Beama:SetPos(ent:GetPos() + Vector( 12.5, 0, 0 )) Beama:SetMaterial("sprites/immolate") Beama:SetDamage(87) Beama:SetDamageType(DMG_DISSOLVE) Beama:Spawn() Beama:SetParent(ent) Beamb:SetPos(ent:GetPos() + Vector( 12.5, 0, 0 )) Beamb:Spawn() Beamb:SetParent(ent) Sound = CreateSound(flameloop, Sound("npc/cremator/flame_loop.wav")) Sound:Play(0.5, 100) timer.Create("immoltimer", 7, 1, Beama:Remove()) Beamb:Remove() Sound:FadeOut() self:EmitSound( "npc/cremator/immolator/plasma_stop.wav" ) end[/CODE] I can't get it to attack props/players/npcs/etc... I have the schedule here: [CODE]function CrematorGetToTargetBeam() local schdGetToTarget = ai_schedule.New( "Cremator get to target" ) schdGetToTarget:EngTask( "TASK_SCRIPT_WALK_TO_TARGET",0) schdGetToTarget:EngTask( "TASK_FACE_TARGET",0) end[/CODE] It just walks around like a retard... it does nothing and cannot be killed... that aside, all i need is advice to get the cremator to use this function.
Can anyone tell me why PLAYER.PlayerModel = "models/player/breen.mdl" Doesn't work to me at gmod13? I'm trying to set the playermodel at classes, everything works expect that. thanks
[QUOTE=Lyoko2;37811978]Can anyone tell me why PLAYER.PlayerModel = "models/player/breen.mdl" Doesn't work to me at gmod13? I'm trying to set the playermodel at classes, everything works expect that. thanks[/QUOTE] PLAYER:SetModel("models/player/breen.mdl") ?
I'm only just starting in Garrysmod Lua coding so... What I'm trying to achieve is when a player hits 40hp or lower, they are unable to sprint, and their walking speed is slowed. [code] function slowonhealth(ply) if ply:Health() >= 40 then ply:SetWalkSpeed(100) ply:SetRunSpeed(150) ply:SetMaxSpeed(250) elseif ply:Health() <= 40 then ply:SetWalkSpeed(150) ply:SetRunSpeed(250) ply:SetMaxSpeed(500) end end [/code] I'm so new to this, and nothing seems to come up when I try any form of search. Pretty much, even after I am down past 40 hp, my speeds do no change at all. Is this an error with my speeds not updating? Or am I on the completely wrong track here. Also, is it true that SprintEnable and SprintDisable don't work?
I'm trying to get a decal to appear at my hitpos when the SAttack button is pressed, but the decal attaches to my player model instead. [CODE]--/SECONDARY ATTACK function SWEP:SecondaryAttack() local trace = self.Owner:GetEyeTrace() trace.endpos = self.Owner:GetPos() + (self.Owner:GetAimVector() * dist) if trace.HitNonWorld then util.BlastDamage(self.Owner, self.Owner, trace.HitPos, 1, 25) end self.Owner:SetPos(self.Owner:GetEyeTrace().HitPos) self.Weapon:EmitSound("weapons/tele/teleport.wav") self.Weapon:SetNextSecondaryFire(CurTime() + 0.2) self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) [B]local Pos1 = self.Owner:GetEyeTrace().HitPos local Pos2 = self.Owner:GetAimVector() util.Decal("blood", Pos1, Pos2)[/B] end[/CODE] I tried this as well [CODE]local pos1 = trace.HitPos + trace.HitNormal local pos2 = trace.HitPos - trace.HitNormal util.Decal("blood", Pos1, Pos2)[/CODE] Any idea on why the decal wont shoot to surfaces?
Does anyone have a temp. fix for file.Find in GMod 13?
How to block the player pressing tab, clicking right mouse button and then using Gmod13's new functions like Drive, Ignite, etc.? It's for a RP gamemode.
I need help converting my gamemode, Hunting Grounds (Extreme Underdone Rewrite) to gmod 13... [url]http://facepunch.com/showthread.php?t=1214376&p=37818452#post37818452[/url] Are my issues I'm currently dealing with.
[QUOTE=Spencer Sharkey;37815007]PLAYER:SetModel("models/player/breen.mdl") ?[/QUOTE] i tried it inside my player class file and it did nothing but lua errors. if i used it wrong then tell me please.
Hi, me again. (Sorry if i'm becoming a bother, i still suck with Lua.) Here's a probably simple problem: I'm trying to make a simple gamemode, but i noticed that i can't set my playernodel. Rather, it shows that model you see in half-life 2 when you turn on firstperson. (The animationless, black statue thing.) Does anyone know why this might happen? I've found no answers on Google.
[url=http://glua.me/search/?keywords=Gamemode.PlayerSetModel][img]http://glua.me/search.png[/img] [b]Gamemode.PlayerSetModel[/b][/url]
[QUOTE=Tetris Reaper;37818009] [code] function slowonhealth(ply) if ply:Health() >= 40 then ply:SetWalkSpeed(100) ply:SetRunSpeed(150) ply:SetMaxSpeed(250) elseif ply:Health() <= 40 then ply:SetWalkSpeed(150) ply:SetRunSpeed(250) ply:SetMaxSpeed(500) end end [/code] [/QUOTE] [code] function slowonhealth(ply) if not IsValid(ply) or not ply:IsPlayer() then return end if ply:Health() <= 40 then ply:SetWalkSpeed(100) ply:SetRunSpeed(150) ply:SetMaxSpeed(250) elseif ply:Health() >= 40 then ply:SetWalkSpeed(150) ply:SetRunSpeed(250) ply:SetMaxSpeed(500) end end hook.Add("EntityTakeDamage","slowthemdownpickthemup",slowonhealth) [/code]
[QUOTE=Banana Lord.;37825103][url=http://glua.me/search/?keywords=Gamemode.PlayerSetModel][img]http://glua.me/search.png[/img] [b]Gamemode.PlayerSetModel[/b][/url][/QUOTE] example please? :smile:
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexfce6-2.html[/url]
[lua] GLOB_SERVER_SK_ID = 2 local host = "******" local port = ****** local user = "******" local pass = "******" local db = "******" require("tmysql") tmysql.initialize(host, user, pass, db, port) function SQL_Sync() for k, v in pairs(player.GetAll()) do if evolve:GetProperty( v:UniqueID(), "PlayTime" ) then tmysql.query("SELECT `steamid` FROM `sv_playtime` WHERE `steamid` = '"..v:SteamID().."' AND `server` = '"..GLOB_SERVER_SK_ID.."'", function( tabled ) if tabled && tabled [1] && tabled[1][1] && tabled[1][1] == v:SteamID() then tmysql.query("UPDATE `sv_playtime` SET `time` = '"..evolve:GetProperty( v:UniqueID(), "PlayTime" ).."', `lastupdate` = '"..os.time().."' `lastname` = '"..tmysql.escape(v:Name()).."' WHERE `steamid` = '"..v:SteamID().."'") else tmysql.query("INSERT INTO `sv_playtime` (`steamid`, `server`, `time`, `lastupdate`, `lastname`) VALUES('"..v:SteamID().."', '"..GLOB_SERVER_SK_ID.."', '"..evolve:GetProperty( v:UniqueID(), "PlayTime" ).."', '"..os.time().."', '"..tmysql.escape(v:Name()).."')") end end) end end end [/lua] Yes, it puts them in the database, Yes, it updates correctly, Problems: 90% of the time calling SQL_Sync() will crash the server. EDIT: Forgot to mention i am using tmysql3
[QUOTE=skullorz;37825785][code] -sniptheuglies- [/code][/QUOTE] [lua]local function SlowOnHealth( t_Player ) if ( !IsValid( t_Player ) || !t_Player:IsPlayer() ) then return; end t_Player:SetWalkSpeed( math.Clamp( t_Maximum.WalkSpeed * ( t_Player:GetMaxHealth() / t_Player:Health() ), t_Minimum.WalkSpeed, t_Maximum.WalkSpeed ) ); t_Player:SetRunSpeed( math.Clamp( t_Maximum.RunSpeed * ( t_Player:GetMaxHealth() / t_Player:Health() ), t_Minimum.RunSpeed, t_Maximum.RunSpeed ) ); t_Player:SetMaxSpeed( math.Clamp( t_Maximum.MaxSpeed * ( t_Player:GetMaxHealth() / t_Player:Health() ), t_Minimum.MaxSpeed, t_Maximum.MaxSpeed ) ); end hook.Add( "EntityTakeDamage", "SlowThemDownPickThemUpFaggotry", SlowOnHealth );[/lua] As ugly as it is, it basically scales their speed slower and slower as their health gets closer to zero. By the way, why would you want the speeds to change when they take damage? :L
[QUOTE=Banana Lord.;37826275][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexfce6-2.html[/url][/QUOTE] The thing is though, i want it to be set via the spawnmenu with the model they chose, like it is by default. How would i go about doing this? Sorry to bother you. :L
Use a program called GCFScape to open up the garry's mod .gcf file of the version you are on (regular or beta), located in your steamapps folder. Browse to the main gamemode folder, and examine the sandbox gamemode's way of doing things. [editline]28th September 2012[/editline] [img]http://i50.tinypic.com/19v7tx.png[/img] Well actually, I couldn't find the code myself. Here's how gm12's base gamemode handles playermodels. [lua]function GM:PlayerSetModel( pl ) local cl_playermodel = pl:GetInfo( "cl_playermodel" ) local modelname = player_manager.TranslatePlayerModel( cl_playermodel ) util.PrecacheModel( modelname ) pl:SetModel( modelname ) end[/lua] If you override playerspawn or playersetmodel while deriving from the base or sandbox you will lose this, and will need to put that code into your own gamemode. player:GetInfo() returns a string result of a client convar. So if a command exists on the client called cl_playermodel, and it is set to some string, player:GetInfo() will return what the client set as the model. The spawnmenu's section for changing your playermodel (wherever that is) sets the client convar to a model corresponding to buttons pressed.
i cant get my head around the shellejection effects can someone post an example script?
[QUOTE=Bletotum;37830562]Use a program called GCFScape to open up the garry's mod .gcf file of the version you are on (regular or beta), located in your steamapps folder. Browse to the main gamemode folder, and examine the sandbox gamemode's way of doing things. [editline]28th September 2012[/editline] Well actually, I couldn't find the code myself. Here's how gm12's base gamemode handles playermodels. [lua]function GM:PlayerSetModel( pl ) local cl_playermodel = pl:GetInfo( "cl_playermodel" ) local modelname = player_manager.TranslatePlayerModel( cl_playermodel ) util.PrecacheModel( modelname ) pl:SetModel( modelname ) end[/lua] If you override playerspawn or playersetmodel while deriving from the base or sandbox you will lose this, and will need to put that code into your own gamemode. player:GetInfo() returns a string result of a client convar. So if a command exists on the client called cl_playermodel, and it is set to some string, player:GetInfo() will return what the client set as the model. The spawnmenu's section for changing your playermodel (wherever that is) sets the client convar to a model corresponding to buttons pressed.[/QUOTE] Thanks, that helps alot. :3 I figured there was a way to get the model selection, but never could have guessed where to find it.
Anyone know how I can draw a repeating texture inside a rectangle? I tried using [lua] surface.DrawTexturedRectUV() [/lua] With co-ordinates as zero. But no luck Any ideas or other solutions?
[QUOTE=DixonLee;37837588]Anyone know how I can draw a repeating texture inside a rectangle? I tried using surface.DrawTexturedRectUV() With co-ordinates as zero. But no luck Any ideas or other solutions?[/QUOTE] the craziest thing you can try is a loop to do so.. [editline]29th September 2012[/editline] hey guys, can anyone please tell me why [PHP]print( PropertySheet:GetActiveTab( ) )[/PHP] returns this: Panel: [name:][class:Label][57,0,63,20] ?
It's returning the panel of the tab.
Sorry, you need to Log In to post a reply to this thread.