[QUOTE=TylerB;37297195]Ent:RestartGesture(Ent:LookupSequence("taunt01"))
I was working on an e2 with an extension for Lua, and I was running that code on a hologram.
[code]
local Ent = Entity("+holoEntity(1):id()+")
[/code][/QUOTE]
Help anyone?
Is ply:GodEnable() broken for anyone else? Or is there a better way for giving players a 3 second invulnerability time when they spawn?
You could make a variable for their godmode when they spawn and use the PlayerHurt hook.
PlayerHurt is called after taking damage. Think he needs [B][URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index148c.html"]Gamemode.PlayerShouldTakeDamage [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B]
[QUOTE=Drakehawke;37299208][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexcb0c.html]util.IsValidModel?[/url][/QUOTE]
does that check if the filename is valid and/or if the file exists
[img]http://puu.sh/WEOi[/img]
I'm drawing via a series of quads and have run into a z sorting issue. Is there any way that I can enforce the order as I see fit, or am I going to have to venture into mesh / model territory?
[QUOTE=Ninja101;37306111]PlayerHurt is called after taking damage. Think he needs [B][URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index148c.html"]Gamemode.PlayerShouldTakeDamage [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B][/QUOTE]
Looks like this did the trick, thanks.
I added this under GM.PlayerSpawn
ply.SpawnInvuln = CurTime() + 3
and paired with this
function GM:PlayerShouldTakeDamage( ply, attacker )
if CurTime() < ply.SpawnInvuln then
return false
else return true
end
end
wraps it up. I'll worry about friendly fire later.
garry added support for making entities just single files, right?
like lua/entities/entity.lua
instead of lua/entities/entity/init.lua
?
Yes.
[QUOTE=Kogitsune;37306752][img]http://puu.sh/WEOi[/img]
I'm drawing via a series of quads and have run into a z sorting issue. Is there any way that I can enforce the order as I see fit, or am I going to have to venture into mesh / model territory?[/QUOTE]
I guess you could just sort the quads by distance from screen but I would really go with a mesh for what you're doing.
How can i change the colour on a car without using a skin, and so it still will not mess up the rims and seats and things like that?
Hope someone can help :D
[QUOTE=flambert;37310703]How can i change the colour on a car without using a skin, and so it still will not mess up the rims and seats and things like that?
Hope someone can help :D[/QUOTE]
I think there is a gmod module called pimpmyride allowing you to do that, I never tried it though.
[QUOTE=flambert;37310703]How can i change the colour on a car without using a skin, and so it still will not mess up the rims and seats and things like that?
Hope someone can help :D[/QUOTE]
You can't.
[QUOTE=ralle105;37310926]You can't.[/QUOTE]
I saw a server where you could pick a color(All colors), and then make you car be that color.(Roleplay server)
Certain car models have specially mucked with materials on everything but the car body that prevent the colour being changed on them so you can do that. It's not a lua thing.
So yeah. After reading on the "Reason why your shit is broken" page, I've been trying to battle out these timer errors, but with no luck.
[code]
timer.Simple(40,function()
if !ply:IsValid() then return end
for _,ent in pairs(ents.FindByClass("item_base")) do
if ent.price != nil then
local amt = 0
if ent.Amount != nil && tonumber(ent.Amount) > 1 then
amt = ent.Amount
else
amt = 1
end
umsg.Start("CL_PriceItem", ply)
umsg.Bool(false)
umsg.Entity(ent)
umsg.Long(tonumber(ent.price))
umsg.String(tostring(ent.desc))
umsg.Long(amt)
umsg.End()
end
end
if !ply:HasItem("item_suitzoom") then
ply:SetCanZoom( false )
end
CheckGeneralAwards( ply )
StartAwardCount( ply )
end)
[/code]
From what i understand on that page, this should be good enough.
Tho it simply isn't.
Heres my error:
[code]
Traceback: stack traceback:
lua/includes/modules/timer.lua:226: in function 'Simple' gamemode/testgamemode/gamemode/server/player.lua:73 in function (gamemodes/testgamemode/gamemode/server/player.lua:11)
[C]: in function 'pcall'
lua/includes/modules/hook.lua:100: in function (lua/includes/modules/hook.lua:58)
1. lua/includes/modules/timer.lua:191 (unknown)
2. [C]:-1 (pcall)
3. lua/includes/modules/hook.lua:75 (unknown)
[/code]
The error revolves around line 73, which is where my timer starts. Line 11 in player.lua is the GM:PlayerInitialSpawn hook.
This same error goes for basically all of my timer.Simple functions :/
Mega help thread is mega.
Good afternoon, I was wondering if the more a more experienced lua script'er could help me with a small problem for a personal project. I have searched quite a bit (for about an hour now) in order to render/draw a model at a location/angle of my choosing ,client side(I assume drawing is client), without the need of a entity.
[U]Entity:DrawMode[/U]l seems limited to the entity, and[U] lMesh[/U] seems a little complicated for a new-to-lua-script person like myself
Perhaps I have misread/misunderstood the documentation (Or haven't read enough).
I took it onto myself that this wasn't worth its own thread.
if it's in the world, use [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7401.html]ClientsideModel[/url], and if it's on the HUD use [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index0d85.html]DModelPanel[/url] (which also use clientsidemodels but just takes care of the cam stuff for you)
[QUOTE=Brieg;37314149]Mega help thread is mega.
Good afternoon, I was wondering if the more a more experienced lua script'er could help me with a small problem for a personal project. I have searched quite a bit (for about an hour now) in order to render/draw a model at a location/angle of my choosing ,client side(I assume drawing is client), without the need of a entity.
[U]Entity:DrawMode[/U]l seems limited to the entity, and[U] lMesh[/U] seems a little complicated for a new-to-lua-script person like myself
Perhaps I have misread/misunderstood the documentation (Or haven't read enough).
I took it onto myself that this wasn't worth its own thread.[/QUOTE]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7401.html[/url]
oh, that was quick. I don't know how I missed that in my searches. Thank you very much!
Ive made a function that spawns props for a gamemode im working on, probleme is i want them spawned frozen, and i cannot get it to do that
so far i have:
[CODE]function SpawnProp(pos, angle, model, material, colour)
local ent1 = ents.Create("prop_physics")
print("Prop spawned with model: " .. model)
ent1:SetAngles(angle)
ent1:SetModel(model)
ent1:SetPos( pos )
ent1:SetColor(colour)
ent1:Spawn()
local l = ent1:GetPhysicsObject()
l:EnableMotion(false)
l:Sleep()
end[/CODE]
Can anyone spot any errors ive made? Obviously last 3 lines of the function are what's meant to be freezing them
(Also, im using it in gmod 13... if that makes a difference?)
is there a math function to round a decimal up to the nearest x? ie.
before: 0.191851
after: 0.192
[editline]19th August 2012[/editline]
nvm I see it now, glua.me sucks
whoever made it also sucks
I was able to fix my quad issue by calling render.OverrideDepthEnable( true, true ) before drawing the overlapping parts.
[img]http://puu.sh/X1dy[/img]
[lua] vql.ExQuery("SELECT `amount` FROM tk_wallet WHERE `steam` = " .. steamID.. ";",
function (f)
if f then
-- I removed some query functions for facepunch because it's bulky and doesn't mean anything.
-- Update Query code
else -- if a existing money account was not found
--Insert Query code
end)
[/lua]
Why doesn't this work?
[lua]
function vql.ExQuery( qry, func )
tsql:Query(qry, query_correct, 1, func or function() end)
[/lua]
I don't get errors but it only runs the very first query. It did used to work.
What module are you using exactly? You posted this in the mysqloo thread but that looks like a tmysql query to me..
[QUOTE=Drakehawke;37324636]What module are you using exactly? You posted this in the mysqloo thread but that looks like a tmysql query to me..[/QUOTE]
Yeah it's tmysql. Not sure why I posted in the mysqloo thread.
If anyone could send me on the right path, I can't get the Reload Function in the weapon base to work all the way.
I've set up my own reload script, but can't seem to get Animations or the Sounds to work. The ammo script works fine, just no sounds or correct world animations. It does play the noise when the ammo runs out all the way, but if I push reload, it does not.
[lua]function SWEP:Reload()
if( self.amtof == 0 ) or (self:Clip1() == self.amtof) or (self:Clip1() == self.Primary.ClipSize) then print("Returned") return end
self.Weapon:DefaultReload( ACT_VM_RELOAD )
self:SendWeaponAnim( ACT_VM_RELOAD )
self:SetIronsights( false )
self.Owner.ReloadingAnim = true
self.Weapon:SetNextPrimaryFire(CurTime()+(self.Owner:GetViewModel():SequenceDuration()))
self.Weapon:SetNextSecondaryFire(CurTime() +(self.Owner:GetViewModel():SequenceDuration()))
print("DID ANIM STUFF")
self:EmitSound(self.Weapon.Primary.Reload)
print("DID emit sound?")
local requiredammo = self.Primary.ClipSize - self:Clip1()
if self.amtof > requiredammo then
self:SetClip1( self:Clip1() + requiredammo )
self.Owner:TakeItemAmt(self.ARPAmmoType, requiredammo)
else
self:SetClip1( self:Clip1() + self.amtof )
self.Owner:TakeItemAmt(self.ARPAmmoType, self.amtof)
end
--self.Owner.Reloading = false
end[/lua]
I do know that self.Weapon:DefaultReload( ACT_VM_RELOAD ) is not working, but can't figure out why.
[QUOTE=trotski94;37317308]Ive made a function that spawns props for a gamemode im working on, probleme is i want them spawned frozen, and i cannot get it to do that
so far i have:
[CODE]function SpawnProp(pos, angle, model, material, colour)
local ent1 = ents.Create("prop_physics")
print("Prop spawned with model: " .. model)
ent1:SetAngles(angle)
ent1:SetModel(model)
ent1:SetPos( pos )
ent1:SetColor(colour)
ent1:Spawn()
local l = ent1:GetPhysicsObject()
l:EnableMotion(false)
l:Sleep()
end[/CODE]
Can anyone spot any errors ive made? Obviously last 3 lines of the function are what's meant to be freezing them
(Also, im using it in gmod 13... if that makes a difference?)[/QUOTE]
Nobody can help me?
:c
[lua/vgui/dlabel.lua:62] SetFontInternal: font doesn't exist (IFBaseFont15)
surface.CreateFont("Arial", {size = 15, weight = 400, antialias = true, font = "IFBaseFont15"})
Could someone help ?
[QUOTE=Jamies;37327667][lua/vgui/dlabel.lua:62] SetFontInternal: font doesn't exist (IFBaseFont15)
surface.CreateFont("Arial", {size = 15, weight = 400, antialias = true, font = "IFBaseFont15"})
Could someone help ?[/QUOTE]
surface.CreateFont("IFBaseFont15", {size = 15, weight = 400, antialias = true, font = "Arial"})
Sorry, you need to Log In to post a reply to this thread.