Call Server Commands From Client

I would like to change my dedicated server’s map from my client. Is there a way to authorize a client to run server commands such as ‘ServerTravel <MapName>’?

i believe if you set the clients authority right you can make it so they can

eg: Role < ROLE_Authority

i would say more but im half sleep

You need to set a RPC call from the client to the server.

In you server function implementation, you need to write the logic that will validate that the user who called the function has the appropriate right to do it (For example, you can set a bool on the PlayerController to say that this PC is an admin and you check this bool variable).
Then you can call whatever function you want as you are on the server side.

I’ll probably write an RPC for this instance but what about all of the console commands normally available to a listen server? Do I really have to write an RPC for every one. What if I am remotely logged into the windows server where I’m hosting the dedicated server, is there any way I can run console commands from there?

FYI for anyone searching for this in the future, the best way to do this is just the “ServerExec” console command. This sends its arguments as a console command on the server.

4 Likes