Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: umar4911 on Jun 11, 2018, 10:56 AM

Title: Building Server Plugins
Post by: umar4911 on Jun 11, 2018, 10:56 AM
How to make a vcmp plugin. Not asking to give me whole code. Just need directions and needs to requirements and the language to use. Rest, I will do it.
Title: Re: Building Server Plugins
Post by: Sk on Jun 11, 2018, 12:10 PM
This link will help you.
https://wiki.vc-mp.org/wiki/Introduction_to_the_Plugin_SDK
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 12, 2018, 10:44 PM
Quote from: Sk on Jun 11, 2018, 12:10 PMThis link will help you.
https://wiki.vc-mp.org/wiki/Introduction_to_the_Plugin_SDK
Thanks for the help. Btw I am still confused about the language.
Title: Re: Building Server Plugins
Post by: Stormeus on Jun 13, 2018, 12:02 AM
Plugins are written in C. If you don't understand it, you either need to learn it or stick with the language plugins that already exist.

Out of curiosity, what functionality are you trying to add by writing a plugin?
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 13, 2018, 07:08 AM
Quote from: Stormeus on Jun 13, 2018, 12:02 AMPlugins are written in C. If you don't understand it, you either need to learn it or stick with the language plugins that already exist.

Out of curiosity, what functionality are you trying to add by writing a plugin?
There are many function I want to add. One of them is auto-record a video in server-side.

Title: Re: Building Server Plugins
Post by: Xmair on Jun 13, 2018, 12:12 PM
Quote from: umar4911 on Jun 13, 2018, 07:08 AM
Quote from: Stormeus on Jun 13, 2018, 12:02 AMPlugins are written in C. If you don't understand it, you either need to learn it or stick with the language plugins that already exist.

Out of curiosity, what functionality are you trying to add by writing a plugin?
There are many function I want to add. One of them is auto-record a video in server-side.


That is not possible by a plugin, basically, most of the things you can do already come with the squirrel plugin.
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 19, 2018, 11:43 AM
If 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).
Title: Re: Building Server Plugins
Post by: . on Jun 19, 2018, 08:38 PM
Quote from: umar4911 on Jun 13, 2018, 07:08 AMThere are many function I want to add. One of them is auto-record a video in server-side.

From what source? I mean, what gives(streams?) you the video data to the server. And what are the contents of that video.

Chances are to be possible. But not if you intend what people are already thinking.

Also, encoding video files may not be as easy as `print(GetINIOption("player_password"))`. So be wary of the task you're attempting.
Title: Re: Building Server Plugins
Post by: Stormeus on Jun 19, 2018, 11:23 PM
Also, even if you could record video, what would you record a video of? Recording a video of every player at once would be prohibitive.

You need to step back. re-evaluate the problem you're trying to solve and come up with a different approach.
Title: Re: Building Server Plugins
Post by: kennedyarz on Jun 20, 2018, 02:03 AM
Quote from: Stormeus on Jun 19, 2018, 11:23 PMAlso, even if you could record video, what would you record a video of? Recording a video of every player at once would be prohibitive.

You need to step back. re-evaluate the problem you're trying to solve and come up with a different approach.

Monstrous lag
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 20, 2018, 04:18 AM
Actually I have spectate system in which we can spectate specific objects. I want to keep a record of them.

What about the other plugin. I want to close an application running in background.
Title: Re: Building Server Plugins
Post by: 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.
Title: Re: Building Server Plugins
Post by: 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?
Title: Re: Building Server Plugins
Post by: NicusorN5 on Jun 20, 2018, 10:07 AM
Isn't system() only running on the server? I mean you can't use system() at a client player, only in client side scripts?
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 20, 2018, 10:56 AM
Quote from: Athanatos(^_^) on Jun 20, 2018, 10:07 AMIsn't system() only running on the server? I mean you can't use system() at a client player, only in client side scripts?
I said server side.
Title: Re: Building Server Plugins
Post by: 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
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 20, 2018, 01:34 PM
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?
Title: Re: Building Server Plugins
Post by: NicusorN5 on Jun 20, 2018, 02:41 PM
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.
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 20, 2018, 05:16 PM
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
Title: Re: Building Server Plugins
Post by: NicusorN5 on Jun 20, 2018, 05:23 PM
Quoteint system (const char* command);

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

That's all you gotta know.
Title: Re: Building Server Plugins
Post by: Xmair on Jun 22, 2018, 06:46 AM
In windows, the system command does everything that the command line (cmd.exe) does.
The same goes to Linux.
Title: Re: Building Server Plugins
Post by: umar4911 on Jun 22, 2018, 07:29 AM
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.