Building Server Plugins

Started by umar4911, Jun 11, 2018, 10:56 AM

Previous topic - Next topic

EK.IceFlake

Quote from: umar4911 on Jun 20, 2018, 08:12 AM
Quote from: Xmair on Jun 20, 2018, 06:00 AM
Quote from: umar4911 on Jun 19, 2018, 11:43 AMIf auto record is not available then I want to script a plugin when sent a command to it, it closes an application running in the server's background(not client).
You don't really need a plugin for it, just use the system() function.
Can you give me a little for info?
function pkill(pattern, signal="SIGTERM") {
    system("pkill --signal " + signal + " " + pattern);
}
on Linux.

Usage:
pkill("firefox"); //gracefully close firefox
pkill("chromium", "SIGKILL"); //force close chromium

umar4911

Quote from: EK.IceFlake on Jun 20, 2018, 11:28 AM
Quote from: umar4911 on Jun 20, 2018, 08:12 AM
Quote from: Xmair on Jun 20, 2018, 06:00 AM
Quote from: umar4911 on Jun 19, 2018, 11:43 AMIf auto record is not available then I want to script a plugin when sent a command to it, it closes an application running in the server's background(not client).
You don't really need a plugin for it, just use the system() function.
Can you give me a little for info?
function pkill(pattern, signal="SIGTERM") {
    system("pkill --signal " + signal + " " + pattern);
}
on Linux.

Usage:
pkill("firefox"); //gracefully close firefox
pkill("chromium", "SIGKILL"); //force close chromium
Can I get the syntax of it?
Using the function, does it kill process or what?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

NicusorN5

#17
http://www.cplusplus.com/reference/cstdlib/system/ <-- system() function usage

And yes, you can use system() to freeze a server, delete files, close processes, close the server, and many other evil things :
/exec system("exit");
^^ That one closes the server.

umar4911

Quote from: Athanatos(^_^) on Jun 20, 2018, 02:41 PMhttp://www.cplusplus.com/reference/cstdlib/system/ <-- system() function usage

And yes, you can use system() to freeze a server, delete files, close processes, close the server, and many other evil things :
/exec system("exit");
^^ That one closes the server.

I still didn't get it. I read it multiple times
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

NicusorN5

Quoteint system (const char* command);

Execute system command
Invokes the command processor to execute a command.

That's all you gotta know.

Xmair

In windows, the system command does everything that the command line (cmd.exe) does.
The same goes to Linux.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

umar4911

Quote from: Xmair on Jun 22, 2018, 06:46 AMIn windows, the system command does everything that the command line (cmd.exe) does.
The same goes to Linux.
I need to close a bat file using the command. The process bat file use is cmd.exe and I was unable to close it.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter