how to make a script that runs a cmd on the console? Like rcon map_restart
Printable View
how to make a script that runs a cmd on the console? Like rcon map_restart
Cmds like map_restart are static and can only be added through engine itself.
But you can edit libcod and add your own cmds there by using Cmd_AddCommand
https://github.com/voron00/libcod/bl...r/bsp.cpp#L167
PHP Code:
void my_function()
{
printf("test\n");
}
Cmd_AddCommand("my_cmd_name", my_function);
I think he's asking to add like /rcon yourmom to do a thing.
You can do this via GSC scripts:
With libcod:
https://killtube.org/showthread.php?3153-callback-RCON
Without libcod:
PHP Code:
level endon("intermission");
setCvar("customcommand1", ""); // can be set via rcon as: /rcon customcommand1 value instead of /rcon set customcommand1 value
for (;;)
{
if (getCvar("customcommand1") != "") {
setCvar("customcommand1", "");
customcommand1();
}
wait 0.05;
}
customcommand1()
{
}