View Full Version : Console script
mateocjs
25th April 2021, 11:48
how to make a script that runs a cmd on the console? Like rcon map_restart
voron00
26th April 2021, 00:06
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/blob/master/bsp.cpp#L167
void my_function()
{
printf("test\n");
}
Cmd_AddCommand("my_cmd_name", my_function);
IzNoGoD
26th April 2021, 07:04
I think he's asking to add like /rcon yourmom to do a thing.
Mitch
26th April 2021, 07:41
You can do this via GSC scripts:
With libcod:
https://killtube.org/showthread.php?3153-callback-RCON
Without libcod:
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()
{
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.