Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[Plugin] unordered_map

$
0
0
unordered_map for SA:MP


Description
This plugin allows you working with unordered_map

Natives
PHP Code:

native map:map_new();
native map_emplace(map:mapkey[], value[]);
native map_find(map:mapkey[], dest[], size);
native map_size(map:map);
native map_clear(map:map);
native map_erase(map:mapkey[]);
native map_empty(map:map); 

Example code
PHP Code:

#include <unordered_map>

main()
{
  new 
map:map map_new(); // Create a new map
  
  
map_emplace(map,"test","hello"); // Insert new element
  
new value[6];
  
  if(
map_find(map,"test",value,sizeof(value)) != -1// If element found
  
{
    
printf("Found, value: %s",value); // Output: Found, value: hello
  
}
  
  
map_erase(map,"test"// Remove our element
  
if(map_find(map,"test",value,sizeof(value)) == -1// If element was not found
  
{
    
printf("Not found"); // Output: Not found
  
}
  
  if(
map_empty(map)) // If map empty
  
{
    
printf("Map is empty"); // Output: Map is empty
  
}


Installing
1. Download unordered_map from Releases page
2. Extract unordered_map.inc to pawno/include folder
3. In your mode include unordered_map.inc
4. Extract unordered_map.dll or unordered_map.so to plugins folder
5. In the server.cfg on line plugins add unordered_map.dll or unordered_map.so

Releases:
https://github.com/AnveSamp/unordered_map/releases

Source code:
https://github.com/AnveSamp/unordered_map

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>