#include <amxmodx>
#include <reapi>
/*Access flag*/
#define FLAGS "t"
#define IS_ACCESS(%0,%1) bool:(get_user_flags(%0) & %1)
#define IS_TEAM(%0,%1) bool:(get_member(%0, m_iTeam) == %1)
new gBitFlags, g_iRound;
new bool:g_iCommandExecuted[MAX_CLIENTS + 1];
public plugin_init() {
register_plugin( "Scout", "1.2", "Wrecked");
register_clcmd("say /test", "GiveScout");
gBitFlags= read_flags(FLAGS);
RegisterHookChain(RG_CSGameRules_RestartRound, "@CSGameRules_RestartRound_Pre", .post = false);
}
@CSGameRules_RestartRound_Pre() {
g_iRound = get_member_game(m_bCompleteReset) ? 0 : (g_iRound + 1);
arrayset(g_iCommandExecuted, false, sizeof g_iCommandExecuted);
}
public GiveScout(id) {
if (is_user_alive(id) && IS_ACCESS(id, gBitFlags) && IS_TEAM(id, TEAM_CT)) {
if (g_iCommandExecuted[id] == true) {
client_print_color(id, print_team_default, "You have already used /test in this round.");
return PLUGIN_HANDLED;
}
if (!rg_has_item_by_name(id, "weapon_scout")) {
rg_give_item(id, "weapon_scout", GT_REPLACE);
rg_set_user_bpammo(id, WEAPON_SCOUT, 90);
}
g_iCommandExecuted[id] = true;
}
return PLUGIN_HANDLED;
}