Is it possible to check if a certain convar is bound to any key?
Why do my ironsights sort of... stutter... at high ping?
[code]
function SWEP:GetViewModelPosition(pos, ang)
self:SetIronSights(self.Owner:KeyDown(IN_ATTACK2) and self.data.ironsights!=0 )
if !self.timescale_cv then self.timescale_cv = GetConVar("host_timescale") end
if !self.cheat_cv then self.cheat_cv = GetConVar("sv_cheats") end
local ft = ( SysTime() - ( self.LastSys2 or SysTime() ) )*game.GetTimeScale()
--if ft>FrameTime() then ft = FrameTime() print(ft) end
ft = math.Clamp(ft,0,1/30)
if self.cheat_cv and self.timescale_cv and self.cheat_cv:GetBool() then ft = ft * self.timescale_cv:GetFloat() end
self.LastSys2 = SysTime()
local isrv = self:GetIronSights() and 1 or 0
if !self.isr then self.isr = 0 end
self.isr = math.Approach(self.isr,isrv,(isrv-self.isr)*ft*15)
local isr = self.isr
local invisr = 1-isr
ang:RotateAroundAxis(ang:Right(),self.VMAng.x * invisr)
ang:RotateAroundAxis(ang:Up(),self.VMAng.y * invisr)
ang:RotateAroundAxis(ang:Forward(),self.VMAng.z * invisr)
pos:Add(ang:Right()*self.VMPos.x * invisr)
pos:Add(ang:Forward()*self.VMPos.y * invisr)
pos:Add(ang:Up()*self.VMPos.z * invisr)
ang:RotateAroundAxis(ang:Right(),self.IronSightsAng.x * isr)
ang:RotateAroundAxis(ang:Up(),self.IronSightsAng.y * isr)
ang:RotateAroundAxis(ang:Forward(),self.IronSightsAng.z * isr)
pos:Add(ang:Right()*self.IronSightsPos.x * isr)
pos:Add(ang:Forward()*self.IronSightsPos.y * isr)
pos:Add(ang:Up()*self.IronSightsPos.z * isr)
pos,ang = self:Sway(pos,ang)
self.SwayScale = 0
self.BobScale = 1-isr*0.9
local runspeed = self.Owner:GetRunSpeed()
local localisedmove,localisedangle = WorldToLocal(self.Owner:GetVelocity(),self.Owner:GetVelocity():Angle(),vector_origin,self.Owner:EyeAngles())
ang:RotateAroundAxis(ang:Forward(), (math.Approach(localisedmove.y,0,1)/(runspeed/8)*invisr*0.25 ) * (ci or 1) * (-1 + 2 *(self.ViewModelFlip and 1 or 0) ))
ang:RotateAroundAxis(ang:Right(), (math.Approach(localisedmove.x,0,1)/(runspeed) )*invisr*0.25 * (ci or 1) * (-1 + 2 *(self.ViewModelFlip and 1 or 0) ) )
ang:Normalize()
return pos,ang
end
[/code]
[QUOTE=TFA;49204211]Why do my ironsights sort of... stutter... at high ping?
[code]
-long code-
[/code][/QUOTE]
My guess is that you're not using CurTime (which is predicted, while SysTime isn't)
[QUOTE=MaximLaHaxim;49204385]My guess is that you're not using CurTime (which is predicted, while SysTime isn't)[/QUOTE]
Wouldn't using CurTime() make it worse as SysTime would progress normally clientside regardless of server activity or lag?
[QUOTE=TFA;49204516]Wouldn't using CurTime() make it worse as SysTime would progress normally clientside regardless of server activity or lag?[/QUOTE]
Have you tried using FrameTime() instead?
[QUOTE=TFA;49204516]Wouldn't using CurTime() make it worse as SysTime would progress normally clientside regardless of server activity or lag?[/QUOTE]
Can you show all the code? Or at least all ironsights related code
I'm trying to make the pot with mud inside, what i currently have just looks like someone has taken a massive shit inside a plant pot,
[t]http://puu.sh/lCcpQ/55135904e8.png[/t]
Could i make a better effect with stencils some how? ( less turd like )
[QUOTE=AIX-Who;49205850]I'm trying to make the pot with mud inside, what i currently have just looks like someone has taken a massive shit inside a plant pot,
[t]http://puu.sh/lCcpQ/55135904e8.png[/t]
Could i make a better effect with stencils some how? ( less turd like )[/QUOTE]
Why not make the model fill the entire pot? Like put a flat circle instead of the ground and then add some variation in height.
Does anyone know how to run 2 Garry's Mod windows at the same time? I've heard that it can be done, but I'm still skeptical.
[QUOTE=BillyOnWiiU;49209347]Does anyone know how to run 2 Garry's Mod windows at the same time? I've heard that it can be done, but I'm still skeptical.[/QUOTE]
Sandboxie is one way.
[QUOTE=BillyOnWiiU;49209347]Does anyone know how to run 2 Garry's Mod windows at the same time? I've heard that it can be done, but I'm still skeptical.[/QUOTE]
Start hl2.exe with the following parameters:"-multirun -steam -window".
Remember to sv_lan 1
Does anybody know how to disable those voices in DarkRP, when somebody types "sorry" etc?
[QUOTE=geferon;49191482]Is there any good tutorial on how to make like good particles?
Its just that i want to learn how to do them. But the good ones.[/QUOTE]
[QUOTE=P4sca1;49209466]Does anybody know how to disable those voices in DarkRP, when somebody types "sorry" etc?[/QUOTE]
[URL="https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_config/settings.lua#L42-L43"]Use Github's Search Function.[/URL]
[QUOTE=Goodroid;49209501][URL="https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_config/settings.lua#L42-L43"]Use Github's Search Function.[/URL][/QUOTE]
Google spew out nothing for me; should look more precise next time; thanks you!
I'm not sure why, but RunConsoleCommand gets called even when the usergroup of the player does not meet the usergroups said below.
Could anyone help?
[lua]
if ply:GetUserGroup("user") or
ply:GetUserGroup("member") or
ply:GetUserGroup("vip") or
ply:GetUserGroup("vip+") then
RunConsoleCommand("ulx", "adduserid", ply:SteamID(), "vip++")
end
[/lua]
[QUOTE=Leyserr;49209870]I'm not sure why, but RunConsoleCommand gets called even when the usergroup of the player does not meet the usergroups said below.
Could anyone help?
[lua]
if ply:GetUserGroup("user") or
ply:GetUserGroup("member") or
ply:GetUserGroup("vip") or
ply:GetUserGroup("vip+") then
RunConsoleCommand("ulx", "adduserid", ply:SteamID(), "vip++")
end
[/lua][/QUOTE]
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/IsUserGroup]Player:IsUserGroup[/url]
[QUOTE=Leyserr;49209870]I'm not sure why, but RunConsoleCommand gets called even when the usergroup of the player does not meet the usergroups said below.
Could anyone help?
[lua]
if ply:GetUserGroup("user") or
ply:GetUserGroup("member") or
ply:GetUserGroup("vip") or
ply:GetUserGroup("vip+") then
RunConsoleCommand("ulx", "adduserid", ply:SteamID(), "vip++")
end
[/lua][/QUOTE]
You can't do it that way, because [URL="http://wiki.garrysmod.com/page/Player/GetUserGroup"]Player:GetUserGroup[/URL] only returns the User Group.
Example for [URL="http://wiki.garrysmod.com/page/Player/GetUserGroup"]Player:GetUserGroup[/URL]:
[lua]if (ply:GetUserGroup() == "groupname") then
-- Code
end[/lua]
I'd use a table for what you are doing:
[lua]local groupTable = {
"user",
"member",
"vip",
"vip+"
}
if (table.HasValue(groupTable, ply:GetUserGroup())) then
RunConsoleCommand("ulx", "adduserid", ply:SteamID(), "vip++")
end[/lua]
Oh okay, thank you very much guys.
I'm planning to show a text over a player's head.
I never did that before. Can anybody tell me which functions could be useful?
[QUOTE=Goodroid;49209376]Start hl2.exe with the following parameters:"-multirun -steam -window".[/QUOTE]
Well, I tried that. I used a .bat file and used a shortcut. It kept saying:
[t]http://i.imgur.com/xQ1mG1k.png[/t]
Obviously this is because of -steam, but with the Steam launch parameters clicking on "Play" will just maximise the Garry's Mod window.
[editline]yep[/editline]
New problem. I have a textured rectangle, whose texture is a circle with a transparent background. A regular circle. I am using stencils to mask drawing of a rectangle onto this circle, however the stencils only mask to the rectangular edges of my DrawTexturedRect, rather than to the texture itself. Is there a way around this?
no, you have to use a poly
I really am not understanding docking. Anyone have a crash course in this? VGUI stuff has always been miserable for me. I'm making a serious attempt now at learning this but docks never seem to do what I want them to, and they always seem to be picking their own incorrect sizes.
I was under the impression that docking was supposed to make resizable layouts much easier to work with so we didn't have to implement our own scaling methods for everything..
[QUOTE=Banana Lord.;49222119]I really am not understanding docking. Anyone have a crash course in this? VGUI stuff has always been miserable for me. I'm making a serious attempt now at learning this but docks never seem to do what I want them to, and they always seem to be picking their own incorrect sizes.
I was under the impression that docking was supposed to make resizable layouts much easier to work with so we didn't have to implement our own scaling methods for everything..[/QUOTE]
Check out my thread asking for help on this, got some really useful tips that might help you too:
[url]https://facepunch.com/showthread.php?t=1495451[/url]
How do I go about making a beam-shooting weapon? I'm new to LUA, but the only SWEP tutorial I could find that was up-to date only showed me how to make a chair gun. Any help is appreciated!
[QUOTE=Banana Lord.;49222119]I really am not understanding docking[/QUOTE]
This picture from the wiki helped me
[IMG]http://wiki.garrysmod.com/images/b/be/panel_dock_example_2.png[/IMG]
Docking to some sides makes your panel smaller, but if you do Panel:SetSize on it after you've docked it, you can make it larger again.
Also, if you need more sides to dock to, E.G. top-left, then you can just create a new DPanel or something like that, run Dock(LEFT) on it and then parent your other panel to it and do Dock(TOP).
My timer doesn't get removed after it's done so nothing happens
BTW how do I remove the number after a number slide?
•••••••••••••••••••••V This bit
|----------------------| 58
I'm trying to get the amount of staff online but I can't seem to do it because staffOn always returns 0, any help would be appreciated.
Here is my current code:
[lua]
local ulxRanks = {"moderator", "vipmoderator", "admin", "headadmin", "superadmin"}
function getStaff()
for k,v in pairs(player.GetAll()) do
if table.HasValue(ulxRanks,v.GetUserGroup()) then
staffOn = staffOn + 1
end
end
end[/lua]
Sorry, you need to Log In to post a reply to this thread.