SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 30/07/2012, 11:51 PM   #21
Xentiarox
Big Clucker
 
Xentiarox's Avatar
 
Join Date: Jun 2012
Location: Tilburg, NL
Posts: 116
Reputation: 30
Default Re: Vectoral Pawn - STL Data containers for pawn

Quote:
Originally Posted by CaHbKo View Post
I already read that but didn't understand clearly... if you put some data in the deque and delete some data in the middle of it, it puts something else in it?
you can't remove data from the middle of a deque, you can access it though. You can only insert data at the beginning or the end of the deque and remove only from the beginning or the end. useful for first-in-first-out stuff.

Example codes of using each of the functions of the STL stuff can be found by clicking on the function names, for example deque_push_front:
http://www.cplusplus.com/reference/s...ue/push_front/

the syntax in pawn is a bit different.

Offtopic: I was browsing a lil bit onto the ****** code site and ounf an interesting project labeled "DO NOT DOWNLOAD".
https://gpb.******code.com/files/Vir...rage_alpha.zip
Virtual File System for SA-MP? WTF is this? And it doesn't load.
Anyone tell me how to use this? And plz compile a linux version if it's something usefull.
__________________
Professional scripting for low price. PM for details.
Pure Nederlandse DM

[img]http://*******/aYXdL[/img]
Xentiarox is offline   Reply With Quote
Old 31/07/2012, 06:15 AM   #22
cyber_punk
Gangsta
 
Join Date: Feb 2008
Location: Det. Mi. USA.....
Posts: 496
Reputation: 9
Default Re: Vectoral Pawn - STL Data containers for pawn

Oh nice, you beat me to the punch, I have been working mad hours and have not been able to do the STL data container plugin like I planned. It would be nice to see the rest of the STL data sets included. However MultiMaps I always thought would be a great addition to samp. Why would anyone want to re-query or reload a file if a player crashes? If you have the memory just store all player data in a multimap then pull it from memory. I would love to see some speed test results.
__________________
cyber_punk is offline   Reply With Quote
Old 31/07/2012, 11:03 AM   #23
Britas
Little Clucker
 
Britas's Avatar
 
Join Date: Nov 2011
Posts: 40
Reputation: 8
Default Re: Vectoral Pawn - STL Data containers for pawn

Wow, good job. ; )
__________________
Britas is offline   Reply With Quote
Old 02/08/2012, 02:07 PM   #24
Rancho
Big Clucker
 
Rancho's Avatar
 
Join Date: Jun 2012
Posts: 93
Reputation: 59
Default Re: Vectoral Pawn - STL Data containers for pawn

Sort functions for deque and vector added.

Example usage:

Code:
public OnFilterScriptInit(){
	new cvec = cvector();
	printf("ID->%d",cvec);
	cvector_push_back(cvec,19);
	cvector_push_back(cvec,11);
	cvector_push_back(cvec,15);
	cvector_push_back(cvec,1);
	cvector_push_back(cvec,0);
	cvector_push_back(cvec,40);
	for(new i=0; i<cvector_size(cvec); i++){
		printf("BEFORE SORT %d : %d",i,cvector_get(cvec,i));
	}
	cvector_sort(cvec,"DESCENDING");
	for(new i=0; i<cvector_size(cvec); i++){
		printf("AFTER SORT %d : %d",i,cvector_get(cvec,i));
	}
}

forward DESCENDING(vec_id,item1_id,item2_id);
public DESCENDING(vec_id,item1_id,item2_id){
	return (cvector_get(vec_id,item1_id) < cvector_get(vec_id,item2_id));
}

Outputs:
Code:
BEFORE SORT 0: 19
BEFORE SORT 1: 11
BEFORE SORT 2: 15
BEFORE SORT 3: 1
BEFORE SORT 4: 0
BEFORE SORT 5: 40
AFTER SORT 0: 40
AFTER SORT 1: 19
AFTER SORT 2: 15
AFTER SORT 3: 11
AFTER SORT 4: 1
AFTER SORT 5: 0

I will add other STL containers at future releases.
Rancho is offline   Reply With Quote
Old 03/08/2012, 03:07 AM   #25
Rancho
Big Clucker
 
Rancho's Avatar
 
Join Date: Jun 2012
Posts: 93
Reputation: 59
Default Re: Vectoral Pawn - STL Data containers for pawn

Example usage for Vectors & Maps:
http://pastebin.com/LNCNsmww
Rancho is offline   Reply With Quote
Old 22/08/2012, 11:34 PM   #26
Siralos
Big Clucker
 
Join Date: May 2011
Posts: 128
Reputation: 18
Default Respuesta: Vectoral Pawn - STL Data containers for pawn

Really nice tool.

Question: Is this faster or slower than using YSI foreach iterators? I know they are not the same, but they can be used for similar purposes.
Siralos is offline   Reply With Quote
Old 23/08/2012, 11:01 AM   #27
Siralos
Big Clucker
 
Join Date: May 2011
Posts: 128
Reputation: 18
Default Respuesta: Vectoral Pawn - STL Data containers for pawn

Somebody can explain how to do this whith vectoral (vectors, map, multimap)? I want to remove the fixed limit of 200/400

enum infoMap
{
static,
object,
}

new Maps[200][400][infoMap];

Thanks!

EDIT: NVM, already got

Last edited by Siralos; 23/08/2012 at 12:40 PM.
Siralos is offline   Reply With Quote
Old 23/08/2012, 11:14 AM   #28
SounDD
Big Clucker
 
Join Date: Jul 2012
Location: Romania
Posts: 181
Reputation: 8
Default Re: Vectoral Pawn - STL Data containers for pawn

Awesome
SounDD is offline   Reply With Quote
Old 23/08/2012, 01:18 PM   #29
Hanger
Huge Clucker
 
Join Date: Apr 2012
Location: UK
Posts: 204
Reputation: 32
Default Re: Vectoral Pawn - STL Data containers for pawn

Whats the use of it?

Benefits, Disadvantages, Speed?
__________________
Hanger is offline   Reply With Quote
Old 23/08/2012, 01:48 PM   #30
Siralos
Big Clucker
 
Join Date: May 2011
Posts: 128
Reputation: 18
Default Respuesta: Re: Vectoral Pawn - STL Data containers for pawn

Well, the use&benefits is clear, dynamic arrays... no more arrays with 'MAX_OBJECTS'.
The disadvantage is probably speed, but I'm not an expert, so I would not be able to say how much slower is cvector against normal arrays
Siralos 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tool/Web/Other] PAWN Scanner - Scan PAWN files for information. Slice Tools and Files 10 15/07/2012 08:09 PM
New to pawn, trying to convert some C code to pawn CHC Scripting Help 2 22/06/2012 06:09 AM
[Help With Pawn] Pawn and compiler is not working..... D_Less Client Support 3 09/03/2012 05:49 AM
[HELP] [pawn][/pawn] bbcode for phpbb3 Kasura Help Archive 4 20/11/2010 05:35 AM


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


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