PDA

View Full Version : Send a console command to the server



S. H. Lynx
26-01-2016, 10:09 PM
As the title implies I want to know if there's a method that allows me to send a String to the server's console.

Thanks in Advance.

KliPPy
27-01-2016, 05:01 AM
There doesn't seem to be a way, I can't find anything in the docs. Possibly made like so to protect servers from malicious plugins.

nico
27-01-2016, 05:21 AM
rcon_password <the password>
rcon <command>

KliPPy
27-01-2016, 05:27 AM
rcon_password <the password>
rcon <command>

I believe he wants to do it from an AS plugin, not the console. Why else would he be in the AS Helpdesk forum?

nico
27-01-2016, 05:29 AM
I believe he wants to do it from an AS plugin, not the console. Why else would he be in the AS Helpdesk forum?
Oh sorry, didn't see this was in the Angelscript section.

There is "rcon as_command <cmd>" though.

KliPPy
27-01-2016, 05:33 AM
Oh sorry, didn't see this was in the Angelscript section.

There is "rcon as_command <cmd>" though.

That still requires player input. enginefuncs_t structure originally contains a pfnServerCommand function pointer, but looks like it isn't included in the AngelScript API for security reasons. Unless there is some alternative (most likely not) which I am not able to find in the docs.

Solokiller
27-01-2016, 06:13 AM
Which commands are you trying to execute?

S. H. Lynx
27-01-2016, 06:40 AM
Any, really, anything that can be input in the console.

I guess if there's no method I'll have to use g_EngineFuncs.CVarSetFloat("[COMMAND]", 0); and hope it will work. (or CVarSetString if such method exists)

Solokiller
27-01-2016, 06:57 AM
Which commands, specifically? This function was not exposed to prevent plugins from changing things they shouldn't. If you have need for specific commands, the function can be exposed with a whitelist of allowed commands.

Mr.angry
15-02-2016, 04:27 AM
Being able to exec cfg files would be nice.

tridz
15-02-2016, 05:41 AM
Sorry I dont understand.
What is the difference between using rcon command and an angelscript sending the command?
Is it really necessary??
Also you can exec cfg files using rcon exec configname.
I think I am missing something :)