[QUOTE=B10H4Z4RD;48356742]I hate angles. How would I make [CODE]rocket:SetAngles( self.Owner:EyeAngles() )[/CODE] make the rocket entity go in the opposite direction of EyeAngles?[/QUOTE]
[code]
local ang = ( self.Owner:EyeAngles():Forward() * -1 ):Angle()
rocket:SetAngles( ang )
[/code]
I think it should be something like this.
Let's say I want to use FastDL so I can only extract a few models (player model / weapon)from a set.
A lot of times the materials for each model is very hard to distinguish whether or not the model actually uses it. Is there a way I can accurately tell every material that a model needs?
Guys...Sorry for offtopic...But what happend with acecool
[QUOTE=gonzalolog;48360399]Guys...Sorry for offtopic...But what happend with acecool[/QUOTE]
His chair _broke and _he _got depressed.
Guys, I'm having a problem with a Panel and tables in multiplayer.
With the panel (clientside) there's a table that has 3 values and everytime the user of the panel changes the values or add more than one entry, it sends it to the server with this function:
[code]
function SendTBLtoServer( tbl_test )
net.Start( "GETZ_TBL" )
net.WriteTable( tbl_test )
net.SendToServer()
end
[/code]
Now, on the server side, when receiving the Table I have this:
[code]
if (SERVER) then
util.AddNetworkString("GETZ_TBL")
function GetGlobalTBL(len, Player)
Global_TBL = net.ReadTable()
end
net.Receive( "GETZ_TBL", GetGlobalTBL)
end
[/code]
The problem is, this table gets overwritten/empty if another player is changing or removing values on the Panel. What I'm doing wrong here ?
Thanks in advance !
[QUOTE=nicolasx21;48362820]Guys, I'm having a problem with a Panel and tables in multiplayer.
With the panel (clientside) there's a table that has 3 values and everytime the user of the panel changes the values or add more than one entry, it sends it to the server with this function:
[code]
function SendTBLtoServer( tbl_test )
net.Start( "GETZ_TBL" )
net.WriteTable( tbl_test )
net.SendToServer()
end
[/code]
Now, on the server side, when receiving the Table I have this:
[code]
if (SERVER) then
util.AddNetworkString("GETZ_TBL")
function GetGlobalTBL(len, Player)
Global_TBL = net.ReadTable()
end
net.Receive( "GETZ_TBL", GetGlobalTBL)
end
[/code]
The problem is, this table gets overwritten/empty if another player is changing or removing values on the Panel. What I'm doing wrong here ?
Thanks in advance ![/QUOTE]
Well basically, what's happening is that whenever ANY user changes the values that are to be networked, they will in-fact be networked to the server, along with the client that changed their menu settings/values.
So, if you're hoping to have these networked values save to the player on the serverside of things, you need to receive the table and then copy it's contents over to a table that is attached to the player object(client) that sent the data, in your case, it would be the Player arg of your GetGlobalTBL function.
[QUOTE=Faedro;48362965]Well basically, what's happening is that whenever ANY user changes the values that are to be networked, they will in-fact be networked to the server, along with the client that changed their menu settings/values.
So, if you're hoping to have these networked values save to the player on the serverside of things, you need to receive the table and then copy it's contents over to a table that is attached to the player object(client) that sent the data, in your case, it would be the Player arg of your GetGlobalTBL function.[/QUOTE]
Thanks Faedro ! I've tried a bunch of combinations to save the table bu the players, but the problem still persists. Here's what I've tried: (btw this is a STOOL)
[code]
local Panel_STTable = {}
if (SERVER) then
util.AddNetworkString("GETZ_TBL")
function GetGlobalTBL(len, ply)
for k, v in pairs (player.GetAll()) do
if (v == ply) then
local Test1 = net.ReadTable()
Panel_STTable = {
[ply] = {
InsTable = Test1,
}
}
else
end
end
end
net.Receive( "GETZ_TBL", GetGlobalTBL)
end
[/code]
Now each settings are stored by player, but the problem is reading this table. I've made this code but it still get the data wrong:
[code]
function TOOL:LeftClick( trace )
local ply = self:GetOwner()
for k, v in pairs (Panel_STTable) do
if (k == ply) then
for key, val in SortedPairs ( v.InsTable ) do
print(val.Value1, val.Value2)
end
end
end
end
[/code]
How could I make it so, for each player in that table, it gets only the values of the player that is using the tool ?
[QUOTE=nicolasx21;48363658]Thanks Faedro ! I've tried a bunch of combinations to save the table bu the players, but the problem still persists. Here's what I've tried: (btw this is a STOOL)
[code]
local Panel_STTable = {}
if (SERVER) then
util.AddNetworkString("GETZ_TBL")
function GetGlobalTBL(len, ply)
for k, v in pairs (player.GetAll()) do
if (v == ply) then
local Test1 = net.ReadTable()
Panel_STTable = {
[ply] = {
AnimTable = Test1,
}
}
else
end
end
end
net.Receive( "GETZ_TBL", GetGlobalTBL)
end
[/code]
Now each settings are stored by player, but the problem is reading this table. I've made this code but it still get the data wrong:
[code]
local ply = self:GetOwner()
for k, v in pairs (Panel_STTable) do
if (k == ply) then
for key, val in SortedPairs ( v.InsTable ) do
print(val.Value1, val.Value2)
end
end
end
[/code]
How could I make it so, for each player in that table, it gets only the values of the player that is using the tool ?[/QUOTE]
What I'll do for you, is write up something that should help a lot, and send it to you via pm - it shouldn't take me too long.
[QUOTE=Faedro;48363704]What I'll do for you, is write up something that should help a lot, and send it to you via pm - it shouldn't take me too long.[/QUOTE]
Thank you so much ! I'm already having headaches trying to make this work :z
[QUOTE=nicolasx21;48363742]Thank you so much ! I'm already having headaches trying to make this work :z[/QUOTE]
[CODE]if ( SERVER ) then
util.AddNetworkString("GETZ_TBL")
local Panel_STTable = {}
function GetGlobalTBL() -- Creates a global utility function, for retrieving the table create above, if you ever need to do so from outside the file this code is placed in.
return Panel_STTable
end
local function ReceiveGlobalTBL( len, ply ) -- Creates a local function, used to receive the networked table.
-- The sending client has already been sent and received as ply, so there's no need to iterate through all other players here.
local tab = net.ReadTable() -- Localize the received table.
ply.Panel_STTable = {
AnimTable = {}
} -- Create the player oriented table to hold the received data.
table.CopyFromTo( tab, ply.Panel_STTable.AnimTable ) -- Copy the contents of the received table, to the table we created on the player object, as the received table will be lost after this function finishes.
-- If you wish to add the player oriented table to a globally-accessible index, remove the -- at the start of the next line.
--Panel_STTable[ply:SteamID()] = ply.Panel_STTable
end
net.Receive( "GETZ_TBL", ReceiveGlobalTBL )
-- If you opted to include the 'global indexing' of the player oriented table, the following must also be included! Uncomment it by removing the /* and */ at the start and end.
/*local function ClearStoolTableIndex( ply )
Panel_STTable[ply:SteamID()] = nil
end
hook.Add( "PlayerDisconnected", "ClearStoolTableIndex", ClearStoolTableIndex )*/
end[/CODE]
The above has been sent to you via PM, just posting it here also, in case somebody has a better solution.
[B]EDIT:[/B] I made a mistake with my initial post and what was sent via PM, please adjust the code on your end accordingly! I will send the updated code in a separate reply to the PM I sent you, for reference.
I'm trying to create a weapon that can spam a certain .wav file (Just to mess around with friends).
However EmitSound stops the current sound being played and starts the new one. Any way I can make them play on top of each other?
[QUOTE=JasonMan34;48363985]I'm trying to create a weapon that can spam a certain .wav file (Just to mess around with friends).
However EmitSound stops the current sound being played and starts the new one. Any way I can make them play on top of each other?[/QUOTE]
That would require some fiddling with audio channels... something I'm not quite up to myself... I'll see if I can point you in the right direction on the wiki though;
[B]Useful links:
[/B][url]http://wiki.garrysmod.com/page/Category:IGModAudioChannel[/url]
[url]http://wiki.garrysmod.com/page/sound/PlayFile[/url]
[url]http://wiki.garrysmod.com/page/Category:sound[/url]
EmitSound's chan argument might help
So I have this issue with disable and enabling...
Basically, I don't know how to tie the autohop with the disable / enable checkbox. anyone know what I should do?
[lua] local Button = vgui.Create( "DCheckBoxLabel", Frame )
Button:SetText( "Auto Hop!" )
Button:SetTextColor( Color( 255, 255, 255 ) )
Button:SetPos( 35, 250 )
Button:SetSize( 100, 30 )
Button:SetConVar( "autohop_enabled" )
hook.Add( "CreateMove", "autohop_enabled", function(cmd)
if me:IsOnGround() and input.IsKeyDown( KEY_SPACE ) then
RunConsoleCommand("+jump")
else
RunConsoleCommand("-jump")
end
end)
[/lua]
- snip -
Whoops, unconditional "return -1" in another hook in another addon I'm developing. It doesn't get stupider than that.
[b]Another issue:[/b]
CUtlLinkedList overflow! (exhausted index range) (65535)
CUtlLinkedList overflow! (exhausted index range) (65535)
CUtlLinkedList overflow! (exhausted index range) (65535)
I've done dozens of searches on this, and carefully read the FP posts on it, but no solution. It clearly happens as a result of particle emitters, even though I'm calling :Finish() on all my emitters, not creating materials every frame, and even setting my emitter references to nil every time to ensure they get garbage collected. Still, the client eventually goes haywire, with all the renderables disappearing and the only fix is to reconnect. I tried all of Acecool's solutions (and ensured they were running) but that didn't fix it.
It only happens on certain maps though. Md_clue, for instance, it'll happen after about two smoke bombs, but on gm_flatgrass I've set timescale to 10 and thrown bomb after bomb and I can't get it to happen. All the clients on my server experience this eventually, despite having all other addons disabled.
It doesn't seem to be a too-many-particles-in-too-short-a-time issue, as even with really low amounts of particles, it always [i]eventually[/i] happens. Seems to indicate that something is slowly getting used up (LinkedList buffer space, for example) and not getting released properly.
I've seen this problem reported all over the place, but no one can seem to offer a reason, a github bug report, or a workaround.
I'm messing around with PostPlayerDraw - I wanna write text/draw an image on the player's back, but what angle should I use so it's always facing the opposite of what the player is?
[QUOTE=Wigil2r;48368214]So I have this issue with disable and enabling...
Basically, I don't know how to tie the autohop with the disable / enable checkbox. anyone know what I should do?
[lua] local Button = vgui.Create( "DCheckBoxLabel", Frame )
Button:SetText( "Auto Hop!" )
Button:SetTextColor( Color( 255, 255, 255 ) )
Button:SetPos( 35, 250 )
Button:SetSize( 100, 30 )
Button:SetConVar( "autohop_enabled" )
hook.Add( "CreateMove", "autohop_enabled", function(cmd)
if me:IsOnGround() and input.IsKeyDown( KEY_SPACE ) then
RunConsoleCommand("+jump")
else
RunConsoleCommand("-jump")
end
end)
[/lua][/QUOTE]
I wrote this ages ago and it worked fine, might help you out:
[code]
local hdConfig = vgui.Create("DCheckBox", miscoptions)
hdConfig:SetPos(10, 110)
hdConfig:SetSize(16,16)
hdConfig:SetToolTip("When your shot hits, display a hitmarker in the crosshair.")
hdConfig:SetChecked(GetConVar("hm_enabled"):GetBool())
hdConfig.OnChange = function()
if hdConfig:GetChecked() then
RunConsoleCommand("hm_enabled", "1")
else
RunConsoleCommand("hm_enabled", "0")
end
end
hdConfig:SetVisible(true)
[/code]
Using [URL="http://wiki.garrysmod.com/page/file/Find"]file.Find[/URL] how would I go about finding all the files in a folder that exists in the same directory?
Am I able to use vector graphics in Garry's Mod as textures/materials? (.svg files)
Was making a HUD and I don't want the image I'm using to be pixelated if scaled to bigger screens...
[QUOTE=Z0mb1n3;48386643]Am I able to use vector graphics in Garry's Mod as textures/materials? (.svg files)
Was making a HUD and I don't want the image I'm using to be pixelated if scaled to bigger screens...[/QUOTE]
Someone made an converter to convert .svg files to Lua, I'm not sure if it's any good though.
Maybe look for that. Otherwise, no.
Is it possible to change servertags? sv_tags no longer exists but Garry's Mod still return some automatically generated ones ("gm" and "gmws") to queries.
How would I save an image of a map from a birds-eye view? Wanna encompass the entire map within the image.
[QUOTE=jaooe;48389611]How would I save an image of a map from a birds-eye view? Wanna encompass the entire map within the image.[/QUOTE]
[url]https://developer.valvesoftware.com/wiki/Level_Overviews[/url]
[QUOTE=Revenge282;48389686][url]https://developer.valvesoftware.com/wiki/Level_Overviews[/url][/QUOTE]
Thanks, that's informative, although I would like to do it programatically so I don't have to download every map my users play on.
[QUOTE=jaooe;48390242]Thanks, that's informative, although I would like to do it programatically so I don't have to download every map my users play on.[/QUOTE]
You're more than likely out of luck unless you do this per player and somehow render it on their screen. Probably would not be the most ideal solution.
[QUOTE=jaooe;48390242]Thanks, that's informative, although I would like to do it programatically so I don't have to download every map my users play on.[/QUOTE]
You could technically get the collision bounds of the worldspawn entity and do some maths taking into account the FOV of a player and just do a renderview call?
Anybody know how to check if a vehicle is unowned? Thanks in advance.
What happened to plugin_load?!
[QUOTE=#Sleepy;48392575]Anybody know how to check if a vehicle is unowned? Thanks in advance.[/QUOTE]
Unowned? By a prop protection addon, or by DarkRP?
[QUOTE=Z0mb1n3;48392655]Unowned? By a prop protection addon, or by DarkRP?[/QUOTE]
I wanna check if a car is owned by a player on DarkRP or not
[QUOTE=Mooda Looda;48392612]What happened to plugin_load?![/QUOTE]
It was abusable so instead of being blocked from access via Lua it was removed :downs:.
Sorry, you need to Log In to post a reply to this thread.