[Plugin] CSTL - Data container(s) (Currently vector)
#21

Very nice plugin! Maybe i use it
Reply
#22

Just what I was in need of.
Is this a stable release and bug-free?
Reply
#23

I havent encountered any bugs nor crashes, but of course I cannot promise that they couldnt be possible.
Reply
#24

Very useful and nice release, Thanks for sharing this plugin.
Reply
#25

Great. But actually it isn't worth to make a streamer using this plugin, is it?
Cause the streamer that can handle "unlimited" objects (like yours and Incognito's) are already in plugin format + they're already using a better algorithm.
Reply
#26

Quote:
Originally Posted by Y_Less
View Post
Nice job. How well does this clean up after itself? When a mode ends are all saved items associated with that mode destroyed or will constantly reloading a mode without proper OnGameModeExit clean-up code cause memory leaks?
Actual memory leaking should not happen but currently vectors/maps are not automatically cleared. References to values are not lost (first this used char* pointers in vector, but I changed it to use std:tring for str values)
Reply
#27

Update
Now vectors and maps are specific to one AMX virtual machine (every filterscript and gamemode has own, you can have vector with same ID at same time in multiple scripts).
Also now structures are cleaned up on script unload. Thanks to Y-Less for mentioning these problems.
Reply
#28

Quote:
Originally Posted by Y_Less
View Post
I'm glad you're addressing these, however I have another suggestion - keep the AMX attachment as it is but offer some sort of share functionality so you can, if you want, use the containers in multiple scripts, as with the GVars plugin (or properties, which, Kyosaur, you could use for this LONG before plugins were available).
Yeah i know, i used them before the gvar plugin got look up speed improvements (i guess this was from the hash tables). I used to defend the properties (i actually did so early in the gvar topic) but there's no point anymore IMO.


Its pretty awesome to see more people release plugins like this. The one thing i hate about this forum is that there isnt a C/C++ help section. It would be really cool to actually have one where people could write tutorials, explain things about the PAWN SDK (which isnt even supported anymore), and just answer questions without complaining that "this isnt a C help forum". I feel this would help the community grow and become a lot better. It feels like when it comes to plugins, there is 0 support (especially since we dont even have an official SDK anymore) .

Anyways, Im glad to see the lack of support isnt stopping people/more people are developing (it felt like there were only a small few developers at one time ).
Reply
#29

Quote:
Originally Posted by Kyosaur
View Post
Yeah i know, i used them before the gvar plugin got look up speed improvements (i guess this was from the hash tables). I used to defend the properties (i actually did so early in the gvar topic) but there's no point anymore IMO.


Its pretty awesome to see more people release plugins like this. The one thing i hate about this forum is that there isnt a C/C++ help section. It would be really cool to actually have one where people could write tutorials, explain things about the PAWN SDK (which isnt even supported anymore), and just answer questions without complaining that "this isnt a C help forum". I feel this would help the community grow and become a lot better. It feels like when it comes to plugins, there is 0 support (especially since we dont even have an official SDK anymore) .

Anyways, Im glad to see the lack of support isnt stopping people/more people are developing (it felt like there were only a small few developers at one time ).
your words , my words
Reply
#30

Quote:
Originally Posted by SlashPT
View Post
Quote:
Originally Posted by Kyosaur
View Post
Yeah i know, i used them before the gvar plugin got look up speed improvements (i guess this was from the hash tables). I used to defend the properties (i actually did so early in the gvar topic) but there's no point anymore IMO.


Its pretty awesome to see more people release plugins like this. The one thing i hate about this forum is that there isnt a C/C++ help section. It would be really cool to actually have one where people could write tutorials, explain things about the PAWN SDK (which isnt even supported anymore), and just answer questions without complaining that "this isnt a C help forum". I feel this would help the community grow and become a lot better. It feels like when it comes to plugins, there is 0 support (especially since we dont even have an official SDK anymore) .

Anyways, Im glad to see the lack of support isnt stopping people/more people are developing (it felt like there were only a small few developers at one time ).
your words , my words
His words, Your words, my words.
Reply
#31

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
His words, Your words, my words.
His spam, your spam.

Any more examples with a "real" code implemented in a SA-MP server?
Reply
#32

Cool!
Reply
#33

Quote:
Originally Posted by ******
Посмотреть сообщение
I'm glad you're addressing these, however I have another suggestion - keep the AMX attachment as it is but offer some sort of share functionality so you can, if you want, use the containers in multiple scripts, as with the GVars plugin (or properties, which, Kyosaur, you could use for this LONG before plugins were available).
What you think if I make something like "vector_globalize(vecid)" and "vector_deglobalize(vecid)", would it be good idea? I think it would be stupid to make globalized counterpart for every native (gvector_set.. etc)
Reply
#34

Update

Added support for globalized containers (same container can be used in all loaded scripts)

New natives
Код:
native vector_globalize(vecid); // makes vector visible to all scripts (no data loss)
native vector_deglobalize(vecid); // deglobalizes vector (vector removed from all scripts except calling script)
native vector_is_globalized(vecid); // is vector ID globalized

native map_globalize(mapid); // makes map visible to all scripts (no data loss)
native map_deglobalize(mapid); // deglobalizes map (map removed from all scripts except calling script)
native map_is_globalized(mapid); // is map ID globalized
Also added map_clear for clearing a map.
Reply
#35

Very nice plugin.
Thought i'd post this video so some people have a better idea what vectors are, what they do and how they work. I Hope it helps some. There are 10 of these vids in total (not all about vectors obviously) . It says you should have good knowledge of c++. But if you know pawn you should realy understand what he is saying about vectors. These vids also have info on other types of containers. All the vids (in that series) are about the STL.
http://channel9.msdn.com/Shows/Going...phan-T-Lavavej

The second video has info on map.
Reply
#36

Thank you very much for this great plugin!

I'll be using it to create an inventory system. Without vectors I'd have to make a 5-dimensional array that PAWN doesn't support. Using this plugin you can split information into any number of dimensions you like. (storing vector in a vector in a vector in a vector and so on )

Great job!
Reply
#37

Quote:
Originally Posted by CaHbKo
Посмотреть сообщение
Without vectors I'd have to make a 5-dimensional array that PAWN doesn't support.

Great job!
This.

Thanks for the plugin, PAWN's limitations on storing data/dimensions suck.
Reply
#38

Since vector_get(_float) / map_get(_float) return -1 if vector id or element index isn't valid, what should I do if I actually put -1 or -1.0 in there?
Reply
#39

Use map_contains. And:

UPDATE
http://solidfiles.com/d/78b17/

Added new native:
native vector_index_exists(vecid, index);
- Check whether index is valid (returns 1/0 true/false)

Attention: Included linux .so is outdated, could somebody compile new linux library with latest sources and send it here? I would appreciate that.
Reply
#40

What does vector_find return if the given element is not found?

My code:
pawn Код:
stock GiveItem(playerid, itemid, amount = 1)
{
    new slot = vector_find(VectorID(playerid, ITEM_VECTOR_ID), itemid);
    FMSG(playerid, COL_ACTION, "PID:%d ITEMID:%d AMOUNT:%d || SLOT:%d SLOTITEM:%d", playerid, itemid, amount, slot, vector_get(VectorID(playerid, ITEM_VECTOR_ID), slot));
If I set itemid to something that already exists('15' on index 0), it returns it's index properly.


If I set it to something that doesn't exist (188) it returns index 1, which is set to zero.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)