If using tries , bool is not necessary , create trie on plugin_init() , on ApCommand get user authid , check if it matches with what we have in trie , after giving ammo packs save user authid in trie so we know this authid has used command ( we will block him to access the command later by checking trie value ) and at last destroy trie on plugin_end() to free up memory.
example code :
Code:
#include <amxmodx>
#include <cstrike>
new Trie:g_tUsedCommand
public plugin_init()
{
register_plugin("free money per map" , "1.0" , "LearninG")
register_clcmd("say /money" , "give_money")
g_tUsedCommand = TrieCreate()
}
public give_money(id)
{
new szAuthid[35]
get_user_authid(id , szAuthid , charsmax(szAuthid)) // szAuthid now contains user authid
if( TrieKeyExists( g_tUsedCommand, szAuthid ) ) // if we have szAuthid in trie
{
client_print(id , print_chat , "[AMXX] You have used this command")
}
else
{
cs_set_user_money(id , cs_get_user_money(id) + 5000)
client_print(id , print_chat, "[AMXX] You got 5000 money")
TrieSetCell( g_tUsedCommand, szAuthid, 1 ) // save user authid in trie
}
}
public plugin_end( )
{
TrieDestroy( g_tUsedCommand )
}
for more information about Tries :
https://forums.alliedmods.net/showthread.php?t=201872