• Getting player variables in shared
    2 replies, posted
Ok, so the situation is I need to get a networked variable in shared, but I don't want to use console commands. Being more specific I have stored a model path in a NWString, this needs to be access on startup to set the players models to that previously defined model, which they choose before they even spawn. It is more difficult because I already have a system set in place to pre-define models for each team which people can choose in an in game menu. Only for this 1 team I need it so set it to a custom model. So my question is, how do I get it in shared so that I can pre-cache the model, and send the model info for that team to serverside? Edit: Another question I have, is how to make console commands only executable if it is through a bit of lua code you wrote, not the player entering it in console.
There's no such thing as shared. A shared file is a file that is ran on both client and server. This being said, you'd do your thing just like you did it before with other your model system, separating clientside code with [code]if CLIENT then /*code*/ end[/code] and serverside code with [code]if SERVER then /*code*/ end[/code] You can set NW var only on server, but you can read it on both client and server. I did not understand your second question.
[QUOTE=Robotboy655;41775746]There's no such thing as shared. A shared file is a file that is ran on both client and server. This being said, you'd do your thing just like you did it before with other your model system, separating clientside code with [code]if CLIENT then /*code*/ end[/code] and serverside code with [code]if SERVER then /*code*/ end[/code] You can set NW var only on server, but you can read it on both client and server. I did not understand your second question.[/QUOTE] Sorry :P New to lua. Picking stuff up as I go along. Thanks for the help.
Sorry, you need to Log In to post a reply to this thread.