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:map, key[], value[]);
native map_find(map:map, key[], dest[], size);
native map_size(map:map);
native map_clear(map:map);
native map_erase(map:map, key[]);
native map_empty(map:map);
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
}
}
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