07.01.2014, 18:22
Hello, can someone explain me why this stock that should return ban info message doesn't show at the banned player when he connects?
I have this
on OnPlayerConnect.
This is the full stock:
Thanks for helping.
I have this
pawn Код:
IsPlayerBanned(playerid);
This is the full stock:
pawn Код:
stock IsPlayerBanned(playerid)
{
new IP[16], String[128], Query[128], reason[64], admin[32], i[128], seconds;
GetPlayerIp(playerid, IP, sizeof(IP));
format(Query, sizeof(Query), "SELECT * FROM `Bans` WHERE (`Username` = '%s' OR `IP` = '%s') AND `Banned` = 1 LIMIT 1", GetName(playerid), IP);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
while(mysql_fetch_row_format(Query, "|"))
{
mysql_fetch_field_row(i, "Reason"); format(reason, sizeof(reason), i);
mysql_fetch_field_row(i, "Seconds"); seconds = strval(i);
mysql_fetch_field_row(i, "Admin"); format(admin, sizeof(admin), i);
}
if(seconds > gettime())
{
format(String, sizeof(String), "Reason: %s", reason);
SendClientMessage(playerid, COLOR_RED, String);
SendClientMessage(playerid, COLOR_RED, "*** You are banned from Battlefield War Heroes ***");
format(String, sizeof(String), "You'll be unbanned in: %s - Until that, don't try to evade ban.", timec(gettime()-(gettime()-seconds)));
SendClientMessage(playerid, COLOR_RED, String);
SendClientMessage(playerid, COLOR_RED, "If you attempt to, you might get rangebanned for trying to 'ban evade.'");
SendClientMessage(playerid, COLOR_RED, "If you feel that you have been unfairly banned, please visit our website to appeal the ban.");
Kick(playerid);
}
else
{
format(Query, sizeof(Query), "UPDATE `Bans` SET `Banned` = 0 WHERE `Username` = '%s'", GetName(playerid));
mysql_query(Query);
}
}
mysql_free_result();
return 1;
}