Ok I've got this working, the problem was in say event, it checked if is user admin, and if not it returned PLUGIN_CONTINUE; only after that I checked mutetime > systime. so it didn't reach that check.
Also I've got one more problem, when I reconnect, mute dissapears, and I again can talk, even if the mute time is still in sql, I think the problem is in loading.
PHP Code:
public client_putinserver(id)
{
Load_MySql(id)
}
PHP Code:
public Load_MySql(id)
{
new szAuthID[33], szTemp[512]
get_user_authid(id, szAuthID, 32)
new Data[1]
Data[0] = id
format(szTemp,charsmax(szTemp),"SELECT * FROM `bans` WHERE (`bans`.`auth` = '%s')", szAuthID)
SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
}
public register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
{
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error)
}
else if(FailState == TQUERY_QUERY_FAILED)
{
log_amx("Load Query failed. [%d] %s", Errcode, Error)
}
new id
id = Data[0]
if(SQL_NumResults(Query) >= 1)
{
iMute[id] = SQL_ReadResult(Query, 1)
SQL_ReadResult( Query, 2, iMuteReason[id], charsmax( iMuteReason[ ] ) )
SQL_ReadResult( Query, 3, iMuteAdmin[id], charsmax( iMuteAdmin[ ] ) )
iBan[id] = SQL_ReadResult(Query, 4)
SQL_ReadResult( Query, 5, iBanReason[id], charsmax( iBanReason[ ] ) )
SQL_ReadResult( Query, 6, iBanAdmin[id], charsmax( iBanAdmin[ ] ) )
}
if( iBan[id] > get_systime() )
{
client_print(id, print_console, "*------* *------------* *------*")
client_print(id, print_console, "*------* You are banned *------*")
client_print(id, print_console, "*** by: %s", iBanAdmin[id])
client_print(id, print_console, "*** for: %s", iBanReason[id])
client_print(id, print_console, "*------* You are banned *------*")
client_print(id, print_console, "*------* *------------* *------*")
client_cmd(id, "disconnect")
}
return PLUGIN_HANDLED
}
public client_disconnect(id)
{
iMute[id] = 0;
iMuteReason[id][0] = '^0'
iMuteAdmin[id][0] = '^0'
iBan[id] = 0;
iBanReason[id][0] = '^0'
iBanAdmin[id][0] = '^0'
}