Have anyone know normal method to send 256x256 picture without alpha channel? I mean that I need get color from every pixel and convert it to string(255080177 and etc.), after I need compress it by util.compress and send data to client(256*256*9 bytes ~ 24 KB). Have another method?
[QUOTE=bayrock;48651144]That looks like quite a mess, but to your points you never actually define a world model so change:
[CODE]SWEP.WorldModel = ""[/CODE]
To:
[CODE]SWEP.WorldModel = "w_slam.mdl"[/CODE]
Also, I made a slight error so replace the SWEP:Holster function I gave you before with this:
[CODE]
function SWEP:Holster()
if CLIENT and IsValid(self.Owner) then
local vm = self.Owner:GetViewModel()
if IsValid(vm) then
self:ResetBonePositions(vm)
vm:SetMaterial("")
end
end
return true
end[/CODE][/QUOTE]
Changing that worldmodel causing what I was holding to become an error and the SCK base still hasnt connected to the actual SWEP.
is there any reason why self.Weapon:SendWeaponAnim() fails to replay when trying to play an animation twice in a row on dedicated servers, but works flawlessly in listen?
[QUOTE=Katazuro;48671867]is there any reason why self.Weapon:SendWeaponAnim() fails to replay when trying to play an animation twice in a row on dedicated servers, but works flawlessly in listen?[/QUOTE]
Not predicted clientside?
[QUOTE=Z0mb1n3;48672361]Not predicted clientside?[/QUOTE]
I'm trying to understand how prediction would work with this function, since it's in a think hook
How do I make my ball more bouncy, or react more to a punch. Instead of making the weapon stronger, how do I make the ball more vulnerable and more bouncy?
[CODE]hook.Add( "PlayerSay", "Spawnball", function( ply, text, team )
if ( string.sub( text, 1, 5 ) == "!ball" ) then
local ball = ents.Create( "prop_physics" )
if ( !IsValid( ball ) ) then return end
ball:SetModel("models/props_phx/misc/soccerball.mdl")
ball:SetMaterial( "gmod_bouncy" )
ball:SetMoveCollide( MOVECOLLIDE_FLY_BOUNCE )
ball:SetGravity( 0.5 )
ball:SetPos( ply:GetPos() )
ball:Spawn()
local phys = ball:GetPhysicsObject()
print(phys)
if ( ball:IsOnGround() ) then
ball:SetVelocity(ball:GetForward() * 2 + Vector(0,0,20))
return end
return end
end )[/CODE]
How do I render LocalPlayer() worldmodel in CalcView / VehicleCalcView ?
[QUOTE=Katazuro;48672598]I'm trying to understand how prediction would work with this function, since it's in a think hook[/QUOTE]
Sorry, I mean calling it serverside when you should call it clientside as well.
That might be it, might not, not sure.
[QUOTE=Shenesis;48672923][IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/GM/ShouldDrawLocalPlayer"]GM/ShouldDrawLocalPlayer[/URL]
[editline]13th September 2015[/editline]
[CODE]ball:GetPhysicsObject():SetMaterial("gmod_bouncy")[/CODE][/QUOTE]
Thank you.
Edit:
Is HandleAnimation callback broken on vehicles? I get the god damn roller coaster animation no matter what act I try to use.
is there a method or something to check players all weapons? wiki didnt help
[QUOTE=DaRkWoRlD1337;48679629]is there a method or something to check players all weapons? wiki didnt help[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetWeapons]Player:GetWeapons[/url]
?
Is there any way to disable or remove DScrollBar's scrollbar?
I did tried to hide it by painting over it but it still resizes the content, what I want is remove it completely.
[QUOTE=BoowmanTech;48679928]Is there any way to disable or remove DScrollBar's scrollbar?
I did tried to hide it by painting over it but it still resizes the content, what I want is remove it completely.[/QUOTE]
Try scrollbar:SetWidth(0)
How would I go about making a [URL="http://wiki.garrysmod.com/page/Category:DButton"]DButton[/URL] that controls player movement?
This is what I have so far:
[CODE]
forward = vgui.Create( "DButton", frame )
forward:SetPos( 20, ScrH() - 220 )
forward:SetSize( 100, 100 )
forward:SetText( "Go Forward" )
forward:MakePopup()
forward.DoClick = function()
if forward:IsDown() == true then
RunConsoleCommand( "+forward" )
elseif forward:IsDown() == nil then
RunConsoleCommand( "-forward" )
end
end
[/CODE]
But it'll either not work or just toggle player to go forward. I also tried "if forward:IsDown() == false" but same results. I don't know any other way to do it.
[QUOTE=Wob wob wob!;48680324]How would I go about making a [URL="http://wiki.garrysmod.com/page/Category:DButton"]DButton[/URL] that controls player movement?
This is what I have so far:
[CODE]
forward = vgui.Create( "DButton", frame )
forward:SetPos( 20, ScrH() - 220 )
forward:SetSize( 100, 100 )
forward:SetText( "Go Forward" )
forward:MakePopup()
forward.DoClick = function()
if forward:IsDown() == true then
RunConsoleCommand( "+forward" )
elseif forward:IsDown() == nil then
RunConsoleCommand( "-forward" )
end
end
[/CODE]
But it'll either not work or just toggle player to go forward. I also tried "if forward:IsDown() == false" but same results. I don't know any other way to do it.[/QUOTE]
Rather than checking it on click, do it in a think hook.
[code]
forward.Think = function()
if forward:IsDown() then
RunConsoleCommand( "+forward" )
elseif not forward:IsDown() then
RunConsoleCommand( "-forward" )
end
end
[/code]
[QUOTE=Z0mb1n3;48681343][code]
elseif not forward:IsDown() then
[/code][/QUOTE]
Else is all you need
[QUOTE=Author.;48681413]Else is all you need[/QUOTE]
i literally just reformatted his own code, didn't really pay attention to that
Thank you, works like a charm!
A quick question:
A lot of players don't have CSS anymore. Would you require CSS when you were developing on a new gamemode? And how much do have css still installed do you think?
I'm running into an issue where every now and then TOOL:LeftClick (and rightclick) are being called twice in one click only on the client. Anyone know how I can fix this? Thanks.
[QUOTE=YourStalker;48682389]I'm running into an issue where every now and then TOOL:LeftClick (and rightclick) are being called twice in one click only on the client. Anyone know how I can fix this? Thanks.[/QUOTE]
[url]http://wiki.garrysmod.com/page/Prediction[/url]
[QUOTE=YourStalker;48682389]I'm running into an issue where every now and then TOOL:LeftClick (and rightclick) are being called twice in one click only on the client. Anyone know how I can fix this? Thanks.[/QUOTE]
It's prediction doing its thing. Wrap whatever you need executed once like so:
[lua]
if IsFirstTimePredicted() then
-- your code here
end
[/lua]
Thanks both Rubat and npypntz!
[QUOTE=Becomeimp;48665046]The math on one of my values keeps resetting?
In one file I have:
[code]
classpect_base = {}
classpect_base["health"] = 100
--CLASSES--
Lord = {}
Lord["health"] = classpect_base["health"] + 100
print(" Lord health is "..Lord["health"] )
[/code]
The print returns that it is indeed now at 200.
However I use the table in another file, where I've use a print to check it
[code] print(" Lord health is now "..Lord["health"].." ?!?!?!? " ) [/code]
And this returns only 100 ![/QUOTE]
bumping this from a few days ago, still no luck on even figuring out the problem
Hello guys, does anyone know why this keeps happening?
So my problem is that whenever the panel is created my steam profile pops up even though I haven't pressed the button.
When plyInfoPanel is create pl:ShowProfile() runs even though I haven't pressed the actual button.
[code]
function DrawButtons(w, h, x, y, text, ...)
local btn = vgui.Create("DButton", plyInfoPanel)
btn:SetSize(w,h)
btn:SetPos(x, y)
btn:SetText("")
function btn.Paint(self)
draw.RoundedBox(0, 0, 0, self:GetWide(), self:GetTall(), color_black)
draw.DrawText(text, "BMainLSmall", 50,4,color_white, TEXT_ALIGN_CENTER)
end
local funcList = {...}
function btn.DoClick() unpack(funcList) end
end
function PlayerInfoPanel(pl)
if IsValid(plyInfoPanel) then plyInfoPanel:Remove() end
plyInfoPanel = vgui.Create("DPanel")
plyInfoPanel:SetSize(400,400)
plyInfoPanel:SetPos(ScrW() / 2 - 200, ScrH() / 2 - 225)
function plyInfoPanel.Paint(self)
draw.RoundedBox(0, 0, 0, self:GetWide(), self:GetTall(), Theme.Background)
surface.SetDrawColor(Color(150,150,150,255))
surface.DrawOutlinedRect(0,0,self:GetWide(), self:GetTall())
draw.RoundedBox(0, 0, 0, self:GetWide(), 135, Theme.Top)
end
DrawButtons(100,25,25,140, "Steam Profile", true, false, false, pl:ShowProfile())
end
[/code]
You call ShowProfile in the 2nd line from the bottom. (Inside your DrawButtons function call)
[QUOTE=BoowmanTech;48683583]Hello guys, does anyone know why this keeps happening?
So my problem is that whenever the panel is created my steam profile pops up even though I haven't pressed the button.
When plyInfoPanel is create pl:ShowProfile() runs even though I haven't pressed the actual button.
[code]
function DrawButtons(w, h, x, y, text, ...)
local btn = vgui.Create("DButton", plyInfoPanel)
btn:SetSize(w,h)
btn:SetPos(x, y)
btn:SetText("")
function btn.Paint(self)
draw.RoundedBox(0, 0, 0, self:GetWide(), self:GetTall(), color_black)
draw.DrawText(text, "BMainLSmall", 50,4,color_white, TEXT_ALIGN_CENTER)
end
local funcList = {...}
function btn.DoClick() unpack(funcList) end
end
function PlayerInfoPanel(pl)
if IsValid(plyInfoPanel) then plyInfoPanel:Remove() end
plyInfoPanel = vgui.Create("DPanel")
plyInfoPanel:SetSize(400,400)
plyInfoPanel:SetPos(ScrW() / 2 - 200, ScrH() / 2 - 225)
function plyInfoPanel.Paint(self)
draw.RoundedBox(0, 0, 0, self:GetWide(), self:GetTall(), Theme.Background)
surface.SetDrawColor(Color(150,150,150,255))
surface.DrawOutlinedRect(0,0,self:GetWide(), self:GetTall())
draw.RoundedBox(0, 0, 0, self:GetWide(), 135, Theme.Top)
end
DrawButtons(100,25,25,140, "Steam Profile", true, false, false, pl:ShowProfile())
end
[/code][/QUOTE]
Because you're not storing a function, you're executing it and the 'return value' is taking its place.
What you should do instead is simply remove the set of parentheses after ShowProfile, and then rather than unpacking funcList, loop through and do something like
[CODE]
for _, v in pairs( funcList ) do
v()
end
[/CODE]
[QUOTE=ms333;48683828]You call ShowProfile in the 2nd line from the bottom. (Inside your DrawButtons function call)[/QUOTE]
I knew that but I just don't know why it runs it.
[editline]15th September 2015[/editline]
[QUOTE=Z0mb1n3;48684161]Because you're not storing a function, you're executing it and the 'return value' is taking its place.
What you should do instead is simply remove the set of parentheses after ShowProfile, and then rather than unpacking funcList, loop through and do something like
[CODE]
for _, v in pairs( funcList ) do
v()
end
[/CODE][/QUOTE]
Oh ok thanks for the explanation, I will try that and see what happens.
Also does anyone if there is a way to disable or remove the scrollbar of DSrollBar rather than paint it?
[QUOTE=BoowmanTech;48685262]I knew that but I just don't know why it runs it.
[editline]15th September 2015[/editline]
Oh ok thanks for the explanation, I will try that and see what happens.
Also does anyone if there is a way to disable or remove the scrollbar of DSrollBar rather than paint it?[/QUOTE]
Do you mean scrollbars made using DVScrollBar?
If so,
[code]
scrollbar.btnGrip:Remove()
[/code]
[QUOTE=Z0mb1n3;48685437]Do you mean scrollbars made using DVScrollBar?
If so,
[code]
scrollbar.btnGrip:Remove()
[/code][/QUOTE]
Tried it and it return an errors?
Do you know how I can run lua_run via RunConsoleCommand?
Whenever I run RunConsoleCommand using lua_run I get this: RunConsoleCommand: Command is blocked! (lua_run)
Sorry, you need to Log In to post a reply to this thread.