[QUOTE=MPan1;49719202]dear god it exists
[sp]But it's still kinda messing with 3d2d stuff but damn that's pretty useful[/sp][/QUOTE]
is it though? I haven't been able to get it working on a 3d2d instance but I dont think this example uses 3d2d at all
[QUOTE=Arizard;49719319]is it though? I haven't been able to get it working on a 3d2d instance but I dont think this example uses 3d2d at all[/QUOTE]
[QUOTE][B]Kinda[/B] messing with 3d2d stuff[/QUOTE]
It uses a couple of cam functions, not really 3d2d, but still related to it.
Also another question- how can I get a shadow to be drawn under a custom derma element I'm trying to make? It uses a lot of code from the DFrame, but for some reason the shadow doesn't draw even if I enable it.
[QUOTE=MPan1;49719479]
Also another question- how can I get a shadow to be drawn under a custom derma element I'm trying to make? It uses a lot of code from the DFrame, but for some reason the shadow doesn't draw even if I enable it.[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Derma_DrawBackgroundBlur]Global.Derma_DrawBackgroundBlur[/url]
[QUOTE=Cheese_3;49717626]My DarkRP server seems to be randomly freezing, no errors, no logs. Just freezes? Any ideas
[url]http://puu.sh/n3BDZ/c1c2af2fea.png[/url][/QUOTE]
you might have noticed someone just using the stacker tool....
they probably just spawned 999 props or something.
Use [URL="https://steamcommunity.com/sharedfiles/filedetails/?id=264467687"]this[/URL]
How do I make a placeholder text for text entry?
[QUOTE=keeperman;49720641]How do I make a placeholder text for text entry?[/QUOTE]
You have to make it yourself
[QUOTE=BillyOnWiiU;49720851]You have to make it yourself[/QUOTE]
How would I do that?
[QUOTE=keeperman;49721003]How would I do that?[/QUOTE]
You're not going to learn if you keep asking how to do everything
[url]http://wiki.garrysmod.com/page/Category:DTextEntry[/url]
The functions are there.
A simple way would detect a specific string on OnGetFocus and if it's the string, replace the text with nothing.
:snip:
How do I check if a html gets to a new page and get that url name?
[QUOTE=keeperman;49721049]:snip:
How do I check if a html gets to a new page and get that url name?[/QUOTE]
panel:GetURL() and just compare the string.
[QUOTE=LUModder;49722536]panel:GetURL() and just compare the string.[/QUOTE]
nah, we have dank new html panel hooks now
[editline]11th February 2016[/editline]
[url]http://wiki.garrysmod.com/page/PANEL/OnChangeTitle[/url] for title and [url]http://wiki.garrysmod.com/page/PANEL/OnDocumentReady[/url] for other stuff like url
[QUOTE=Cheese_3;49718469][code]
function UTimeChatCommand( ply, text, public )
text = text:lower()
if (string.sub(text, 1, 6) == "!utime") or (string.sub(text, 1, 4) == "/utime") then
local plyTime = GetConVar( "utime_enable" )
local plyTimeVal = plyTime:GetInt()
if ( plyTimeVal == 1 ) then
ply:ConCommand( "utime_enable 0" )
ply:ChatPrint( "You deactivated UTime!" )
elseif ( plyTimeVal == 0 ) then
ply:ConCommand( "utime_enable 1" )
ply:ChatPrint( "You activated UTime!" )
end
return(false)
end
end
hook.Add( "PlayerSay", "UTimeChatCommand", UTimeChatCommand );
[/code]
Try this.[/QUOTE]
This doesn't work.
[editline]11th February 2016[/editline]
[QUOTE=Arizard;49718280]Your issue is that you are trying to use RunConsoleCommand("utime_enable", "0") on the server - this needs to be run on the client in order for it to take effect on the client. An alternative would be to use ply:ConCommand("utime_enable 0"), this will do what you want from the serverside and you won't need to write any clientside code (hopefully)[/QUOTE]
I'm not running it on the server... I have if CLIENT then.
The problem with my code, is it's actually not getting the ConVar correctly for some reason.
[QUOTE=Windwhistle;49722702]This doesn't work.
[editline]11th February 2016[/editline]
I'm not running it on the server... I have if CLIENT then.
The problem with my code, is it's actually not getting the ConVar correctly for some reason.[/QUOTE]
It's not getting the convar because the code is never running, the PlayerSay hook is server-side which means the functions you're calling within it are being called on the server, and so the CLIENT check will always return false.
The reason the code the other person posted isn't working is because once again PlayerSay is server-side, and so GetConVar is returning the servers value, not the client that called it. To fix their code use [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Player/GetInfoNum"]Player:GetInfoNum[/URL] instead, also I'd change the return to "" instead.
EDIT: Also they messed up the second number on the second string.sub, should be 6
[QUOTE=bigdogmat;49723042]It's not getting the convar because the code is never running, the PlayerSay hook is server-side which means the functions you're calling within it are being called on the server, and so the CLIENT check will always return false.
The reason the code the other person posted isn't working is because once again PlayerSay is server-side, and so GetConVar is returning the servers value, not the client that called it. To fix their code use [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Player/GetInfoNum"]Player:GetInfoNum[/URL] instead, also I'd change the return to "" instead.
EDIT: Also they messed up the second number on the second string.sub, should be 6[/QUOTE]
Why is this function called GetInfoNum and not something with the word "ConVar" in it? I have been looking for something like this for a while and I resorted to implementing my own code to update a client's convar on the server :(
[QUOTE=bigdogmat;49719685][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Derma_DrawBackgroundBlur]Global.Derma_DrawBackgroundBlur[/url][/QUOTE]
I don't want to draw a background blur, I want to draw a shadow.
I found a way to do it though. In case you're wondering, you need to call [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/DisableClipping]Global.DisableClipping[/url], then simply draw a couple of rects under the panel you want with varying opacity
[QUOTE=zerf;49722683]nah, we have dank new html panel hooks now
[editline]11th February 2016[/editline]
[url]http://wiki.garrysmod.com/page/PANEL/OnChangeTitle[/url] for title and [url]http://wiki.garrysmod.com/page/PANEL/OnDocumentReady[/url] for other stuff like url[/QUOTE]
nice, but how do i get the url?
[QUOTE=keeperman;49725308]nice, but how do i get the url?[/QUOTE]
Not sure if I'm right or not, but can't you just override the function so it does whatever you want it to?
[CODE]
function somepanel:OnDocumentReady( url )
print( url )
end
[/CODE]
[editline]12th February 2016[/editline]
Just tested it, I think that works
:snip: retardedness at its fullest
[QUOTE=keeperman;49725353]i don't know what the source is[/QUOTE]
What do you mean by the source? The source for the function?
That function's part of the panel (it gets automatically put into the panel's metatable).
Doing that example thing there (and changing somepanel to the name of your panel) would override it (but only for the panel you're changing it on)
:snip: nevermind I went stupid again
[QUOTE=MPan1;49724799]I don't want to draw a background blur, I want to draw a shadow.
I found a way to do it though. In case you're wondering, you need to call [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/DisableClipping]Global.DisableClipping[/url], then simply draw a couple of rects under the panel you want with varying opacity[/QUOTE]
Ah, sorry I misunderstood
This is where I'd ask about Lua help, right?
I need to set a variable self.LastWep or self.Owner.LastWep ... and I want it to be set when the player picks up my SWEP, so I'm not planning to use an autorun script. How can I do this?
I also want to make it so my SWEP doesn't get picked up when the Player has full ammo. I know I can make a SENT instead that gives me the SWEP, but I have yet to find a way to make it so the Player can walk THROUGH a SENT.
What's the input for rpg_missile to force detonation?
[QUOTE=Potatofactory;49728718]What's the input for rpg_missile to force detonation?[/QUOTE]
iirc explode should do it, if not check VDC
[QUOTE=LUModder;49728834]iirc explode should do it, if not check VDC[/QUOTE]
Looking at the source of the official github I guess there is no real 'input' out there so I had to mimic it.
[code]
if ent:GetClass() == "rpg_missile" then -- Fix for the RPG exploit, Instead mimic the effect
local explode = ents.Create( "env_explosion" )
explode:SetPos( ent:GetPos() )
explode:SetOwner( ent:GetOwner() )
explode:Spawn()
explode:SetKeyValue( "iMagnitude", "100" )
explode:Fire( "Explode", 0, 0 )
explode:EmitSound( "ambient/explosions/explode_4.wav", 400, 400 )
ent:StopSound("Missile.Ignite")
ent:Fire("Kill")
end
[/code]
[IMG]http://vignette1.wikia.nocookie.net/half-life/images/1/19/Valve_dev_favicon.png/revision/latest?cb=20090613220228&path-prefix=en[/IMG] [URL="https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/shared/hl2mp/weapon_rpg.cpp#L358"]weapon_rpg.cpp:358[/URL]
[QUOTE=Potatofactory;49728919]Looking at the source of the official github I guess there is no real 'input' out there so I had to mimic it.
[code]
if ent:GetClass() == "rpg_missile" then -- Fix for the RPG exploit, Instead mimic the effect
local explode = ents.Create( "env_explosion" )
explode:SetPos( ent:GetPos() )
explode:SetOwner( ent:GetOwner() )
explode:Spawn()
explode:SetKeyValue( "iMagnitude", "100" )
explode:Fire( "Explode", 0, 0 )
explode:EmitSound( "ambient/explosions/explode_4.wav", 400, 400 )
ent:StopSound("Missile.Ignite")
ent:Fire("Kill")
end
[/code]
[IMG]http://vignette1.wikia.nocookie.net/half-life/images/1/19/Valve_dev_favicon.png/revision/latest?cb=20090613220228&path-prefix=en[/IMG] [URL="https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/shared/hl2mp/weapon_rpg.cpp#L358"]weapon_rpg.cpp:358[/URL][/QUOTE]
Line 637-642:
[code] if( GetAbsVelocity() == vec3_origin )
{
// Strange circumstances have brought this missile to halt. Just blow it up.
Explode();
return;
}[/code]
So Ent:SetAbsVelocity( vector_origin ) should do it, but it would probably have slight delay.
Also, you could force it into the auger state by dealing damage to it and then set the auger time to something less than the current time - line 234-240, 301-305
There isn't a direct way to make it explode immediately, though - you have a small delay ( at least one frame ) until it thinks again.
So, this code, which runs for a Nextbot:
[CODE]function ENT:Think()
if self:HaveEnemy() then
--do stuff
else
self:SetEnemy(self:GetClosestOnList(self:FindCombineEnemies())) --line 617
end
end
function ENT:GetClosestOnList(le_list)
local compare = math.huge
local ent = nil
if !IsValid(le_list[1]) then return end
for k,v in pairs(le_list) do
if self:GetRangeTo(v:GetPos()) < compare and v != self and v:Health() > 0 then -- line 33
compare = self:GetRangeTo(v:GetPos())
ent = v
end
end
return ent
end
[/CODE]
Floods Console with this error:
[CODE][ERROR] addons/nextbot/lua/entities/nb_mysticbot_base.lua:33: attempt to call method 'GetRangeTo' (a nil value)
1. GetClosestOnList - addons/nextbot/lua/entities/nb_mysticbot_base.lua:33
2. unknown - addons/nextbot/lua/entities/nb_police.lua:617
[/CODE]
If my Bot has an enemy.
Even though my code works exactly like i want it to, errors be spammed.
What am i missing?
[QUOTE=Kogitsune;49729346]There isn't a direct way to make it explode immediately, though - you have a small delay ( at least one frame ) until it thinks again.[/QUOTE]
Oh that works too, thanks mate!
How should I use file.Find to return a table of all of the lua files in a directory? The directory will have a few more directories with lua files in them.
Nevermind, found the problem. [url]https://facepunch.com/showthread.php?t=1261747[/url] is what I was looking for
I have a (probably simple) question to do with basic math stuff I can't really wrap my head around at the moment:
I'm trying to make a simple function that will draw shadows (that are currently just a bunch of rectangles) behind a panel. I want this function to have an argument that lets you choose what opacity you want the shadow to have at the very start of it, before this opacity fades to 0 at the end, right?
[IMG]http://i.imgur.com/lZbcdJG.png[/IMG]
The problem is, because the rectangles making up the shadow are overlapping, their opacity values keep getting added together, so it gets rather confusing.
Here's my code:
[CODE]
-- s = shadow size
-- o = shadow opacity at the start (shadow opacity always ends with 0) - otherwise known as shadow thickness
-- d = detail of shadow (maximum number is the size of the shadow)
local function Derma_DrawShadow( panel, s, o, d )
local w, h = panel:GetSize()
DisableClipping( true )
for i = 0, s, s/d do
surface.SetDrawColor( 0, 0, 0, o/d ) -- this bit here, o/d is the thing I want to fix
surface.DrawRect( -i, -i, w+(i*2), h+(i*2) )
end
DisableClipping( false )
end
[/CODE]
Hopefully someone can figure out what I should be using as the equation/function for the opacity, since dividing the opacity by the shadow detail isn't how it should be done
Sorry, you need to Log In to post a reply to this thread.