Hello.
I created a ban system that unbans players after theyr time has past, everything is in database mysql.
But the only problem that i have is if in structure Player 1 is id 1 in db and has 5 minutes left and Player 2 is id 2 in db and has 1 minute left if his time will past the server wont give the message about Player 2 that got unbanned because he is id 2 in db and not 1, but when Player 1 is getting unbanned the server will give a message about him that got unbanned, and if i put them both in the same time to get unban server will show only 1 player got unbanned but in db they both got unbanned.
Bad english sorry, this is my script, don't judge me about the code, help if you can, thanks.
Code:
public UnbanSystem()
{
new string[25];
format(string, charsmax(string), "SELECT * FROM `bans`"), SQL_ThreadQuery(Handler, "UnbanContinue", string);
return PLUGIN_HANDLED;
}
public UnbanContinue(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
if(SQL_NumResults(Query) > 0)
{
new pName[32], UnbanTime[32];
for(new i; i < 10; i++)
{
SQL_ReadResult(Query, 1, pName[i], 32), UnbanTime[i] = SQL_ReadResult(Query, 5);
new string[55];
format(string, charsmax(string), "DELETE FROM `bans` WHERE `UnbanTime` = '0'"), SQL_ThreadQuery(Handler, "IgnoreHandle", string);
if(UnbanTime[i] == 0)
{
SCM(0, GREEN, "%s %s got unbanned.", TAG, pName[i]);
return PLUGIN_HANDLED;
}
}
}
return PLUGIN_HANDLED;
}