[QUOTE=RedNinja;47475535]How do I get a player's team?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/Team]Player:Team[/url]
[QUOTE=RedNinja;47475535]How do I get a player's team?[/QUOTE]
[lua]ply:Team ( )[/lua]
[QUOTE=tzahush;47475328]if i got a class of a weapon, how would i get its ammo type?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/weapons/Get]weapons.Get[/url]
Then, use .Primary.AmmoType or .Secondary.AmmoType, depending on what AmmoType you want to get.
[editline]7th April 2015[/editline]
Right in the auto-merge
Hello,
How can i change the weapons selection menu for a gamemode?
Anyone know how to grab the server's IP address using lua?
[QUOTE=ROFLBURGER;47476555]Anyone know how to grab the server's IP address using lua?[/QUOTE]
Drakehawke made this a while back:
[url]http://facepunch.com/showthread.php?t=1160598&p=38629185&viewfull=1#post38629185[/url]
[QUOTE=ROFLBURGER;47476555]Anyone know how to grab the server's IP address using lua?[/QUOTE]
I think ip is a convar. You can use that?
[QUOTE=Bo98;47476603]Drakehawke made this a while back:
[url]http://facepunch.com/showthread.php?t=1160598&p=38629185&viewfull=1#post38629185[/url][/QUOTE]
Neat. I asked him if I could use that function for my future scriptfodder script.
[QUOTE=ROFLBURGER;47476656]Neat. I asked him if I could use that function for my future scriptfodder script.[/QUOTE]
Sure. Surprised you guys managed to dig that up.
[editline]7th April 2015[/editline]
[QUOTE=bobbleheadbob;47476638]I think ip is a convar. You can use that?[/QUOTE]
This only works if you use the +ip command line option. Not everybody does.
[editline]7th April 2015[/editline]
Jesus christ was that really 2 and a half years ago? That makes me feel old :(
need help with opening html links
i'm trying to open an html file from dropbox using OpenURL but it isn't working
the file is named
Disclaimer.html
[QUOTE=Lixquid;47475562][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/weapons/Get]weapons.Get[/url]
Then, use .Primary.AmmoType or .Secondary.AmmoType, depending on what AmmoType you want to get.
[editline]7th April 2015[/editline]
Right in the auto-merge[/QUOTE]
GetStored for this
[QUOTE=ROFLBURGER;47477333]need help with opening html links
i'm trying to open an html file from dropbox using OpenURL but it isn't working
the file is named
Disclaimer.html[/QUOTE]
OpenURL should work fine. Got example code?
What happens when you try to use OpenURL?
[QUOTE=Bo98;47477526]OpenURL should work fine. Got example code?
What happens when you try to use OpenURL?[/QUOTE]
[code]function OpenWarningDerma()
--local HMTL = file.Read("OhGodWhatHaveIDone/Disclaimer.html","MOD")
local Link = "http://dl.dropboxusercontent.com/u/40986413/Disclaimer.html"
local Frame2 = vgui.Create( "DPanel" )
Frame2:SetSize( ScrW() , ScrH() )
Frame2:Center()
Frame2:MakePopup()
local Panel2 = vgui.Create("DHTML",Frame)
Panel2:Dock(FILL)
Panel2:OpenURL(Link)
--Panel2:SetHTML(Warning)
Panel2:SetMouseInputEnabled(false)
Panel2:SetScrollbars(false)
Panel2:SetAllowLua( false )
Panel2:SetKeyboardInputEnabled( false )
--function Panel2:ConsoleMessage(msg) end
timer.Simple(120, function()
Frame2:Remove()
end)
end[/code]
I get a blank page.
Gonna ask this again since I never got a reply but I would like to report the issue somewhere -
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/PlayURL]sound.PlayURL[/url] doesn't work quite as it should.
Who can I report the issue to?
I've been trying to learn things about c++ modules and have come to a bit of a problem. I'm trying to call the concommand.Add function, but I'm unsure how to go about it.
[code]LUA->GetField(-1, "concommand");
LUA->GetField(-1, "Add");
LUA->PushString("command");
LUA->PushCFunction(SomeFunc); // Do I use this here and pass a C function or do I use some other method?
LUA->Call(2, 0);[/code]
I used the example of math.abs from the tutorials, but I'm unsure if that's the correct way to add a command since it requires a function to be passed.
Is it possible to set a value inside an entity's GetSaveTable()?
Specifically m_bInReload?
I've done it like entity.m_bInReload = true but it doesn't seem to respond to that. It sets the value but when I check it using GetSaveTable, it hasn't changed.
[QUOTE=Dannelor;47478654]I've been trying to learn things about c++ modules and have come to a bit of a problem. I'm trying to call the concommand.Add function, but I'm unsure how to go about it.
[code]LUA->GetField(-1, "concommand");
LUA->GetField(-1, "Add");
LUA->PushString("command");
LUA->PushCFunction(SomeFunc); // Do I use this here and pass a C function or do I use some other method?
LUA->Call(2, 0);[/code]
I used the example of math.abs from the tutorials, but I'm unsure if that's the correct way to add a command since it requires a function to be passed.[/QUOTE]
Try this.
[code]LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
LUA->GetField(-1, "concommand");
LUA->GetField(-1, "Add");
LUA->PushString("command");
LUA->PushCFunction(SomeFunc);
LUA->Call(2, 0);
LUA->Pop(2); // Pop the concommand and global table.[/code]
The Call function pops all arguments and the function, so that leaves only the concommand and global table to be popped. Here's an example for SomeFunc.
[code]int SomeFunc(lua_State* state)
{
LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
LUA->GetField(-1, "print");
LUA->PushString("Hello!");
LUA->Call(1, 0);
LUA->Pop(); // Pop the global table.
return 0;
}[/code]
This concommand would then print "Hello!" when ran.
[QUOTE=man with hat;47478706][/QUOTE]
Worked perfectly, thank you. I was missing the part about popping the extra stuff off.
[QUOTE=Z0mb1n3;47478657]Is it possible to set a value inside an entity's GetSaveTable()?
Specifically m_bInReload?
I've done it like entity.m_bInReload = true but it doesn't seem to respond to that. It sets the value but when I check it using GetSaveTable, it hasn't changed.[/QUOTE]
[url]http://wiki.garrysmod.com/page/Entity/SetSaveValue[/url]
what are the benefits of writing c++ modules?
[QUOTE=AnonTakesOver;47480546]what are the benefits of writing c++ modules?[/QUOTE]
More features that aren't available in Lua, or stronger modification of the Source code (afaik). I believe there was a module that handled net stuff a lot better and prevented players from accessing other people's IP's, but I could also be an idiot that doesn't remember stuff well.
How can i do a vip system for a gamemode
I don't know if i should use GetNWInt or another method.
[QUOTE=Abinox01;47480695]How can i do a vip system for a gamemode
I don't know if i should use GetNWInt or another method.[/QUOTE]
Player/GetUserGroup
Ok thanks
This one is more of a maths problem, I want to get the angle the player is looking at, but for some reason the Player:GetAimVector() isn't returning the values I need. What I'm trying to do is look at the sun painted in the skybox texture, get the aim angle, so I can plug in the values in hammer so I can place the light_environment and env_sun entities correctly.
[QUOTE=James xX;47481386]This one is more of a maths problem, I want to get the angle the player is looking at, but for some reason the Player:GetAimVector() isn't returning the values I need. What I'm trying to do is look at the sun painted in the skybox texture, get the aim angle, so I can plug in the values in hammer so I can place the light_environment and env_sun entities correctly.[/QUOTE]
Your better off just looking at BSP files to get the actual settings of the env_sun etc.
Not sure if it still works nowadays, but i think [url=http://nemesis.thewavelength.net/index.php?p=45]this tool[/url] will let you look at the settings of map entities, if it doesnt, google around a bit for BSP decompilers/viewers, the file format is well known, so theres bound to be multiple apps for it.
[QUOTE=Suicidal_B;47481427]Your better off just looking at BSP files to get the actual settings of the env_sun etc.
Not sure if it still works nowadays, but i think [url=http://nemesis.thewavelength.net/index.php?p=45]this tool[/url] will let you look at the settings of map entities, if it doesnt, google around a bit for BSP decompilers/viewers, the file format is well known, so theres bound to be multiple apps for it.[/QUOTE]
What I'm trying to do is get the angle of the sun painted in the skybox texture so I can set the env_sun to mimic it.
Oh sorry then i misunderstood you, i thought u where trying to get the angle of the sunrays (wich can relate too the used skybox btw, but is something totally different) my bad.
[QUOTE=James xX;47481386]This one is more of a maths problem, I want to get the angle the player is looking at, but for some reason the Player:GetAimVector() isn't returning the values I need. What I'm trying to do is look at the sun painted in the skybox texture, get the aim angle, so I can plug in the values in hammer so I can place the light_environment and env_sun entities correctly.[/QUOTE]
It seems really unlikely this is what you're asking for, but are you just asking how to get the angles of where a player's looking? ([img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetAngles]Entity:GetAngles[/url])
If not, you can get the angles of a vector with :Angle. ([img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/Angle]Vector:Angle[/url])
Again, if this doesn't help, please explain further what you're trying to do, it's still a bit unclear.
Sorry, you need to Log In to post a reply to this thread.