SA-MP Forums Archive
Addititional Libraries for PAWN - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Addititional Libraries for PAWN (/showthread.php?tid=624978)



Addititional Libraries for PAWN - Yashas - 26.12.2016

https://github.com/YashasSamaga/PAWN-Library-Extension (25% completed)

I've had a secret plugin (yes, a secret, only a handful of people know that such a project exists) for years. The
plugin allowed me to use many of the C/++ standard libraries from your PAWN code. Apart from those, there are new libraries (Interscript communication, a completely new time library exclusively designed for PAWN, etc).

The plugin was really buggy and incomplete (and it worked only on Windows when compiled using VC++). The functions which worked properly were those which I used to use. Now I have decided to make a new copy of the same plugin but this time, I am writing it in such a way that it can be released.

CallExternalFunction vs CallRemoteFunction (500 publics in 3 scripts)


Код:
new efid = GetExternalFunctionID(0, "RandomPublic");
	if(efid == INVALID_EXT_FID) print("[TEST] GetExternalFunction failed.");
	
	new sk, id;
	GetExternalFunctionInfo(efid, sk, id);
	if(sk != 0) print("[TEST] GetExternalFunctionInfo failed.");
	if(id != 3) print("[TEST] GetExternalFunctionInfo failed.");
	
	new avg1 = 0, avg2 = 0, ret;
	for(new k = 0; k < 10; k++)
	{
		new a = GetTickCount();
		for(new i = 0; i < 1000000; i++)
		{
			CallExternalFunction(efid, ret, "iss", 1337, "abcdefg", "ABCD");
		}
		new b = GetTickCount();
		for(new i = 0; i < 1000000; i++)
		{
	    	//test(1337, "abcdefg", "ABCD");
			CallRemoteFunction("RandomPublic", "iss", 1337, "abcdefg", "ABCD");
		}
		new c = GetTickCount();
		avg1 += b-a;
		avg2 += c-b;
		
		printf("Trial #%d: %d %d" , k+1, b-a, c-b);
	}
	
	printf("\nAverage: %d %d" , avg1/10, avg2/10);
Every script has an id known as ScriptKey (assigned by the plugin) and an identification string know as ScriptIdentifier (which is set by the scripter).

All resources are shared. You can maintain a player id list (STL list) for the entire server instead of having a separate foreach in each script.

I wanted to know what libraries are needed (or there is something which is terribly slow as PAWN code and must be moved to a plugin).


Re: Addititional Libraries for PAWN - SyS - 26.12.2016

Pretty good


Re: Addititional Libraries for PAWN - SickAttack - 26.12.2016

tolower, toupper, CallLocalFunction, CallRemoteFunction

swap, SortArray


Re: Addititional Libraries for PAWN - Yashas - 26.12.2016

Already there.


Re: Addititional Libraries for PAWN - Yashas - 11.02.2017

Includes:
https://github.com/YashasSamaga/PAWN...r/includes/PLE

!Work in progress!