SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 13/08/2016, 05:23 PM   #1
ge0r
Little Clucker
 
Join Date: Jul 2013
Posts: 29
Reputation: 57
Default nPawn - latest Pawn in SA-MP

This plugin updates Pawn to the latest version from CompuPhase's repository without loss of original API.


Overview of main Pawn changes:

1. Structures
PHP Code:
new msg[.text{30}, .priority];
msg.priority 10;
strpack(msg.text"update: {30} means [30 char]");
print(
msg.text); 
2. Enumerated lists
PHP Code:
// from file.inc
const filemode:
{
io_read 0/* file must exist */
io_write/* creates a new file */
io_readwrite/* opens an existing file, or creates a new file */
io_append/* appends to file (write-only) */

3. Lots of new natives in Pawn includes, e. g., functions that were added to file.inc:
PHP Code:
native boolfcopy(const source[], const target[]);
native boolfrename(const oldname[], const newname[]);
native boolfcreatedir(const name[]);
native boolfstat(name[], &size 0, &timestamp 0, &mode 0, &inode 0);
native boolfattrib(const name[], timestamp=0attrib=0x0f);
native filecrc(const name[]);

// ini reader
native readcfg(const filename[]=``'', const section[]=``'', const key[], value[], size=sizeof value, const defvalue[]=``''bool:pack=true);
native readcfgvalue(const filename[]=``'', const section[]=``'', const key[], defvalue=0);
native boolwritecfg(const filename[]=``'', const section[]=``'', const key[], const value[]);
native boolwritecfgvalue(const filename[]=``'', const section[]=``'', const key[], value);
native booldeletecfg(const filename[]=``'', const section[]=``'', const key[]=``''); 
Also you can read about changes at official page: http://www.compuphase.com/pawn/pawnhistory.htm


Changes and additions for API that aren't related to Pawn update:

1. Callback arguments are packed
2. It's safe to use packed strings with SA-MP functions
3. Some natives like GetPlayerName/GetWeaponName/etc got argument bool:ispacked=true at end.
4. format native that was taken from AMXMODX has been replaced with Pawn's strformat.
5. New include: a_vec.inc. It includes Vector3-powered versions of some SA-MP functions that have "Vec" suffix. Vector3 is a structure with fields Float, Float:y and Float:z. Example of usage:
PHP Code:
new pos[Vector3];
GetPlayerPosVec(playeridpos);
pos.+= 20.0;
SetPlayerPosVec(playeridpos); 

Known issues:

- filterscripts crash the server. Looks like it will not be fixed because it will break support of most SA-MP versions or/and reduce performance
- Some plugins may not work with nPawn. Most of sampgdk-based plugins will not work.


Links:
Source code: https://github.com/g3o0or/npawn-samp
Binaries (Windows/Linux plugin and pawncc): https://github.com/g3o0or/npawn-samp/releases
Resources (updated includes and examples): https://github.com/g3o0or/npawn-samp...ster/resources

Last edited by ge0r; 14/08/2016 at 10:17 PM.
ge0r is offline   Reply With Quote
Old 13/08/2016, 08:53 PM   #2
~Error
Big Clucker
 
~Error's Avatar
 
Join Date: Nov 2011
Location: Kongeriket Norge
Posts: 74
Reputation: 5
Default Re: nPawn - latest Pawn in SA-MP

BIG UP dude
Gonna try this right now!
__________________
Viva La PAWN!
~Error is offline   Reply With Quote
Old 13/08/2016, 09:45 PM   #3
Sanady
High-roller
 
Sanady's Avatar
 
Join Date: May 2012
Location: Los Santos
Posts: 1,467
Reputation: 132
Default Re: nPawn - latest Pawn in SA-MP

It`s nice script. But me and my friend, we saw this:
Code:
- Some plugins may not work with nPawn. Most of multithreaded plugins will not work.
This issue is worries us, it will be fixed in next update or not?
__________________

Sanady is offline   Reply With Quote
Old 14/08/2016, 12:50 AM   #4
ge0r
Little Clucker
 
Join Date: Jul 2013
Posts: 29
Reputation: 57
Default Re: nPawn - latest Pawn in SA-MP

Quote:
Originally Posted by Sanady View Post
it will be fixed in next update or not?
Yes, I'm currently working on improving compatibility. I've just fixed compatibility with some plugins, but Streamer's initialization still fails. Updated binaries will be available later.
ge0r is offline   Reply With Quote
Old 14/08/2016, 09:51 AM   #5
Sanady
High-roller
 
Sanady's Avatar
 
Join Date: May 2012
Location: Los Santos
Posts: 1,467
Reputation: 132
Smile Re: nPawn - latest Pawn in SA-MP

Quote:
Originally Posted by ge0r View Post
Yes, I'm currently working on improving compatibility. I've just fixed compatibility with some plugins, but Streamer's initialization still fails. Updated binaries will be available later.
Glad to hear that.
__________________

Sanady is offline   Reply With Quote
Old 14/08/2016, 10:15 PM   #6
ge0r
Little Clucker
 
Join Date: Jul 2013
Posts: 29
Reputation: 57
Default Re: nPawn - latest Pawn in SA-MP

Quote:
Originally Posted by Sanady View Post
it will be fixed in next update or not?
Latest update works well with MySQL R39-5 (needs to replace enum with const and replace [] = "" with [] = ``''), log plugin (needs to replace enum with const), sscanf (needs to replace [MAX_PLAYERS char] -> {MAX_PLAYERS} and [ % 7] -> { % 7} in sscanf2.inc), nativechecker and Pawn.CMD. Don't work only sampgdk-based plugins (Streamer).
ge0r is offline   Reply With Quote
Old 14/08/2016, 11:30 PM   #7
Mauzen
Godfather
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 5,128
Reputation: 1548
Default Re: nPawn - latest Pawn in SA-MP

Looks nice. So it actually replaces samps internal pawn interpreter with the new version?
A performance comparison would be nice to see, i cant test this on my own atm.
Mauzen is offline   Reply With Quote
Old 15/08/2016, 07:36 PM   #8
ge0r
Little Clucker
 
Join Date: Jul 2013
Posts: 29
Reputation: 57
Default Re: nPawn - latest Pawn in SA-MP

Quote:
Originally Posted by Mauzen View Post
Looks nice. So it actually replaces samps internal pawn interpreter with the new version?
A performance comparison would be nice to see, i cant test this on my own atm.
In some cases it wins, but in most cases it's (temporarily) bit slower. In future versions perfomance will be improved as plugin will use optimized abstract machine.
ge0r is offline   Reply With Quote
Old 13/08/2016, 11:07 PM   #9
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,854
Reputation: 585
Default Re: nPawn - latest Pawn in SA-MP

When a safer solution is made, I'd definitely use this. It just doesn't exactly seem possible to fully support the latest PAWN without implementing this in the SA-MP server itself.

But still, you've done a really nice job.
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is online now   Reply With Quote
Old 14/08/2016, 02:28 AM   #10
Dice_
Huge Clucker
 
Dice_'s Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 429
Reputation: 48
Default Re: nPawn - latest Pawn in SA-MP

I hope that you can fix this..
Quote:
- filterscripts crash the server. Looks like it will not be fixed because it will break support of most SA-MP versions or/and reduce performance
__________________
soon.
Dice_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 03:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.