[ALPHA] PAWN wrapped to C++
#1

Recently I was working on wrapping 99% of PAWN SA-MP API functions and callbacks to C++ allowing to easily write gamemodes completely with C++. (I dislike PawnFunction(), don't complain). This resulted in a quite cute to my mind modular system, with clean code code and easy to use. It's Windows-only compatible now as I have never programmed for unix\linux\bsd

It even has some features :

The base of extensible modular system for programming gamemodes with C++.

Dynamic reloading of gamemode.dll on the fly. No need to quit the game or restart the server. Great for debug.

Built-in support for MySQL using open-source LibMySQL provided by MySQL dev team.

Embed insecure but very simple network protocol over TCP\IP.

Two code screenshots:

http://scary-zet.fatal.ru/stuff/samw_src1.png
http://scary-zet.fatal.ru/stuff/samw_src2.png

I decided to release the source code of the current alpha of my SA-MP C++ Wrapper. I define the license as GNU GPL.

Download: http://www.solyariscat.com/zet/
It also contains preconfigured sa-mp server inside.

There is the solution for Microsoft Visual Studio in the archive.

The system doesn't support multiple gamemodes on a server currently. However, this can be implemented.
Not all SA-MP API functions are ported. Review the samp.h for details. Don't complain.
A plugin for sa-mp server is wrapper.dll. The gamemode logic is defined by gamemode.dll.
empty.pwn server script is not empty due to testing reasons. Clean it if you wish.
wrapper.amx filterscript is required for SA-MP C++ Wrapper to work.

Put the code into the Gamemode project. Compile and enjoy. Both Wrapper and Gamemode will be compiled right into plugins folder if you don't change the folders structure.
When you re-compile your gamemode.dll, there's no need to shutdown the server or quit the game if you're online.
Review sys::CMySQL for MySQL support.
Review protocol::CSocket and protocol::XPacket for network support.

The version of code is alpha. It may contain bugs. Use it at your own risk.

Feedback is appreciated.
Reply
#2

Great
Reply
#3

Quote:
Originally Posted by JaTochNietDan
N0000! I only just learning Pawn!
LOL, You didn't learn pawn you have been posting around the entire forum looking for answers.

Also this C++ plugin is just that a "plugin" this in no way means the SA:MP team is gonna accept C++ Only because SA:MP is staying pawn.
Reply
#4

The only way to write a gamemode with C++ is to program it as a plugin for SA-MP Server, surely.
Reply
#5

Should it be released?

Of course, it'll help the community! It's up to you though.
Reply
#6

Quote:
Originally Posted by Towlies
Quote:
Originally Posted by JaTochNietDan
N0000! I only just learning Pawn!
LOL, You didn't learn pawn you have been posting around the entire forum looking for answers.

Also this C++ plugin is just that a "plugin" this in no way means the SA:MP team is gonna accept C++ Only because SA:MP is staying pawn.
Yes :P
Reply
#7

What are the supported functions for MySQL ?
Is it possible to add a support for the official plugins (IRC, GUIRCON anf SAM-MySQL) ?
Reply
#8

What the point of do this? Much better and easy write gamemodes on Pawno.
Reply
#9

Quote:
Originally Posted by d.wine
What the point of do this? Much better and easy write gamemodes on Pawno.
Have you programmed anything as hard as PEN1 or GTO or harder?
Reply
#10

Ignore those incapable of understanding the innumerable advantages of C over PAWN. For someone to even remotely imply that such a high-level, limited scripting language such as PAWN is comparable on any scale to C is simply ridiculous. Those that can say they have more programming experience than some weak, limited scripting language like PAWN are able to appreciate work like this. On the contrary, the only argument the other side can come up with is "C++ suki". Heh, nice plugin.
Reply
#11

Quote:

Heh, nice plugin.

Thank you, dude.

BTW: "Suki" does mean "love" in Japanese
Reply
#12

Quote:
Originally Posted by ZET
Quote:
Originally Posted by d.wine
What the point of do this? Much better and easy write gamemodes on Pawno.
Have you programmed anything as hard as PEN1 or GTO or harder?
I don't think it would be easy with C++, cos it would take the same amount of code.
Reply
#13

Lol, now I'm thinking if I write the new GTO in C++
Reply
#14

i only have 1 word for this:
AWSOME!!!!
thanks for releasing it, im sure it will help a lot of people
Reply
#15

Good job. The only advantage of PAWN gamemode over C++ one is that you don't need brainfucking under different OSes.
Reply
#16

Awesome time to learn C++

and to convert my script

maybe a simple tutorial on how to convert.

such as a small script

thxs
Reply
#17

Quote:
Originally Posted by Zero:VCK
Awesome time to learn C++

and to convert my script

maybe a simple tutorial on how to convert.

such as a small script

thxs
Just take a look to "Gamemode Simplified"...
There's all you need...
Reply
#18

Good job, Ive used(and will use) this as a 'reference', it's been real helpful. Thanks for sharing .
Reply
#19

thanks <3
Reply
#20

This plugin is umm... useless
[RAZ]ADreNaLiNe-DJ said it already:This work has been done already

Quote:

[REL] Gamemode plugins simplified v2
« on: June 26, 2007, 04:59:24 am »
Gamemode Plugins Simplified v2
What is this?
When I first tried to create a gamemode using plugins only, I realized it would involve much code repetition, and the actual concept looked harder than it actually was. Therefore I wrote this simple and flexible plugin that allows you to easily code gamemodes in pure C++; that is, the only AMX that's required is my simplified gamemode script. The rest is up to you obviously to fill in the functions with whatever appropriate code your gamemode requires!

http://forum.sa-mp.com/index.php?topic=21701.0

Use the search function next time :P

Bye!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)