View Single Post
Mikka
Member
Join Date: Dec 2018
Old 05-27-2022 , 09:13   Re: How to get unique id from array
Reply With Quote #9

is this stock to be called inside a function with motd?

Quote:
Originally Posted by HamletEagle View Post
Okay, use this:
PHP Code:
getUniqueElements(inputnumElementsoutput, &numUnique)
{
    new 
Trie:set TrieCreate();
    new 
strKey[12];
    
    for(new 
0numElementsi++)
    {
        
num_to_str(input[i], strKeycharsmax(strKey));
        if(!
TrieKeyExists(setstrKey))
        {
            
output[numUnique++] = arr[i];
            
TriePushCell(setstrKey0);
        }
    }
    
    
TrieDestroy(set);

Mikka is offline