• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=Fillipuster;52446211]I was thinking in the lines of say, another addon handling some server-side hook. Would that still fire while the server is waiting for the MySQL return?[/QUOTE] No - Lua is not multi-threaded. It can't do more than one thing at once, and when you call query:wait(), it starts looping in C++ until it sees that the query is finished.
[QUOTE=YourStalker;52445865]If SWEP.Weight doesn't work then use the GM:SetPlayerSpeed hook.[/QUOTE] SWEP.Weight is not for weapon weight! It's for switch priority for auto-switching and picking up new weapons. Do not use SetPlayerSpeed since it will conflict with other addons -- modify the player's ucmd speed in a StartCommand or Move hook.
[QUOTE=YoutoYokodera;52446096]I did not use Weight i set the speed by SetRunSpeed in SWEP:Holster and Deploy But they doesn't change when i change weapon Using think hook to detect if the player is holding the swep would be a pain[/QUOTE] SWEP:Holster isn't called when you change weapon? That's odd. Try using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSwitchWeapon]GM:PlayerSwitchWeapon[/url] instead (And if the old weapon was your weapon, set the run speed back)
[QUOTE=JasonMan34;52446469]SWEP:Holster isn't called when you change weapon? That's odd. Try using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSwitchWeapon]GM:PlayerSwitchWeapon[/url] instead (And if the old weapon was your weapon, set the run speed back)[/QUOTE] Again, do not use SetPlayerSpeed. It'll just cause conflicts.
I'm making a custom tool that has a model convar created with [code]TOOL.ClientConVar[ "model" ][/code] When the tool is loaded I'm trying to check if the convar contains a valid model, and if not, change it to the default model. However, using GetConVar seems to return a nil value if the player hasn't fully loaded. How can I either get the convar while the player is still loading, or only check once the player has loaded? I could just run the function after a 30s timer but that's a hacky fix.
Shouldn't you be checking when they go to use the tool?
[QUOTE=Banana Lord.;52446790]Shouldn't you be checking when they go to use the tool?[/QUOTE] The tool already checks if the model is valid when attempting to place the entity, I just wanted to ensure the model was valid when loading into the server just incase another server or the user has messed up the convar. Checking each time the tool is pulled out is sort of redundant, but I guess it works better than messing about with timers. Thanks for the suggestion, using TOOL:Deploy works well.
Is there a reliable / simple way to send data realtime to a nodejs server?
You'd have to use a socket module if you want it realtime
[QUOTE=Banana Lord.;52448112]You'd have to use a socket module if you want it realtime[/QUOTE] Yeah.. I think I'm gonna try to implement WebSockets with bromsock. I just don't want to have a dll dependency for an admin mod.. At the same time fuck SQL. Thanks
[QUOTE=marvincmarvin;52448521]Yeah.. I think I'm gonna try to implement WebSockets with bromsock. I just don't want to have a dll dependency for an admin mod.. At the same time fuck SQL. Thanks[/QUOTE] You and I are trying to accomplish the same thing!
anyone know of a way to see what file/function called a specific hook? ex: function A runs ExitVehicle on player causing OnPlayerLeaveVehicle hook to call Can I trace where function A is from inside the hook?
[QUOTE=kpjVideo;52448764]anyone know of a way to see what file/function called a specific hook? ex: function A runs ExitVehicle on player causing OnPlayerLeaveVehicle hook to call Can I trace where function A is from inside the hook?[/QUOTE] Yeah, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/debug/getinfo]debug.getinfo[/url] can trace back to the original ExitVehicle call. [img]http://i.imgur.com/KzkDYAF.png[/img]
For me EyePos() and EyeAngles() always return 0 0 0, even though GM:CalcView returns proper values. (I mean I can look around just fine too). How is this even possible?
What is the proper way to add language support to custom tools? Right now I just have a addonname_languageinit file in my autorun folder that runs a bunch of language.Add() functions on the client. Can the resource/language/ folder be used / added to by addons or is it just for the base game? The fact that the sandbox language strings are directly in that folder rather than in their gamemode folder makes me think that maybe they can't?
[QUOTE=marvincmarvin;52448521]Yeah.. I think I'm gonna try to implement WebSockets with bromsock. I just don't want to have a dll dependency for an admin mod.. At the same time fuck SQL. Thanks[/QUOTE] To add onto this, I experimented a lot with using the http library with a REST API but it's just too slow and unreliable. Definitely stick with sockets.
[IMG]http://i.imgur.com/bqIUdqv.png[/IMG] Can someone help me with this please? It's probably really obvious but it won't return on the else return line. It's really annoying because it opens up 2 derma menus when I want it to open up one, please help.
[QUOTE=Shadow02;52449984][IMG]http://i.imgur.com/bqIUdqv.png[/IMG] Can someone help me with this please? It's probably really obvious but it won't return on the else return line. It's really annoying because it opens up 2 derma menus when I want it to open up one, please help.[/QUOTE] Your indentation makes this hard to read but I'm not sure why you didn't expect two menus to open? Ignoring the return part, both menus use the same condition to display ( person:IsPlayer() && person:Team() = TEAM ). If the first menu is opened by meeting that condition the obviously the second menu will open too.
[QUOTE=Shorthouse06;52450004]Your indentation makes this hard to read but I'm not sure why you didn't expect two menus to open? Ignoring the return part, both menus use the same condition to display ( person:IsPlayer() && person:Team() = TEAM ). If the first menu is opened by meeting that condition the obviously the second menu will open too.[/QUOTE] I've cleaned it up. Seems like the k, v in pairs check doesn't apply to the rest of the code for some reason. This is so frustrating, I just want to delete this annoying piece of shit. I can't find different conditions to use either, these are the only ones that I can use. [IMG]http://i.imgur.com/yzyCGul.png[/IMG]
Is there a way to get a client's custom Steam URL without making any calls to the Steam API?
[QUOTE=Sean Bean;52450203]Is there a way to get a client's custom Steam URL without making any calls to the Steam API?[/QUOTE] Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/http/Fetch]http.Fetch[/url] with the player's profile on xml display (steamcommunity.com/profiles/STEAMID64?xml=1). And check for <customURL>. I'll be able to explain better in 4 hours if no one does by then. [URL="http://steamcommunity.com/profiles/76561198111996676?xml=1"]Mine, for example[/URL] [QUOTE]<customURL> <![CDATA[ [B]JustJasonMan[/B] ]]> </customURL>[/QUOTE]
[QUOTE=JasonMan34;52450222]Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/http/Fetch]http.Fetch[/url] with the player's profile on xml display (steamcommunity.com/profiles/STEAMID64?xml=1). And check for <customURL>. I'll be able to explain better in 4 hours if no one does by then. [URL="http://steamcommunity.com/profiles/76561198111996676?xml=1"]Mine, for example[/URL][/QUOTE] I'd still rather not make any HTTP calls.
[QUOTE=Shadow02;52450175]I've cleaned it up. Seems like the k, v in pairs check doesn't apply to the rest of the code for some reason. This is so frustrating, I just want to delete this annoying piece of shit. I can't find different conditions to use either, these are the only ones that I can use. [IMG]http://i.imgur.com/yzyCGul.png[/IMG][/QUOTE] There's a whole bunch of problems and bad logic going on here. Not trying to be condescending but this is extremely basic programming logic and if you're struggling with this you're probably way out of your depth and would benefit more from attempting a simpler project to get a good grasp of programming fundamentals. I've properly indented your code to make it easier to understand and highlighted some areas. [IMG]https://i.imgur.com/RUF4FLw.png[/IMG] The for loop is doing nothing useful. The if statement I've highlighted in orange runs the isKeysOwnedBy function but then just ends without actually doing anything if it is. The blue if statement checks a condition and then if it is true, opens the buy menu. If it isn't then the function returns meaning that the green code will never be run. If you removed the return from the blue block and the green block did actually run, it's checking the exact same condition as the blue statement and so will just open the menu twice. There's fundamental flaws with your logic.
[QUOTE=Shorthouse06;52450235]There's a whole bunch of problems and bad logic going on here. Not trying to be condescending but this is extremely basic programming logic and if you're struggling with this you're probably way out of your depth and would benefit more from attempting a simpler project to get a good grasp of programming fundamentals. I've properly indented your code to make it easier to understand and highlighted some areas. [IMG]https://i.imgur.com/RUF4FLw.png[/IMG] The for loop is doing nothing useful. The if statement I've highlighted in orange runs the isKeysOwnedBy function but then just ends without actually doing anything if it is. The blue if statement checks a condition and then if it is true, opens the buy menu. If it isn't then the function returns meaning that the green code will never be run. If you removed the return from the blue block and the green block did actually run, it's checking the exact same condition as the blue statement and so will just open the menu twice. There's fundamental flaws with your logic.[/QUOTE] I see all of that and I understand it. I was tired and frustrated with it so I clearly threw a bunch of illogical shit at it that didn't even make any sense. I was originally running the loop with my net messages the way it should have been done but it kept returning errors (issues I can and will fix). I was working on the Derma all morning and should have really left a break after doing that before trying to run the functions. I've been doing this since I woke up at around 7am so it's driven me around the bend. I'll get back to it later. Thanks for your post anyway.
[QUOTE=Shadow02;52450280]I see all of that and I understand it. I was tired and frustrated with it so I clearly threw a bunch of illogical shit at it that didn't even make any sense. I was originally running the loop with my net messages the way it should have been done but it kept returning errors (issues I can and will fix). I was working on the Derma all morning and should have really left a break after doing that before trying to run the functions. I've been doing this since I woke up at around 7am so it's driven me around the bend. I'll get back to it later. Thanks for your post anyway.[/QUOTE] If you ever get frustrated with your code after working with it for a long time, just stand up and take a 5 or 10 minute break. It helps. It also helps, if you find yourself grappling with the same piece of code for a while, to scrap it all and then rewrite it piece by piece, making sure each little piece works individually.
What's the best way to synchronise a table with the client? I have a table of config values that are set from a file when the addon is loaded and I need every client to have a copy. The table won't need updating at all after the client receives a copy so that probably makes things easier.
[QUOTE=Shorthouse06;52450773]What's the best way to synchronise a table with the client? I have a table of config values that are set from a file when the addon is loaded and I need every client to have a copy. The table won't need updating at all after the client receives a copy so that probably makes things easier.[/QUOTE] Put the values in a shared file so that it is sent to the client when they join.
[QUOTE=code_gs;52450884]Put the values in a shared file so that it is sent to the client when they join.[/QUOTE] [DEL]The table is already in a shared file. The problem is that the code that retrieves the config values from a file and loads them into the table can obviously only run on the server so only the server's copy of the table gets updated while the client's remains nil.[/DEL] Edit - Nevermind, solved the problem by sending the table in a net message to a player when they initially spawn.
[QUOTE=Banana Lord.;52449933]To add onto this, I experimented a lot with using the http library with a REST API but it's just too slow and unreliable. Definitely stick with sockets.[/QUOTE] I think for an admin mod having a http request (or multiple) on a time based loop wouldn't be bad to have as an option. I don't want to force server owners to have 1 or even 2 dlls just for this.. If I do create a websocket library I want tls as an option for sure. This was an easy project like a week ago haha
Quite curious, haven't been able to find a straight forward way to do this. Is there any pre-defined panel that will sort into pages? For example; 10 models per page, then add to page 2... etc.
Sorry, you need to Log In to post a reply to this thread.