• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
I'm stupid! GetConVar("gamemode"):GetString() works. [editline]fuck[/editline] Now how can I get the server's gamemode on the client? [editline]nerd[/editline] Synchronously?????????? Okay I'm done with this
[QUOTE=zerf;46990862]:( [editline]22nd January 2015[/editline] At the top of one of the addons: [lua] print(GAMEMODE_NAME, engine.ActiveGamemode(), (GAMEMODE and GAMEMODE.Name or "GAMEMODE was nil"), GetConVar("gamemode"):GetString()) [/lua] Result (current actual gamemode is deathrun): [code] nil base GAMEMODE was nil sandbox [/code] When ran through lua_run after everything was up and running: [code] deathrun deathrun Deathrun deathrun [/code] Pretty sure writing the next gm to file is my best option[/QUOTE] I've always used the Initialize hook for this sort of thing. It's called after your gamemode is loaded and is really the only way to do it.
Is there a way to mute footsteps using PlayerFootstep, trying to make CSGO style silenced footsteps where when you crouch and walk, footsteps are silenced.
[QUOTE=LUModder;46992103]Is there a way to mute footsteps using PlayerFootstep, trying to make CSGO style silenced footsteps where when you crouch and walk, footsteps are silenced.[/QUOTE] It says on the wiki.. [url]http://wiki.garrysmod.com/page/GM/PlayerFootstep[/url] [quote]Called whenever a player steps. [B]Return true to mute the normal sound.[/B][/quote]
[QUOTE=Robotboy655;46990456]You do realize Set/GetVar is not networked to client right? LOOK UP THE FUNCTIONS YOU USE ON THE WIKI BEFORE ASKING QUESTIONS.[/QUOTE] Welp. When printing its GetVar on the client it updated right. I must be misunderstanding something then.
I just noticed this is happening on my newly coded (and unfinished SENT).. something is fucked up. Not sure it's the physics or the drawing. [URL]http://youtu.be/03IyudE3ATI[/URL] Also this: [IMG]http://picload.org/image/cirorow/fdsafff.png[/IMG] What's causing this? Edit: Fixed. Still no idea why or how.
[QUOTE=VIoxtar;46993526]I just noticed this is happening on my newly coded (and unfinished SENT).. something is fucked up. Not sure it's the physics or the drawing. [URL]http://youtu.be/03IyudE3ATI[/URL] Also this: [IMG]http://picload.org/image/cirorow/fdsafff.png[/IMG] What's causing this?[/QUOTE] Something is falling through the map's (source engine's) void. I think it could be a combination of reconnecting to different servers and keeping their clientside "after effects". What I mean by aftereffects is that you're obviously playing in a server alone in gmod. Probably hosted from your own computer, correct? If so, connecting from a server that has failed physics maybe due to entity limit, or something similar. These "after effects" should vanish [B]IF[/B] you restart your gmod. It happens to me all the time. Also, you should look deeply into your code structure for that entity. If you did not code that entity, then chances are in the developer's hands.
-16k should still be within range, because I've had props fall through to 100k plus, but crazy physics removes props that would otherwise cause the server to crash because the physics has broken or is acting erratically typically caused by faulty parenting / constraining.
[QUOTE=rebel1324;46990788]Really? It can save Image file? [editline]23rd January 2015[/editline] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Write]file.Write[/url] It only saves string.[/QUOTE] Yes, it can save a .png or .jpg file from a string.
[QUOTE=Acecool;46993635]-16k should still be within range, because I've had props fall through to 100k plus, but crazy physics removes props that would otherwise cause the server to crash because the physics has broken or is acting erratically typically caused by faulty parenting / constraining.[/QUOTE] Please don't round off, the map limits are -16384 to 16384 for a total space of 32768, the values in the screen shot are out of range. The Z value is out of range on all those values.
[QUOTE=Cushie;46972625]other section doesnt have a similar thread and i didnt want to make one: i have only ever run servers dealing with a single gamemode, but i put one up recently for friends and they want a shit ton of random addons on just to mess around with in sandbox. problem is we want to play different modes like TTT as well without addons messing it up. i would have been able to just change the workshop command line to a different collection for different modes, but because of the size limit on workshop i had to manually extract and install some addons. is there another way that this can be managed without manually renaming lua/addons folders between changes? [/QUOTE] reposting this, still not sure the best way to go about it.
How do I play a sound without giving it a position? It should play on both speakers equally. It's actually an error message, is there a better way to do this? [url]http://wiki.garrysmod.com/page/sound/Play[/url] This example uses vPos.. when I try to run it like that, it gives me an error basically saying that vPos is nil (which I was kind of expecting). If I try to run the function without the position argument, it errors out as well. So I tried using EyePos(), but it sometimes only plays on one side of my headset! Any ideas?
If you're trying to play a sound to the client, and not in the 3D world, you could use sound.PlayFile, sound.PlayURL or surface.PlaySound
[QUOTE=Author.;46996935]surface.PlaySound[/QUOTE] Thanks! Edit: edited the [url=http://wiki.garrysmod.com/page/sound/Play]sound.Play page[/url] with this valuable information, and also changed the example so that it would actually work (as per [url]http://wiki.garrysmod.com/page/Help:Editing[/url] : "Try to make the example be ready for use by other people, so that they can throw it into their Lua file or use lua_run and it works").
Don't laugh. This is some seriously sad shit. I can't figure out how to get [u]10.0.0.1[/u] if given [u]10.0.0.1:1337[/u] I know it has to do with the string library. After a lot of Googling and apparently failing with using the functions I found, I'm finally forced to ask here.
you could [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/string/Explode]string.Explode[/url] and use : for the separator you'll get a table with 10.0.0.1 and 1337
[QUOTE=zeaga;46997517]Don't laugh. This is some seriously sad shit. I can't figure out how to get [u]10.0.0.1[/u] if given [u]10.0.0.1:1337[/u] I know it has to do with the string library. After a lot of Googling and apparently failing with using the functions I found, I'm finally forced to ask here.[/QUOTE] Here's one way to do it; [lua]local str = "10.0.0.1:1337" local startpos = str:find("():%d%d%d%d") print( string.sub(str, 0, startpos-1) ) -- Prints 10.0.0.1[/lua]
[code] local address, port = str:match("([^:]*):?(.*)") [/code]
[QUOTE=Fantym420;46997604]you could [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/string/Explode]string.Explode[/url] and use : for the separator you'll get a table with 10.0.0.1 and 1337[/QUOTE] I find this method works best. I tested this code out and it works perfectly: [lua]print( string.Explode( ":", "10.0.0.1:1337" )[1] )[/lua] I actually didn't know you could grab just one item of a table returned by a function. That's awesome. Thanks for the help, guys. I appreciate it.
Can anyone tell me where I can find the code lua for the default Combine Hoppermine entity? Or even better, how do I replicate the Hoppermine animation on the models/props_combine/combine_mine01.mdl prop?
[QUOTE=VIoxtar;47000002]Can anyone tell me where I can find the code lua for the default Combine Hoppermine entity? Or even better, how do I replicate the Hoppermine animation on the models/props_combine/combine_mine01.mdl prop?[/QUOTE] It isn't made in lua, it's made in C++. [url]https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/server/hl2/combine_mine.cpp[/url]
God damn. I'm not touching that then :P I just care about its animation, which I really wana replicate on my SENT. If you guys have any idea how to do that, please do let me know :)
Say I have a button material/texture, what would be the best way to increase or decrease it's width without fucking up the quality? Is simply changing the drawing width the best (and only) way?
[QUOTE=arcaneex;47000384]Say I have a button material/texture, what would be the best way to increase or decrease it's width without fucking up the quality? Is simply changing the drawing width the best (and only) way?[/QUOTE] Check out this function: [url]http://wiki.garrysmod.com/page/GWEN/CreateTextureBorder[/url] You should be able to use it with custom texture like this: [code] local old = SKIN.GwenTexture SKIN.GwenTexture = Material(mytexture) local myboxdrawingfunction = GWEN.CreateTextureBorder( ... ) SKIN.GwenTexture = old myboxdrawingfunction( ... ) [/code]
Does the netlib use TCP or UDP?
[QUOTE=Wyozi;47000518]Does the netlib use TCP or UDP?[/QUOTE] udp
I have a serversided table, which data I want to be printed / displayed on the clientside, using derma or w/e I decide. How do I transfer the table from the server to the client? Network library? If so, how?
[QUOTE=The Beta;47000717]I have a serversided table, which data I want to be printed / displayed on the clientside, using derma or w/e I decide. How do I transfer the table from the server to the client? Network library? If so, how?[/QUOTE] [url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url] Please check the Wiki before asking questions. There's even an example right there on that page that directly answers what you're asking. [lua] net.Start( "Example1" ) // start writing the net message net.WriteTable( tbl ) net.Broadcast() [/lua]
Did anybody ever notice that in multiplayer (sometimes? after some condition?) clientside tracers will no longer hit LocalPlayer()? The easiest way to test this is to try to right click in context menu on yourself through camera in sandbox.
[QUOTE=Mitsudigi;47000767][url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url] Please check the Wiki before asking questions. There's even an example right there on that page that directly answers what you're asking. [lua] net.Start( "Example1" ) // start writing the net message net.WriteTable( tbl ) net.Broadcast() [/lua][/QUOTE] Depending on what he wants to do there could be more efficient ways than [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/modules/net.lua#L95[/url]
Sorry, you need to Log In to post a reply to this thread.