Vice City: Multiplayer

VC:MP Discussion => General Discussion => Topic started by: Blood Sucker on Jun 18, 2017, 07:20 PM

Title: About C++
Post by: Blood Sucker on Jun 18, 2017, 07:20 PM
Can I script a server with C++?
If yes where can I find the plugins and can I make the server with two programming languages? (Squirrel and C++)
I hope I didn't break any rules by posting this ;D :D
Title: Re: About C++
Post by: EK.IceFlake on Jun 18, 2017, 07:23 PM
You don't use a plugin to script in C++. Your plugin is your script itself.
Here (https://forum.vc-mp.org/?topic=3595.0) is an example of that and here (https://forum.vc-mp.org/?topic=13.msg30574#msg30574) are details on how to do something similar.

Keep in mind though that using C++ has a lot of disadvantages. One major one would be no error handling. You mess up and the server crashes. There's no nice error message like you get in Squirrel detailing the error and the location where it occurred.
Title: Re: About C++
Post by: Stormeus on Jun 18, 2017, 07:37 PM
Your server is not necessarily going to be better off using C++ unless you need access to low-level system interfaces or have extremely tight performance constraints. Even if you think you need to use C++, I think it's generally better to use the Java plugin since it's still versatile enough for things like multi-threading without having to deal with debugging segfaults and memory leaks when something is wrong.

Personally, the only reason I would script a server in C/C++ is for testing new server versions under development with added API calls, only because it's faster to iterate on that than it is to have to modify another scripting plugin and test that.
Title: Re: About C++
Post by: Blood Sucker on Jun 18, 2017, 07:57 PM
WoOoW the biggest two nerds in VC-MP answered xD
Ty for your support guys :D
Title: Re: About C++
Post by: ysc3839 on Jun 20, 2017, 05:50 PM
Yes.
Plugin API header.