[Plugin] nPawn - latest Pawn in SA-MP
#1

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 код:
new msg[.text{30}, .priority];
msg.priority 10;
strpack(msg.text"update: {30} means [30 char]");
print(
msg.text); 
2. Enumerated lists
PHP код:
// 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 код:
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 код:
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
Reply


Messages In This Thread
nPawn - latest Pawn in SA-MP - by ge0r - 13.08.2016, 16:23
Re: nPawn - latest Pawn in SA-MP - by ~Error - 13.08.2016, 19:53
Re: nPawn - latest Pawn in SA-MP - by Sanady - 13.08.2016, 20:45
Re: nPawn - latest Pawn in SA-MP - by Crayder - 13.08.2016, 22:07
Re: nPawn - latest Pawn in SA-MP - by ge0r - 13.08.2016, 23:50
Re: nPawn - latest Pawn in SA-MP - by Dice_ - 14.08.2016, 01:28
Re: nPawn - latest Pawn in SA-MP - by Sanady - 14.08.2016, 08:51
Re: nPawn - latest Pawn in SA-MP - by ge0r - 14.08.2016, 21:15
Re: nPawn - latest Pawn in SA-MP - by Mauzen - 14.08.2016, 22:30
Re: nPawn - latest Pawn in SA-MP - by ge0r - 15.08.2016, 18:36
Re: nPawn - latest Pawn in SA-MP - by Belengher - 15.08.2016, 19:40
Re: nPawn - latest Pawn in SA-MP - by Spmn - 15.08.2016, 20:11
Re: nPawn - latest Pawn in SA-MP - by Kaperstone - 29.11.2017, 19:05
Re: nPawn - latest Pawn in SA-MP - by Salik - 30.11.2017, 10:03
Re: nPawn - latest Pawn in SA-MP - by Kaperstone - 06.12.2017, 04:34
Re: nPawn - latest Pawn in SA-MP - by cdoubleoper - 06.12.2017, 09:52
Re: nPawn - latest Pawn in SA-MP - by Romz - 26.12.2017, 05:10
Re: nPawn - latest Pawn in SA-MP - by rfr - 26.12.2017, 09:47

Forum Jump:


Users browsing this thread: 7 Guest(s)