I am attempting to create a basic add-on to get a feel for how they work. After tons of research/dissecting of other add-ons, I believe I have a general understanding. My problem stems from an issue with client versus server side commands, and how I can load them accordingly. Here is some of my code:
if SERVER then
initialized = false
/* some code to implement my menu, like the REM_ShowMenu function and REM_HideMenu */
if ( initialized ) then return end
initialized = true
function REM_PlayerInitialSpawn( ply )
RunConsoleCommand( “REM_CS_Initialize” )
hook.Add( “PlayerInitialSpawn”, “REM_PlayerInitialSpawn”, REM_PlayerInitialSpawn)
Here is what I think it is supposed to do.
The /autorun/ folder loads up the module for the client and server, parsing it appropriately.
The *client * registers its own functions like REM_CS_Initialize.
The *server * loads and it hooks into the player spawn code at the console level.
As soon as a player spawns the server will force the newly loaded player to execute the REM_CS_Initialize code which, in turn, binds the +/-MENU commands. And voila, a basic plugin skeleton is born.
Unfortunately, I have no idea what is going on anymore. It seems like the client simply doesn’t register the commands and thus, is unable to access… anything.
I am simply looking for direction here. I tried to find a tutorial on addons; to no avail. So everything I know has been derrived from a few addons that I currently have code for.
Thank you for reading, I really appreciate any input you may have! I am practically going insane over this…