Does anyone have a function to take 8 (vector) points and turn them into MeshVertexes so I can make a rectangle out of IMesh and PhysicsFromMesh?
Does [b][url=http://wiki.garrysmod.com/?title=Util.SpriteTrail]Util.SpriteTrail [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] work?
I tried doing this:
[lua]for k, v in pairs(player.GetAll()) do
local trail = util.SpriteTrail(v, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, "trails/lol.vmt")
end[/lua]
and I saw nothing.
Hello Community, i got this LUA error on my server after testing it, i cant seem to figure out what to do. heres the error and line.
[CODE][ERROR] lua/includes/modules/draw.lua:86: bad argument #1 to 'GetTextSize' (string expected, got nil)
1. GetTextSize - [C]:-1
2. SimpleText - lua/includes/modules/draw.lua:86
3. DoActualHUD - gamemodes/darkrp/gamemode/client/hud.lua:88
4. DrawHUD - gamemodes/darkrp/gamemode/client/hud.lua:211
5. unknown - gamemodes/darkrp/gamemode/client/hud.lua:322[/CODE]
Here is the lines.
[CODE]draw.SimpleText(LocalPlayer().DarkRPVars.job,"WalletSalaryJob", ScrW() / 2.7, ScrH() / 20, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)[/CODE]
Please leave your thoughts of the problem or if you need more information.
[QUOTE=`impulse;38441009]Not exactly something I need help with, but I was just wondering what other people do for 2D animations.[/QUOTE]
On vgui I use the built-in MoveTo, SizeTo, AlphaTo, etc. Anything else I base off delta time.
[lua]
local delta = 1 - math.Clamp((self.EndTime - SysTime()) / self.AnimationLifeTime, 0, 1)
local x = ScrW() * 0.5 + ScrW() * 0.25 * delta
[/lua]
That example moves x from half screen width to 75% screen width over the course of animationlifetime. EndTime is declared somewhere like self.EndTime = SysTime() + self.AnimationLifeTime
[QUOTE=DJarthas;38446539]Hello Community, i got this LUA error on my server after testing it, i cant seem to figure out what to do. heres the error and line.
[CODE][ERROR] lua/includes/modules/draw.lua:86: bad argument #1 to 'GetTextSize' (string expected, got nil)
1. GetTextSize - [C]:-1
2. SimpleText - lua/includes/modules/draw.lua:86
3. DoActualHUD - gamemodes/darkrp/gamemode/client/hud.lua:88
4. DrawHUD - gamemodes/darkrp/gamemode/client/hud.lua:211
5. unknown - gamemodes/darkrp/gamemode/client/hud.lua:322[/CODE]
Here is the lines.
[CODE]draw.SimpleText(LocalPlayer().DarkRPVars.job,"WalletSalaryJob", ScrW() / 2.7, ScrH() / 20, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)[/CODE]
Please leave your thoughts of the problem or if you need more information.[/QUOTE]
Make sure that LocalPlayer().DarkRPVars.job is a string. (not nil)
[editline]14th November 2012[/editline]
= put it in an if block
It seems entity:GetKeyValues() broken. How could I get key values of entity?
At least how to parse spawnflags?
[QUOTE=Darkwater124;38447331]Make sure that LocalPlayer().DarkRPVars.job is a string. (not nil)
[editline]14th November 2012[/editline]
= put it in an if block[/QUOTE]
Sorry im Derp right now can you tell me what exactly to do? Dident really understand you. Im really glad you are helping me.
Edit: Should i do (string.format ?
[QUOTE=DJarthas;38448026]Sorry im Derp right now can you tell me what exactly to do? Dident really understand you. Im really glad you are helping me.
Edit: Should i do (string.format ?[/QUOTE]
He wants you to do
[lua]if LocalPlayer().DarkRPVars.job then
draw.SimpleText(LocalPlayer().DarkRPVars.job,"WalletSalaryJob", ScrW() / 2.7, ScrH() / 20, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
end[/lua]
Personally, I'd do
[lua]draw.SimpleText(LocalPlayer().DarkRPVars.job or "[N/A]","WalletSalaryJob", ScrW() / 2.7, ScrH() / 20, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)[/lua]
[QUOTE=my_hat_stinks;38448049]He wants you to do
[lua]if LocalPlayer().DarkRPVars.job then
draw.SimpleText(LocalPlayer().DarkRPVars.job,"WalletSalaryJob", ScrW() / 2.7, ScrH() / 20, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
end[/lua]
Personally, I'd do
[lua]draw.SimpleText(LocalPlayer().DarkRPVars.job or "[N/A]","WalletSalaryJob", ScrW() / 2.7, ScrH() / 20, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)[/lua][/QUOTE]
Thank you :D
Hi ,im working on little Gamemode and i have a problem with auto LUA scripts reload , is there a command to disable it ?
PlayerAuthed or PlayerInitialSpawn, which one is better? I'm going to be retrieving Steam ID from which ever one so I assume PlayerAuted is more appropriate?
[QUOTE=guigui;38448230]Hi ,im working on little Gamemode and i have a problem with auto LUA scripts reload , is there a command to disable it ?[/QUOTE]
You should try to fix the auto-reload problem, because it's [I][B]really[/B][/I] handy if it works. What's the problem you're getting?
[QUOTE=guigui;38448230]Hi ,im working on little Gamemode and i have a problem with auto LUA scripts reload , is there a command to disable it ?[/QUOTE]
sv_autorefresh 0
So ent:GetKeyValues() is broken. Moan at Garry to fix it?
The most important broken thing for me currently is that "CalcView" no longer cares about "GetViewModelPosition"... This really can't remain unfixed lol.
[QUOTE=aurum481;38449177]So ent:GetKeyValues() is broken. Moan at Garry to fix it?[/QUOTE]
It has been broken for about 2 years by now. Just use the OnKeyValue hook and store them on the entity manually.
How does ShouldCollide work now? Whenever I use it, it makes me go through every entity, and like, doesn't go directly trough, but it hits, then gets through.
Could someone please comment in between the lines of this script and explain what certain parts do? I've been debugging it for a while and it still doesn't make sense.
If this script can be optimized please do so, thanks!
[lua]
--I've put "--" beside the lines that I would like to be explained
local radar = {}
radar.border = 20
radar.radius = 200
radar.x = ScrW()-radar.radius-radar.border
radar.y = radar.radius+radar.border
radar.xcenter = radar.x+(radar.radius/2)
radar.ycenter = radar.y+(radar.radius/2)
radar.quality = 50
radar.color = Color(0,0,0,200)
radar.viewradius = 2048
function DrawRadar()
local circle = {}
for i=1,radar.quality do
circle[i] = {
x = radar.xcenter + math.cos(math.rad((360/radar.quality)*i)) * radar.radius/2,--
y = radar.ycenter + math.sin(math.rad((360/radar.quality)*i)) * radar.radius/2,--
u = 0,
v = 0
}
end
surface.SetTexture(surface.GetTextureID("vgui/white"))
surface.SetDrawColor(radar.color)
surface.DrawPoly(circle)
local ply = LocalPlayer()
if (!ply:Alive()) then return end
for k,ent in ipairs(ents.FindByClass("prop_physics")) do
local vdiff = ent:GetPos()-ply:GetPos()
if ( vdiff:Length() <= radar.viewradius) then
local px = (vdiff.x/radar.viewradius)--
local py = (vdiff.y/radar.viewradius)--
local z = math.sqrt(px*px+py*py)--
local phi = math.rad(math.deg(math.atan2(px,py))-math.deg(math.atan2(ply:GetAimVector().x,ply:GetAimVector().y))-90)--
px = math.cos(phi)*z--
py = math.sin(phi)*z--
draw.RoundedBox(4, radar.xcenter+px*radar.radius/2-4, radar.ycenter+py*radar.radius/2-4, 8, 8, Color(255,255,255,255))
end
end
end
hook.Add("HUDPaint", "Radar", DrawRadar)
[/lua]
-snip nvm-
I was wondering if anyone knew how to make a lua script check for the current gamemode before deciding on if it should run or not?
[code]hook.Add("DoPlayerDeath", "ShowKiller", function(victim, attacker)
if attacker:IsPlayer() then
victim:PrintMessage(HUD_PRINTTALK, "You have been killed by "..attacker:Nick()..". He was a "..attacker:GetRoleString()..".")
elseif not attacker:IsPlayer() then
victim:PrintMessage(HUD_PRINTTALK, "You were not killed by a player.")
end
end)[/code]
I'd just like to adjust that to only run if the gamemode is set to terrortown, as I have a forked GMod installation that now has two servers. Would really appreciate any help.
Anyone else getting this error?
ERROR: GAMEMODE:'HUDPaint' Failed: lua/includes/modules/draw.lua:70: 'Trebuchet19' isn't a valid font
[QUOTE=Gamz365;38457237]Anyone else getting this error?
ERROR: GAMEMODE:'HUDPaint' Failed: lua/includes/modules/draw.lua:70: 'Trebuchet19' isn't a valid font[/QUOTE]
[lua]surface.CreateFont("Trebuchet19", {font="Trebuchet MS", size=19, weight=900})[/lua]
need to find a way to de-inflate a players head on death (Headshot)
Any ideas/examples? on how i can do this?
also need:
Finding directional hit position of the bullet (get attacker pos, then victim pos, then find the angle. Don't know the code to do this.)
And also asking about a theory:
is it possible to change the position / collision settings of specific bones on a ragdoll?
ex: Make two ragdolls - First one has his arm missing, since the arms bones are all set to be at the shoulder, and the arm has been set to completely deflated(invisible), and another one where all bones except for the ones that are edited on ragdoll 1 are tied to the connection area. This would create the effect of a ragdoll having his arm severed from his body, and it will all follow physics how it should.
Sorry for the confusing text spam, working on some indepth dismemberment just to see if it's possible. Please tell me if i'm onto something, or if this is just crap that will never work
[editline]15th November 2012[/editline]
[QUOTE=.\\Shadow};38457268][lua]surface.CreateFont("Trebuchet19", {font="Trebuchet MS", size=19, weight=900})[/lua][/QUOTE]
install the trebuchet19 font, or build it yourself. not sure if it's in gmod by default anymore.
You would need to use Player.BuildBonePosition, but that was removed I think or wasn't functioning correctly.
[QUOTE=Chessnut;38458221]You would need to use Player.BuildBonePosition, but that was removed I think or wasn't functioning correctly.[/QUOTE]
Could you give me a snippet example of how i would use it or a wiki page?
[QUOTE=Chessnut;38458243][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7197.html[/url][/QUOTE]
Would this change collision physics on the model?
ENT.BuildBonePositions has been removed as far as I know; use [url=http://wiki.garrysmod.com/page/Classes/Entity/ManipulateBoneScale]Entity.ManipulateBoneScale[/url]. Not sure if it's just me, but some bones don't get scaled correctly using this method - if at all. Fairly certain that collisions don't get manipulated alongside bones.
How do I make the player invisible but still drawing entities bonemerged to it? If I don't draw the player, the entities aren't drawn as well and if I try to bonescale the player the entities bones scale too. Changing color doesn't even work for some reason.
Sorry, you need to Log In to post a reply to this thread.