Hello, so i have this command where you can get coins from database when entering a custom code, but somehow when i activate the code with the command and while the command is on cooldown, it can be activated again from another player. Here is what im using -
Any help would be appreciated
PHP Code:
public RedeemCodeCommand(id)
{
if(read_argc()<2){
client_print(id, print_console, "Usage: bio_bank_activate <code>");
return PLUGIN_HANDLED;
}
if (get_gametime() - g_lastCodeUseTime < 6)
{
client_print(id, print_console, "[BANZUKE] Wait a bit before using this command...")
return PLUGIN_HANDLED;
}
g_lastCodeUseTime = get_gametime()
new szPromoCode[PLATFORM_MAX_PATH]
read_args(szPromoCode, charsmax(szPromoCode))
remove_quotes(szPromoCode)
trim(szPromoCode)
new szQuery[MAX_FMT_LENGTH]
formatex(szQuery, charsmax(szQuery), "SELECT * FROM `bank` WHERE `activation_code` = '%s'", szPromoCode)
SQL_ThreadQuery(g_SqlTuple, "ActivePromoCode_QueryHandler", szQuery)
return PLUGIN_CONTINUE
}