#include <amxmodx>
#include <hamsandwich>
#define TRIE_VERSION
#pragma semicolon 1
enum _:DATA_PLUGIN
{
PLUGIN_NOMBRE[50],
PLUGIN_VERSION[50],
PLUGIN_AUTOR[50],
PLUGIN_PREFIJO[50]
};
new const g_plugin[DATA_PLUGIN] =
{
{ "Use Button Once" },
{ "1.0" },
{ "Deev" },
{ "[amxmodx-es.com]" }
};
#if defined TRIE_VERSION
new Trie:g_button;
new szButton[5];
#else
new g_button[2000];
#endif
public plugin_init()
{
register_plugin(g_plugin[PLUGIN_NOMBRE], g_plugin[PLUGIN_VERSION], g_plugin[PLUGIN_AUTOR]);
register_logevent("EmpezoLaRonda", 2, "1=Round_Start");
#if defined TRIE_VERSION
g_button = TrieCreate();
#endif
RegisterHam(Ham_Use, "func_button", "ham_Use_Button");
RegisterHam(Ham_Use, "func_rot_button", "ham_Use_Button");
RegisterHam(Ham_Use, "button_target", "ham_Use_Button");
}
public EmpezoLaRonda()
{
#if defined TRIE_VERSION
TrieClear(g_button);
#else
for(new i = 0; i < 2000; ++i)
{
if(g_button[i])
g_button[i] = false;
}
#endif
}
public ham_Use_Button(button, id, activator, use_type, Float:value)
{
if(!is_user_connected(id) && !is_user_alive(id))
return HAM_IGNORED;
if(get_user_team(id) == 1)
{
#if defined TRIE_VERSION
num_to_str(button, szButton, charsmax(szButton));
if(!TrieKeyExists(g_button, szButton))
{
TrieSetCell(g_button, szButton, 1);
}
#else
if(!g_button[button])
g_button[button] = true;
#endif
else
{
client_print(id, print_center, "Ya has usado esta TRAMPA");
emit_sound(button, CHAN_VOICE, "buttons/button11.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}