SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Plugin Development (https://forum.sa-mp.com/forumdisplay.php?f=18)
-   -   [Plugin] Vectoral Pawn - STL Data containers for pawn (https://forum.sa-mp.com/showthread.php?t=364285)

Rancho 30/07/2012 09:30 AM

Vectoral Pawn - STL Data containers for pawn
 
This plugin allows to use "vector,deque,map,multimap" data containers in pawn.

VECTOR Natives:
pawn Code:
/************************************ [=Vector=] ************************************/
/************** [=Local Vectors=] **************/
native cvector(); // Create a new vector, Returns: created vector id
native cvector_push_back(vectorid,push_value); // Push back a value to vector
native cvector_push_back_arr(vectorid,push_arr[]); // Push back a string to vector
native cvector_push_back_float(vectorid,Float:push_float); // Push back a float value to vector
native cvector_push_front(vectorid,push_value); // Push front a value to vector
native cvector_push_front_arr(vectorid,push_arr[]); // Push front a string to vector
native cvector_push_front_float(vectorid,Float:push_float); // Push front a float value to vector
native cvector_get_type(vectorid, value_index); // Get type(String, int, float) defined..
native cvector_pop_back(vectorid); // Remove a value from back
native cvector_pop_front(vectorid); // Remove a value from front
native cvector_clear(vectorid); // Delete all values from vector
native cvector_size(vectorid); // Return a vector size(value count)
native cvector_capacity(vectorid); // Return a vector capacity
native cvector_empty(vectorid); // If vector is empty
native cvector_resize(vectorid,newsize); // Resize the vector, if value count < newsize, pushes 0 to new values
native cvector_remove(vectorid, itemid, end_itemid = -1); // Start removing from itemid, end stop on end_itemid.If end_itemid == -1, only removes itemid
native cvector_swap_vector(vectorid, to_swap_vector_id); // Swap the two vector values
native cvector_swap(vectorid, itemid, to_swap_item_id); // Swap a two values in the same vector
native cvector_shrink_to_fit(vectorid); // Shrink to fit a vector
native cvector_get(vectorid, itemid); // Get a int value
native cvector_get_arr(vectorid, itemid, buffer[], buffersize=sizeof buffer); // Copy a string value to buffer
native Float:cvector_get_float(vectorid, itemid); // Get a float value
native cvector_is_exists(vectorid, itemid); // If item exists
native cvector_is_vector_exists(vectorid); // If vector exists
native cvector_reverse(vectorid); // Reverse a vector values.Example 1,3,2 will be 2,3,1
native cvector_find(vectorid, find_value, from = 0, to=-1); // Start finding a value from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of vector))
native cvector_find_arr(vectorid, find_value[], from=0, to=-1); // Start finding a string from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of vector))
native cvector_find_float(vectorid, Float:find_value, from=0, to=-1); // Start finding a float from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of vector))
native cvector_set(vectorid, itemid, new_value); // Set a new value to item
native cvector_set_arr(vectorid, itemid, new_value[]); // Set a new string to item
native cvector_set_float(vectorid, itemid, Float:new_value); // Set a new float to item
native cvector_reserve(vectorid, size); // Reserve a vector
native cvector_assign(vectorid, time, value); // Push back a value until i==time
native cvector_assign_arr(vectorid, time, value[]); // Push back a string until i==time
native cvector_assign_float(vectorid, time, Float:value); // Push back a float until i==time
native cvector_sort(vectorid, compareFunctionName[]); // Compare items
/************** [=Global Vectors=] **************/
native cvector_g(); // Create a new global vector, Returns: created vector id
native cvector_g_push_back(vectorid,push_value); // Push back a value to vector
native cvector_g_push_back_arr(vectorid,push_arr[]); // Push back a string to vector
native cvector_g_push_back_float(vectorid,Float:push_float); // Push back a float value to vector
native cvector_g_push_front(vectorid,push_value); // Push front a value to vector
native cvector_g_push_front_arr(vectorid,push_arr[]); // Push front a string to vector
native cvector_g_push_front_float(vectorid,Float:push_float); // Push front a float value to vector
native cvector_g_get_type(vectorid, value_index); // Get type(String, int, float) defined..
native cvector_g_pop_back(vectorid); // Remove a value from back
native cvector_g_pop_front(vectorid); // Remove a value from front
native cvector_g_clear(vectorid); // Delete all values from vector
native cvector_g_size(vectorid); // Return a vector size(value count)
native cvector_g_capacity(vectorid); // Return a vector capacity
native cvector_g_empty(vectorid); // If vector is empty
native cvector_g_resize(vectorid,newsize); // Resize the vector, if value count < newsize, pushes 0 to new values
native cvector_g_remove(vectorid, itemid, end_itemid = -1); // Start removing from itemid, end stop on end_itemid.If end_itemid == -1, only removes itemid
native cvector_g_swap_vector(vectorid, to_swap_vector_id); // Swap the two vector values
native cvector_g_swap(vectorid, itemid, to_swap_item_id); // Swap a two values in the same vector
native cvector_g_shrink_to_fit(vectorid); // Shrink to fit a vector
native cvector_g_get(vectorid, itemid); // Get a int value
native cvector_g_get_arr(vectorid, itemid, buffer[], buffersize=sizeof buffer); // Copy a string value to buffer
native Float:cvector_g_get_float(vectorid, itemid); // Get a float value
native cvector_g_is_exists(vectorid, itemid); // If item exists
native cvector_g_is_vector_exists(vectorid); // If vector exists
native cvector_g_reverse(vectorid); // Reverse a vector values.Example 1,3,2 will be 2,3,1
native cvector_g_find(vectorid, find_value, from = 0, to=-1); // Start finding a value from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of vector))
native cvector_g_find_arr(vectorid, find_value[], from=0, to=-1); // Start finding a string from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of vector))
native cvector_g_find_float(vectorid, Float:find_value, from=0, to=-1); // Start finding a float from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of vector))
native cvector_g_set(vectorid, itemid, new_value); // Set a new value to item
native cvector_g_set_arr(vectorid, itemid, new_value[]); // Set a new string to item
native cvector_g_set_float(vectorid, itemid, Float:new_value); // Set a new float to item
native cvector_g_reserve(vectorid, size); // Reserve a vector
native cvector_g_assign(vectorid, time, value); // Push back a value until i==time
native cvector_g_assign_arr(vectorid, time, value[]); // Push back a string until i==time
native cvector_g_assign_float(vectorid, time, Float:value); // Push back a float until i==time
native cvector_g_sort(vectorid, compareFunctionName[]); // Compare items
DEQUE Natives:
pawn Code:
/************************************ [=Deque=] ************************************/
/************** [=Local Deques=] **************/
native cdeque(); // Create a new deque, Returns: created deque id
native cdeque_push_back(dequeid,push_value); // Push back a value to deque
native cdeque_push_back_arr(dequeid,push_arr[]); // Push back a string to deque
native cdeque_push_back_float(dequeid,Float:push_float); // Push back a float value to deque
native cdeque_push_front(dequeid,push_value); // Push front a value to deque
native cdeque_push_front_arr(dequeid,push_arr[]); // Push front a string to deque
native cdeque_push_front_float(dequeid,Float:push_float); // Push front a float value to deque
native cdeque_get_type(dequeid, value_index); // Get type(String, int, float) defined..
native cdeque_pop_back(dequeid); // Remove a value from back
native cdeque_pop_front(dequeid); // Remove a value from front
native cdeque_clear(dequeid); // Delete all values from deque
native cdeque_size(dequeid); // Return a deque size(value count)
native cdeque_empty(dequeid); // If deque is empty
native cdeque_resize(dequeid,newsize); // Resize the deque, if value count < newsize, pushes 0 to new values
native cdeque_remove(dequeid, itemid, end_itemid = -1); // Start removing from itemid, end stop on end_itemid.If end_itemid == -1, only removes itemid
native cdeque_swap_deque(dequeid, to_swap_deque_id); // Swap the two deque values
native cdeque_swap(dequeid, itemid, to_swap_item_id); // Swap a two values in the same deque
native cdeque_shrink_to_fit(dequeid); // Shrink to fit a deque
native cdeque_get(dequeid, itemid); // Get a int value
native cdeque_get_arr(dequeid, itemid, buffer[], buffersize=sizeof buffer); // Copy a string value to buffer
native Float:cdeque_get_float(dequeid, itemid); // Get a float value
native cdeque_is_exists(dequeid, itemid); // If item exists
native cdeque_is_deque_exists(dequeid); // If deque exists
native cdeque_reverse(dequeid); // Reverse a deque values.Example 1,3,2 will be 2,3,1
native cdeque_find(dequeid, find_value, from = 0, to=-1); // Start finding a value from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of deque))
native cdeque_find_arr(dequeid, find_value[], from=0, to=-1); // Start finding a string from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of deque))
native cdeque_find_float(dequeid, Float:find_value, from=0, to=-1); // Start finding a float from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of deque))
native cdeque_set(dequeid, itemid, new_value); // Set a new value to item
native cdeque_set_arr(dequeid, itemid, new_value[]); // Set a new string to item
native cdeque_set_float(dequeid, itemid, Float:new_value); // Set a new float to item
native cdeque_assign(dequeid, time, value); // Push back a value until i==time
native cdeque_assign_arr(dequeid, time, value[]); // Push back a string until i==time
native cdeque_assign_float(dequeid, time, Float:value); // Push back a float until i==time
native cdeque_sort(vectorid, compareFunctionName[]); // Compare items
/************** [=Global Deques=] **************/
native cdeque_g(); // Create a new global deque, Returns: created deque id
native cdeque_g_push_back(dequeid,push_value); // Push back a value to deque
native cdeque_g_push_back_arr(dequeid,push_arr[]); // Push back a string to deque
native cdeque_g_push_back_float(dequeid,Float:push_float); // Push back a float value to deque
native cdeque_g_push_front(dequeid,push_value); // Push front a value to deque
native cdeque_g_push_front_arr(dequeid,push_arr[]); // Push front a string to deque
native cdeque_g_push_front_float(dequeid,Float:push_float); // Push front a float value to deque
native cdeque_g_get_type(dequeid, value_index); // Get type(String, int, float) defined..
native cdeque_g_pop_back(dequeid); // Remove a value from back
native cdeque_g_pop_front(dequeid); // Remove a value from front
native cdeque_g_clear(dequeid); // Delete all values from deque
native cdeque_g_size(dequeid); // Return a deque size(value count)
native cdeque_g_empty(dequeid); // If deque is empty
native cdeque_g_resize(dequeid,newsize); // Resize the deque, if value count < newsize, pushes 0 to new values
native cdeque_g_remove(dequeid, itemid, end_itemid = -1); // Start removing from itemid, end stop on end_itemid.If end_itemid == -1, only removes itemid
native cdeque_g_swap_deque(dequeid, to_swap_deque_id); // Swap the two deque values
native cdeque_g_swap(dequeid, itemid, to_swap_item_id); // Swap a two values in the same deque
native cdeque_g_shrink_to_fit(dequeid); // Shrink to fit a deque
native cdeque_g_get(dequeid, itemid); // Get a int value
native cdeque_g_get_arr(dequeid, itemid, buffer[], buffersize=sizeof buffer); // Copy a string value to buffer
native Float:cdeque_g_get_float(dequeid, itemid); // Get a float value
native cdeque_g_is_exists(dequeid, itemid); // If item exists
native cdeque_g_is_deque_exists(dequeid); // If deque exists
native cdeque_g_reverse(dequeid); // Reverse a deque values.Example 1,3,2 will be 2,3,1
native cdeque_g_find(dequeid, find_value, from = 0, to=-1); // Start finding a value from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of deque))
native cdeque_g_find_arr(dequeid, find_value[], from=0, to=-1); // Start finding a string from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of deque))
native cdeque_g_find_float(dequeid, Float:find_value, from=0, to=-1); // Start finding a float from (from) variable, end on to variable.If found return itemid, otherwise return -1((to=-1) = (to end of deque))
native cdeque_g_set(dequeid, itemid, new_value); // Set a new value to item
native cdeque_g_set_arr(dequeid, itemid, new_value[]); // Set a new string to item
native cdeque_g_set_float(dequeid, itemid, Float:new_value); // Set a new float to item
native cdeque_g_assign(dequeid, time, value); // Push back a value until i==time
native cdeque_g_assign_arr(dequeid, time, value[]); // Push back a string until i==time
native cdeque_g_assign_float(dequeid, time, Float:value); // Push back a float until i==time
native cvector_g_sort(vectorid, compareFunctionName[]); // Compare items
MAP Natives:
pawn Code:
/************************************ [=Map=] ************************************/
/************** [=Local Maps=] **************/
native cmap(); // Create a new map, return instance id

native cmap_insert(mapid, key[], value); // Insert (if exists, set) value with string key
native cmap_insert_arr(mapid, key[], value[]); // Insert (if exists, set) string with string key
native cmap_insert_float(mapid, key[],Float:value); // Insert (if exists, set) float with string key

native cmap_insert_key_int(mapid, key, value); // Insert (if exists, set) value with int key
native cmap_insert_key_int_arr(mapid, key, value[]); // Insert (if exists,set) string with int key
native cmap_insert_key_int_float(mapid, key, Float:value); // Insert (if exists, set) float with int key

native cmap_insert_key_float(mapid, Float: key, value); // Insert (if exists, set) value with float key
native cmap_insert_key_float_arr(mapid, Float: key, value[]); // Insert (if exists, set) string with float key
native cmap_insert_key_float_float(mapid, Float: key, Float:value); // Insert (if exists, set) float with float key

native cmap_get(mapid, key[]); // Get a value with string key
native cmap_get_arr(mapid, key[], buffer[], buffersize = sizeof buffer); // Get&copy a string with string key
native Float:cmap_get_float(mapid, key[]); // Get a float with string key

native cmap_get_key_int(mapid, key); // Get a value with int key
native cmap_get_key_int_arr(mapid, key, buffer[], buffersize = sizeof buffer); // Get&copy a string with int key
native Float:cmap_get_key_int_float(mapid, key); // Get a float with int key

native cmap_get_key_float(mapid, Float:key); // Get a value with float key
native cmap_get_key_float_arr(mapid, Float:key, buffer[], buffersize = sizeof buffer); // Get&copy a string with float key
native Float:cmap_get_key_float_float(mapid, Float:key); // Get a float with float key

native cmap_contains(mapid, key[]); // If map contains a key(string control)
native cmap_contains_int(mapid, key); // If map contains a key(int control)
native cmap_contains_float(mapid, Float:key); // If map contains a key(float control)
// Notice: All keys parse to string by c++, so Float key 1 = int key 1 = string key "1"
    // For example: cmap_contains(mapid,"1") = cmap_contains_int(mapid,1) = cmap_contains_float(mapid,1)

native cmap_get_type(mapid, key[]); // Get a value type with string key
native cmap_get_type_int(mapid, key); // Get a value type with int key
native cmap_get_type_float(mapid, Float:key); // Get a value type with float key

native cmap_remove(mapid, key[]); // Remove a key
native cmap_remove_int(mapid, key); // Remove a key
native cmap_remove_float(mapid, Float:key); // Remove a key

native cmap_swap_map(mapid, to_swap_id); // Swap two map

native cmap_swap(mapid, key[], tokey[]); // Swap two keys
native cmap_swap_int(mapid, key[], tokey); // Swap two keys
native cmap_swap_float(mapid, key[], Float:tokey); // Swap two keys

native cmap_swap_key_int(mapid, key, tokey); // Swap two keys
native cmap_swap_key_int_float(mapid, key, Float:tokey); // Swap two keys
native cmap_swap_key_int_arr(mapid, key, tokey[]); // Swap two keys

native cmap_swap_key_float(mapid, Float:key, Float: tokey); // Swap two keys
native cmap_swap_key_float_int(mapid, Float:key, tokey); // Swap two keys
native cmap_swap_key_float_arr(mapid, Float:key, tokey[]); // Swap two keys

native cmap_empty(mapid); // If map is empty
/************** [=Global Maps=] **************/
native cmap_g(); // Create a new global map, return instance id

native cmap_g_insert(mapid, key[], value); // Insert (if exists, set) value with string key
native cmap_g_insert_arr(mapid, key[], value[]); // Insert (if exists, set) string with string key
native cmap_g_insert_float(mapid, key[],Float:value); // Insert (if exists, set) float with string key

native cmap_g_insert_key_int(mapid, key, value); // Insert (if exists, set) value with int key
native cmap_g_insert_key_int_arr(mapid, key, value[]); // Insert (if exists,set) string with int key
native cmap_g_insert_key_int_float(mapid, key, Float:value); // Insert (if exists, set) float with int key

native cmap_g_insert_key_float(mapid, Float: key, value); // Insert (if exists, set) value with float key
native cmap_g_insert_key_float_arr(mapid, Float: key, value[]); // Insert (if exists, set) string with float key
native cmap_g_insert_key_float_float(mapid, Float: key, Float:value); // Insert (if exists, set) float with float key

native cmap_g_get(mapid, key[]); // Get a value with string key
native cmap_g_get_arr(mapid, key[], buffer[], buffersize = sizeof buffer); // Get&copy a string with string key
native Float:cmap_g_get_float(mapid, key[]); // Get a float with string key

native cmap_g_get_key_int(mapid, key); // Get a value with int key
native cmap_g_get_key_int_arr(mapid, key, buffer[], buffersize = sizeof buffer); // Get&copy a string with int key
native Float:cmap_g_get_key_int_float(mapid, key); // Get a float with int key

native cmap_g_get_key_float(mapid, Float:key); // Get a value with float key
native cmap_g_get_key_float_arr(mapid, Float:key, buffer[], buffersize = sizeof buffer); // Get&copy a string with float key
native Float:cmap_g_get_key_float_float(mapid, Float:key); // Get a float with float key

native cmap_g_contains(mapid, key[]); // If map contains a key(string control)
native cmap_g_contains_int(mapid, key); // If map contains a key(int control)
native cmap_g_contains_float(mapid, Float:key); // If map contains a key(float control)
// Notice: All keys parse to string by c++, so Float key 1 = int key 1 = string key "1"
    // For example: cmap_contains(mapid,"1") = cmap_contains_int(mapid,1) = cmap_contains_float(mapid,1)

native cmap_g_get_type(mapid, key[]); // Get a value type with string key
native cmap_g_get_type_int(mapid, key); // Get a value type with int key
native cmap_g_get_type_float(mapid, Float:key); // Get a value type with float key

native cmap_g_remove(mapid, key[]); // Remove a key
native cmap_g_remove_int(mapid, key); // Remove a key
native cmap_g_remove_float(mapid, Float:key); // Remove a key

native cmap_g_swap_map(mapid, to_swap_id); // Swap two map

native cmap_g_swap(mapid, key[], tokey[]); // Swap two keys
native cmap_g_swap_int(mapid, key[], tokey); // Swap two keys
native cmap_g_swap_float(mapid, key[], Float:tokey); // Swap two keys

native cmap_g_swap_key_int(mapid, key, tokey); // Swap two keys
native cmap_g_swap_key_int_float(mapid, key, Float:tokey); // Swap two keys
native cmap_g_swap_key_int_arr(mapid, key, tokey[]); // Swap two keys

native cmap_g_swap_key_float(mapid, Float:key, Float: tokey); // Swap two keys
native cmap_g_swap_key_float_int(mapid, Float:key, tokey); // Swap two keys
native cmap_g_swap_key_float_arr(mapid, Float:key, tokey[]); // Swap two keys

native cmap_g_empty(mapid); // If map is empty
MULTIMAP Natives:
pawn Code:
/************************************ [=Multimap=] ************************************/
/************** [=Local Multimaps=] **************/
native cmmap(); // Create a new multimap, return a instance id

native cmmap_insert(multimapid, key[], value); // Insert a new value to key, return value index
native cmmap_insert_arr(multimapid, key[], value[]); // Insert a new string to key, return value index
native cmmap_insert_float(multimapid, key[], Float:value); // Insert a new float to key, return value index

native cmmap_insert_key_int(multimapid, key, value); // Insert a new value to key, return value index
native cmmap_insert_key_int_arr(multimapid, key, value[]); // Insert a new string to key, return value index
native cmmap_insert_key_int_float(multimapid, key, Float:value); // Insert a new float to key, return value index

native cmmap_insert_key_float(multimapid, Float:key, value); // Insert a new value to key, return value index
native cmmap_insert_key_float_arr(multimapid, Float:key, value[]); // Insert a new string to key, return value index
native cmmap_insert_key_float_float(multimapid, Float:key, Float:value); // Insert a new float to key, return value index

native cmmap_get(mapid, key[], index); // Get a value from key
native cmmap_get_arr(mapid, key[], index, buffer[], buffersize = sizeof buffer); // Get a value from key
native Float:cmmap_get_float(mapid, key[], index); // Get a value from key

native cmmap_get_key_int(mapid, key, index); // Get a value from key
native cmmap_get_key_int_arr(mapid, key, index, buffer[], buffersize = sizeof buffer); // Get a value from key
native Float:cmmap_get_key_int_float(mapid, key, index); // Get a value from key

native cmmap_get_key_float(mapid, Float:key, index); // Get a value from key
native cmmap_get_key_float_arr(mapid, Float:key, index, buffer[], buffersize = sizeof buffer); // Get a value from key
native Float:cmmap_get_key_float_float(mapid, Float:key, index); // Get a value from key

native cmmap_contains(mapid, key[], index=-1); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_contains_int(mapid, Float:key, index=-1); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_contains_float(mapid, key, index=-1); // If index == -1, returns if key contains, otherwise returns if key contains the index

native cmmap_get_type(mapid, key[], index); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_get_type_int(mapid, Float:key, index); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_get_type_float(mapid, key, index); // If index == -1, returns if key contains, otherwise returns if key contains the index

native cmmap_clear(mapid); // Remove all keys in map
native cmmap_size(mapid); // Return a multimap size

native cmmap_remove(mapid, key[], index=-1); // If index == -1, removes key
native cmmap_remove_int(mapid, key, index=-1); // If index == -1, removes key
native cmmap_remove_float(mapid, Float:key, index=-1); // If index == -1, removes key

native cmmap_swap_map(mapid, to_swap); // Swaps to multimaps
native cmmap_empty(mapid); // If multimap empty

native cmmap_count(mapid, key[]); // Value count in key
native cmmap_count_float(mapid, Float:key); // Value count in key
native cmmap_count_int(mapid, key); // Value count in key

native cmmap_set(mapid, key[], index, newvalue);
native cmmap_set_arr(mapid, key[], index, newvalue[]);
native cmmap_set_float(mapid, key[], index, Float:newvalue);

native cmmap_set_key_int(mapid, key, index, newvalue);
native cmmap_set_key_int_arr(mapid, key, index, newvalue[]);
native cmmap_set_key_int_float(mapid, key, index, Float:newvalue);

native cmmap_set_key_float(mapid, Float:key, index, newvalue);
native cmmap_set_key_float_arr(mapid, Float:key, index, newvalue[]);
native cmmap_set_key_float_float(mapid, Float:key, index ,Float:newvalue);

/************** [=Global Multimaps=] **************/
native cmmap_g(); // Create a new global multimap, return a instance id

native cmmap_g_insert(multimapid, key[], value); // Insert a new value to key, return value index
native cmmap_g_insert_arr(multimapid, key[], value[]); // Insert a new string to key, return value index
native cmmap_g_insert_float(multimapid, key[], Float:value); // Insert a new float to key, return value index

native cmmap_g_insert_key_int(multimapid, key, value); // Insert a new value to key, return value index
native cmmap_g_insert_key_int_arr(multimapid, key, value[]); // Insert a new string to key, return value index
native cmmap_g_insert_key_int_float(multimapid, key, Float:value); // Insert a new float to key, return value index

native cmmap_g_insert_key_float(multimapid, Float:key, value); // Insert a new value to key, return value index
native cmmap_g_insert_key_float_arr(multimapid, Float:key, value[]); // Insert a new string to key, return value index
native cmmap_g_insert_key_float_float(multimapid, Float:key, Float:value); // Insert a new float to key, return value index

native cmmap_g_get(mapid, key[], index); // Get a value from key
native cmmap_g_get_arr(mapid, key[], index, buffer[], buffersize = sizeof buffer); // Get a value from key
native Float:cmmap_g_get_float(mapid, key[], index); // Get a value from key

native cmmap_g_get_key_int(mapid, key, index); // Get a value from key
native cmmap_g_get_key_int_arr(mapid, key, index, buffer[], buffersize = sizeof buffer); // Get a value from key
native Float:cmmap_g_get_key_int_float(mapid, key, index); // Get a value from key

native cmmap_g_get_key_float(mapid, Float:key, index); // Get a value from key
native cmmap_g_get_key_float_arr(mapid, Float:key, index, buffer[], buffersize = sizeof buffer); // Get a value from key
native Float:cmmap_g_get_key_float_float(mapid, Float:key, index); // Get a value from key

native cmmap_g_contains(mapid, key[], index=-1); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_g_contains_int(mapid, Float:key, index=-1); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_g_contains_float(mapid, key, index=-1); // If index == -1, returns if key contains, otherwise returns if key contains the index

native cmmap_g_get_type(mapid, key[], index); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_g_get_type_int(mapid, Float:key, index); // If index == -1, returns if key contains, otherwise returns if key contains the index
native cmmap_g_get_type_float(mapid, key, index); // If index == -1, returns if key contains, otherwise returns if key contains the index

native cmmap_g_clear(mapid); // Remove all keys in map
native cmmap_g_size(mapid); // Return a multimap size

native cmmap_g_remove(mapid, key[], index=-1); // If index == -1, removes key
native cmmap_g_remove_int(mapid, key, index=-1); // If index == -1, removes key
native cmmap_g_remove_float(mapid, Float:key, index=-1); // If index == -1, removes key

native cmmap_g_swap_map(mapid, to_swap); // Swaps to multimaps
native cmmap_g_empty(mapid); // If multimap empty

native cmmap_g_count(mapid, key[]); // Value count in key
native cmmap_g_count_float(mapid, Float:key); // Value count in key
native cmmap_g_count_int(mapid, key); // Value count in key

native cmmap_g_set(mapid, key[], index, newvalue);
native cmmap_g_set_arr(mapid, key[], index, newvalue[]);
native cmmap_g_set_float(mapid, key[], index, Float:newvalue);

native cmmap_g_set_key_int(mapid, key, index, newvalue);
native cmmap_g_set_key_int_arr(mapid, key, index, newvalue[]);
native cmmap_g_set_key_int_float(mapid, key, index, Float:newvalue);

native cmmap_g_set_key_float(mapid, Float:key, index, newvalue);
native cmmap_g_set_key_float_arr(mapid, Float:key, index, newvalue[]);
native cmmap_g_set_key_float_float(mapid, Float:key, index ,Float:newvalue);

EXAMPLE: Vector
pawn Code:
#include <a_samp>
#include <Vectoral>

new PLAYERS;
public OnFilterScriptInit(){
    PLAYERS = cvector(); // Create a new instance
    SetTimer("SendMessage", 300000,true);
    // Capacity example
    new capac = cvector(); // create a new instance
    cvector_assign(capac, 10000, 1); // push back 1, 10000 times
    printf("After pushing(capacity): %d",cvector_capacity(capac)); // Outputs 10000
    cvector_resize(capac,10);
    printf("After resizing(capacity): %d",cvector_capacity(capac)); // Outputs 10000
    cvector_shrink_to_fit(capac);
    printf("After shrink(capacity): %d",cvector_capacity(capac)); // Outputs 10, you can see resizing don't reduce the capacity.If you want to do this, shrink the vector.
}
public OnPlayerConnect(playerid){ // When player connect
    vector_push_back(PLAYERS,playerid); // Insert the player
}

public OnPlayerDisconnect(playerid,reason){
    new idx = vector_find(PLAYERS,playerid); // Find player
    if(idx !=-1){ // If idx == -1, Vector didn't contains this player
        vector_remove(PLAYERS,idx);
    }
}

stock SendMessage(){
    for(new idx=0, playerid=0; idx<vector_size(PLAYERS); idx++){ // loop
        playerid = vector_get(PLAYERS, idx); // Get a playerid from idx
        if(playerid != -1 && GetPlayerTeam(playerid)==NO_TEAM){//If it is a valid,  and don't have team
            SendClientMessage(playerid,0xFFFFAE00,"Hello, you don't have a team.Dou you wanna join to we?");
        }
    }
}
I will add the others example soon.
Updates
  • v0.6a = Sort functions added

Download .DLL + .SO
Download Source

OLD Versions

Download .DLL + .SO(0.5)
Download Source(0.5)

CaHbKo 30/07/2012 09:48 AM

Re: Vectoral Pawn - STL Data containers for pawn
 
YES YES YES YES YES!!!!!!!!!

THANK YOU OMG.

Rancho 30/07/2012 10:46 AM

Re: Vectoral Pawn - STL Data containers for pawn
 
Quote:

Originally Posted by CaHbKo (Post 2021498)
YES YES YES YES YES!!!!!!!!!

THANK YOU OMG.

Thanks..

Jochemd 30/07/2012 11:05 AM

Re: Vectoral Pawn - STL Data containers for pawn
 
Dafaq is this

AndreT 30/07/2012 11:24 AM

Re: Vectoral Pawn - STL Data containers for pawn
 
Thanks, this is extremely useful. I have felt the need for something like mmap in the past for numerous times, yet been able to solve it using vectors from Teprey's plugin.

@Jochemd: STL containers. Stop posting stupid stuff.

Babul 30/07/2012 12:01 PM

Re: Vectoral Pawn - STL Data containers for pawn
 
aaaw sick! i just got a pathfinding to work, using gvars for nodes, it seems its worth a rescript using your plugin, iam curious about some speed comparisons!

Vukilore 30/07/2012 12:13 PM

Re : Vectoral Pawn - STL Data containers for pawn
 
Holy shhhht !
Exactly what I need !
Thanks thanks thanks :D

MegadreamsBE 30/07/2012 12:13 PM

Re: Vectoral Pawn - STL Data containers for pawn
 
Very nice!

Glint 30/07/2012 12:26 PM

Re: Vectoral Pawn - STL Data containers for pawn
 
Thanks mate this is what i was looking for really good job.

SomebodyAndMe 30/07/2012 12:29 PM

Re: Vectoral Pawn - STL Data containers for pawn
 
Great work :)

Nicely done!


All times are GMT. The time now is 10:32 AM.

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