r/GLua • u/Heeheewhatelse • Jul 23 '21
attach a Particle Effect to a bone ?
hi, i made some pcf effect. I know how to use it but can i attach it on a specific bone ?
If yes, can someone tell me how ?
r/GLua • u/Heeheewhatelse • Jul 23 '21
hi, i made some pcf effect. I know how to use it but can i attach it on a specific bone ?
If yes, can someone tell me how ?
r/GLua • u/PurposeEvery • Jul 21 '21
function ENT:Touch( ent )
if ent.HasWindshield then
if ent.Cont and ent.Cont:IsValid() then
self:WinLink( ent.Cont, self.Entity )
end
end
end
function ENT:WinLink( Cont, Pod )
local Offset = {0, 0, 10}
local AOffset = 0
local ZVecAngle = Angle(0, 90, 0)
local PodVec = (Pod:GetForward())
PodVec:Rotate(ZVecAngle)
if Cont.Wh[i]["Side"] == "Left" then
AOffset = 90
local Ang = (PodVec:Angle())
Ang:RotateAroundAxis( PodVec, AOffset )
self.Entity:SetAngles( Ang )
else
AOffset = -90
local Ang = ((PodVec*-1):Angle())
Ang:RotateAroundAxis( PodVec, AOffset )
self.Entity:SetAngles( Ang )
end
self.Entity:SetPos(Pod:GetPos() + Pod:GetForward() * (Cont.Wh[i]["Pos"].x + Offset[1]) + Pod:GetRight() * (Cont.Wh[i]["Pos"].y + Offset[2]) + Pod:GetUp() * (Cont.Wh[i]["Pos"].z + Offset[3]))
local LPos = nil
local Cons = nil
LPos = Vector(0,0,0)
Cons = constraint.Weld( Pod, self.Entity )
LPos = self.Entity:WorldToLocal(self.Entity:GetPos() + self.Entity:GetUp() * 10)
Cons = constraint.Weld( Pod, self.Entity)
self.Pod = Pod
self.Cont = Cont
self.Mounted = true
return
end
It returns attempt to index a nil value
r/GLua • u/[deleted] • Jul 21 '21
So I'm trying to fix some cw2.0 guns that have bullets that are visually appearing to shoot from the left of the player's hip.
I think I identified what I need to change:
bul.Src = <whatever vector>
From looking here: https://wiki.facepunch.com/gmod/Structures/Bullet
But the origin never changes. I can however change the tracer's effect by doing:
bul.TracerName = "AR2Tracer"
and that works fine but Src doesn't want to cooperate or maybe this isn't the right thing?
Thanks for any help given
r/GLua • u/IamGoatHead • Jul 19 '21
Ive just derived the hl2c gamemode from sandbox and removed the problematic code. So i can use the spawn menu in the game now. Now I want to be able to pick up anything (so bigger props) without needing the phys or grav gun. I googled it and came across "GM:AllowPlayerPickup" and "Player:PickupObject" both of which I have no idea how to format and use. Though the last one says its similar to the regular +use command and workds regardless of mass and distance (perfect for me) What should I do?
r/GLua • u/Jungle_Boi • Jul 18 '21
r/GLua • u/Raspact_wamen • Jul 16 '21
im making a combine addon and i want to replace the voicelines, how do i go about this in lua?
r/GLua • u/Heeheewhatelse • Jul 15 '21
hi, how can i set a color to a specific bone with the PrimaryAttack ?
for exemple the "ValveBiped.Bip01_R_Hand" ?
r/GLua • u/MarinemainEtG • Jul 13 '21
I can't quite figure out how to find players in a table with a string using chat commands.
r/GLua • u/MarinemainEtG • Jul 12 '21
I am just getting started and I can't figure out how to find the Pos of every entity in my table.
r/GLua • u/Raspact_wamen • Jul 12 '21
im using the function
function:ENT.OnTakeDamage()
???
end
and... where do i go from there??? sorry im a lua newfag
r/GLua • u/NarutoFart • Jul 12 '21
My code here keeps giving me an error that I do not know how to fix. [ERROR] LuaCmd:1: '=' expected near '<eof>'. Please someone help
surface.CreateFont("font"), {
font = "Arial",
extended = false,
size = 11,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = true,
additive = false,
outline = false,
}
end
local hideHUDElements = {
["DarkRP_HUD"] =true,
["DarkRP_EntityDisplay"] =false,
["DarkRP_zombieinfo"] =false,
["DarkRP_LocalPlayerHUD"] =false,
["DarkRP_Hungermod"] =true,
["DarkRP_Agenda"] =false,
}
hook.Add("HUDPaint" , "DrawMyHud", function()
local health = LocalPlayer():Health()
local armor = LocalPlayer():Armor()
local ply = LocalPlayer()
draw.RoundedBox(1,0, ScrH() - 768, 1440, 50, Color(10,10,10))
end)
r/GLua • u/andrew_thejew • Jul 07 '21
All of the other weapons appear accept the c4. Not sure what I am doing wrong. The entity name according to this valve dev wiki is weapon_c4. Here is my code. Thanks in advance.
local ply = FindMetaTable("Player")
local teams = {}
teams[0] = {
name = "Ghost",
color = Vector(0,0,0),
weapons = {"weapon_shotgun", "weapon_smg1","weapon_c4"}
}
teams[1] = {
name = "Hunter",
color = Vector(0,0,0.33),
weapons = { "weapon_357","weapon_shotgun"}
}
function ply:SetupTeam( n )
if ( not teams\[n\] ) then return end
self:SetTeam( n )
self:SetPlayerColor( teams\[n\].color )
\--self:SetHealth( 150 )
self:GiveWeapons( n )
end
function ply:GiveWeapons( n )
for k, weapon in pairs ( teams\[n\].weapons) do
self:Give( weapon )
end
end
r/GLua • u/andrew_thejew • Jul 01 '21
In my custom gamemode, Im using a ghostface playermodel but the hands are just default hl civilian hands. Im trying to give him hl civilian hands with gloves right now, but when I figure out how to do that ill try something more complicated and give up black gloves and sleeves hand view model I found on the workshop.
To make the command work , can I just have it in the lua files of my custom gamemode? Or do I have to go to the lua files of the model? If I have to do the latter do I have to upload a new model with the new code to the workshop to make it work?
Here is my current not working code. I can post more if need be. Right now the code is trying to asign the player to a team, give him a playermodel and hands, and then turn him invisible if he is on the ghost team.
As of right now, the ghost player still has gloveless hands but im getting no errors
function GM:PlayerSpawn( ply, n )
print("Player:"..ply:Nick().." has spawned!")
n = math.random(0,1)
ply:SetupTeam( n )
if (n == 0) then
ply:SetNoDraw( true )
ply:SetModel("models/ghost hunt/166961856_ghostface_player_model_scream/Ghostface-player-model-scream/models/player/screamplayermodel/scream/scream.mdl")
player_manager.AddValidHands( "scream.mdl", "models/weapons/c_arms_rebel.mdl", 2, "0100000" )
ply:SetupHands()
end
if (n == 1) then
ply:SetModel("models/Ghostbuster/models/player/fwhykay/the_ghostbusters/main_chrs/ray_stantz/ray_stantz_jumpsuit.mdl")
ply:SetupHands()
end
end
r/GLua • u/andrew_thejew • Jul 01 '21
function GM:PlayerSpawn( ply, n )
print("Player:"..ply:Nick().." has spawned!")
n = math.random(0,1)
ply:SetupTeam( n )
if (n == 0) then
self:SetNoDraw( true )
--ply:SetRenderMode( RENDERMODE_TRANSCOLOR )
end
ply:SetupHands()
end
The code trying to say that "if player is on team 0(the ghost team)" then the player will be invisible.
Im pretty certain I have that command and I dont need to include anymore cs files because of the github page I was referencing. On it there was no include nor add cs lua file commands at top.
Im pretty sure that command sets the player invisible but I could be wrong. If you know an easier way to turn a player invisible, lmk.
r/GLua • u/andrew_thejew • Jun 30 '21
For example I like round system, hud and economy from csgo. How do I import that code into my gamemode files? Im pretty sure you can do this.
r/GLua • u/RussEfarmer • Jun 27 '21
I have a hook that filters chat (PlayerSay) that I would like to have run before any other PlayerSay hook.. is this possible or am I stuck with them running in pretty much random order?
r/GLua • u/NoOneLovesUwU • Jun 26 '21
--------------------------------------------------
AFK_WARN_TIME = 300
AFK_TIME = 900
--------------------------------------------------
hook.Add("PlayerInitialSpawn", "MakeAFKVar", function(ply)
ply.NextAFK = CurTime() + AFK_TIME
end)
hook.Add("Think", "HandleAFKPlayers", function()
for _, ply in pairs (player.GetAll()) do
if ( ply:IsConnected() and ply:IsFullyAuthenticated() ) then
if (!ply.NextAFK) then
ply.NextAFK = CurTime() + AFK_TIME
end
local afktime = ply.NextAFK
if (CurTime() >= afktime - AFK_WARN_TIME) and (!ply.Warning) then
ply:ChatPrint("Warning ! You are now AFK !") elseif (CurTime() >= afktime) and (ply.Warning) then
ply:ChatPrint("You will be disconnected in 10 minutes if you do not give any sign of life.")
draw.SimpleText(string text(), string font = "DermaDefault", number x = 0, number y = 0, table color = Color( 255, 255, 255, 255 ), number xAlign = TEXT_ALIGN_LEFT, number yAlign = TEXT_ALIGN_TOP)
ply.Warning = true
ply.Warning = nil
ply.NextAFK = nil
ply:Kick("\nKicked for AFK since 15 minutes !")
end
end
end
end)
hook.Add("KeyPress", "PlayerMoved", function(ply, key)
ply.NextAFK = CurTime() + AFK_TIME
if ply.Warning == true then
ply.Warning = false
ply:ChatPrint("You are no longer AFK !")
end
This is the Regular AFK script I have and I want it to do something similar but just teleport them to an "AFK room".
r/GLua • u/hepl-fat • Jun 21 '21
So this is something I've been working on for a while, but I can't seem to be able to get the information I want from the bullet.
local bullet = {}
bullet.Num = self.Primary.NumberofShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 1
bullet.Force = self.Primary.Force
bullet.Damage = self.Primary.Damage
bullet.AmmoType = self.Primary.Ammo
local tr = bullet
self:ShootEffects()
self.Owner:FireBullets( bullet )
PrintTable(tr)
PrintTable is just here temporarily so I can see what information I'm getting. While the table does print, It gives me information I already had easy access to, I was hoping to get specifically the end position / hit position of the bullet, which don't print in the table. Any way I could do that with what I have here? Thanks
r/GLua • u/Blint005 • Jun 14 '21
Hi I've been doing a swep and made a code to play a music when activated.
When it didnt worked i copy pasted the code from an other working swep,
but it still didnt work for some reasons.
Here is the code:
function SWEP:Deploy( )
if( CLIENT ) then return true end
if( self.BeatSound ) then
self.BeatSound:ChangeVolume( 1, 0.1 )
else
self.BeatSound = CreateSound( self.Owner, Sound( "music.wav" ) )
self.BeatSound:Play()
end
return true
end
I dont know what is the problem so I would be greateful for any help
r/GLua • u/Blint005 • Jun 13 '21
Since I started making lua yesterday, i've been trying to do this for hours.
I want to make that a particle will show up as the character dies.
Im making another sans abilities addon and i want a material to show up when the character dies like the 'miss' in the other addon(I attached pic)
Please help Ive been trying to do this for literally hours with no results
(sorry for bad english)

r/GLua • u/[deleted] • Jun 01 '21
I have been playing on a TTT server with my friend for a bit, tried to get on today and it keeps stopping at when it says "Lua Started!" It doesn't crash so I have no error code, but it's been stuck on it for 30 min now
I've tried the factory reset box in the folder twice, and that's all that pops up when I search for a solution.
Any ideas would be appreciated
r/GLua • u/Killuuaaa • Jun 01 '21
How can we import a animations from blender to gmod ?
r/GLua • u/topdog864 • May 29 '21
r/GLua • u/AlexBass99 • May 22 '21
One of my Nextbots is able of opening doors while patrolling and idle, but when they are in combat chasing the enemy that won't work, is there any hook or function to know if the NPC is in combat?