Hey guys.
I am trying to make a small swep and for some reason in Singleplayer it gives me the right result, but in MultiPlayer it gives me a diffrent result.
It is the exact same code on both servers.
The video:
[video=youtube;J2BAatyCrKE]http://www.youtube.com/watch?v=J2BAatyCrKE[/video]
On multiplayer it makes the gunshot bullet + sound, which I don't want.
Thanks for the help.
Ive had an issue lile this but with includes. Local server auto includes. Online doesnt. Im pretty sure someone (acecool based jesus) can help.
A Local server is both the CLIENT and the SERVER at the same time. Make sure you use IsFirstTimePredicted( ) for clientside stuff that should be synced with the server. Also, I'd recommend setting up a local SRCDS which will give you essentially exactly the same result as hosting one elsewhere..
Setting up and developing on a local Source Dedicated Server ( SRCDS ) is vital when creating code you expect to run properly on an actual dedicated server.
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/setting_up_a_server_with_steamcmd.lua.html[/url]
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/fastdl_setup_instructions.lua.html[/url]
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/extracting_addons_to_remove_lua_etc.lua.html[/url]
Why are Listen Servers no good for dev work?
If you just start Garry's Mod, and create a server through the menu, you're creating a local Listen Server; while it can be done and isn't a bad thing if you just want to fool around, it causes issues because the SERVER is the CLIENT and the CLIENT is the SERVER.
Both SERVER and CLIENT code execute. Example: Say you have a global variable that is set up in a SERVER file like: blah = { };, and you do the same thing in a client file, then blah will be overwritten by the CLIENT or SERVER depending which one runs last...
To properly define a global, use blah = blah || { }; which will work during auto-refresh, or if code is SHARED. This method of creating globals should always be done ( unless the global is a CONST or Enumeration as those won't ever change values ), not only to remember data for auto-refresh compatibility, but in case the code is executed on a Listen Serv.. You should be able to test for a local Listen Serv by seeing if ( CLIENT == SERVER ) then ... end
It isn't feasible to use a Listen Server to host games unless you're just wanting to test out a new map by yourself or whatever... If your game crashes,then all clients get disconnected if you use it as a server. Not only if it crashes for whatever reason, BUT if your CLIENT code has a memory leak ( a lot of people put vgui.Create or surface.CreateFont inside of HUDPaint hook, which is WRONG ) then the SERVER has a memory leak and it will crash that much sooner. By using SRCDS you are removing the CLIENT out of the mix and eliminating a LARGE portion of things that can go wrong.
[QUOTE=Acecool;46080289]A Local server is both the CLIENT and the SERVER at the same time. Make sure you use IsFirstTimePredicted( ) for clientside stuff that should be synced with the server. Also, I'd recommend setting up a local SRCDS which will give you essentially exactly the same result as hosting one elsewhere..
Setting up and developing on a local Source Dedicated Server ( SRCDS ) is vital when creating code you expect to run properly on an actual dedicated server.
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/setting_up_a_server_with_steamcmd.lua.html[/url]
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/fastdl_setup_instructions.lua.html[/url]
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/extracting_addons_to_remove_lua_etc.lua.html[/url]
Why are Listen Servers no good for dev work?
If you just start Garry's Mod, and create a server through the menu, you're creating a local Listen Server; while it can be done and isn't a bad thing if you just want to fool around, it causes issues because the SERVER is the CLIENT and the CLIENT is the SERVER.
Both SERVER and CLIENT code execute. Example: Say you have a global variable that is set up in a SERVER file like: blah = { };, and you do the same thing in a client file, then blah will be overwritten by the CLIENT or SERVER depending which one runs last...
To properly define a global, use blah = blah || { }; which will work during auto-refresh, or if code is SHARED. This method of creating globals should always be done ( unless the global is a CONST or Enumeration as those won't ever change values ), not only to remember data for auto-refresh compatibility, but in case the code is executed on a Listen Serv.. You should be able to test for a local Listen Serv by seeing if ( CLIENT == SERVER ) then ... end
It isn't feasible to use a Listen Server to host games unless you're just wanting to test out a new map by yourself or whatever... If your game crashes,then all clients get disconnected if you use it as a server. Not only if it crashes for whatever reason, BUT if your CLIENT code has a memory leak ( a lot of people put vgui.Create or surface.CreateFont inside of HUDPaint hook, which is WRONG ) then the SERVER has a memory leak and it will crash that much sooner. By using SRCDS you are removing the CLIENT out of the mix and eliminating a LARGE portion of things that can go wrong.[/QUOTE]
Ok, well i still dont understand what creates the problem.
My file is a shared file with a few IF Servers and IF Clients, the shared part is the one that should be shared.
[editline]26th September 2014[/editline]
never mind Resolved.
Thanks!
Sorry, you need to Log In to post a reply to this thread.