• Console in player variable
    2 replies, posted
how can i make it so that i call function like this as a console: function test(ply) --somestuff end So that the ply is the console cause i wanted to call some functions from another addon but in the chat schould appear that the console does something. Thx for any help.
Try NULL instead of ply.
[QUOTE=BigBrainAFK;44541923]how can i make it so that i call function like this as a console: function test(ply) --somestuff end So that the ply is the console cause i wanted to call some functions from another addon but in the chat schould appear that the console does something. Thx for any help.[/QUOTE] Do something like this: [lua]concommand.Add( "rcon_test", function( _p, _cmd, _args ) // If the accessing player is not at the server console ( NULL ), // AND they are NOT SuperAdmin, then // log it in console with nickname and steamid and return to stop calling the code if ( _p != NULL && !_p:SuperAdmin( ) ) then // If the code gets here, then the player should be set ErrorNoHalt( "User attempted to access rcon_test " .. _p:Nick( ) .. " [" .. _p:SteamID( ) .. "]" ); return; end // Run the code which only SuperAdmins and RCON ( ie players typing at the server console ) should run --... --... --... end );[/lua]
Sorry, you need to Log In to post a reply to this thread.