Hi guys i just made a ban sys everything is working fine execpt one prob when someone is banned and he tries to join the server just closes the connection doesn't tell the reason or tell he is banned .
Код:
stock MySQL_BanCheck(playerid)
{
new query[200], admin[50], pname[50], IP[16], string1[100];
GetPlayerIp(playerid, IP, 16);
format(query, sizeof(query),"SELECT * FROM `bandata` WHERE(`player`='%s') AND `banned`=1 LIMIT 1", escpname(playerid), IP);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
while(mysql_fetch_row(query))
{
mysql_fetch_field_row(admin, "admin");
mysql_fetch_field_row(pname, "player");
mysql_fetch_field_row(string1, "reason");
}
new string[50], str[50], str1[100];
format(string, sizeof(string),"Admin: %s", admin);
format(str, sizeof(str),"Player: %s", pname);
format(str1, sizeof(str1),"Reason: %s", string1);
SendClientMessage(playerid, red,"You are banned from this server!");
SendClientMessage(playerid, red,"___________________");
SendClientMessage(playerid, red, str);
SendClientMessage(playerid, red, string);
SendClientMessage(playerid, red, str1);
SendClientMessage(playerid, red,"___________________");
SendClientMessage(playerid, red, "If you think that this BAN was a mistake, then post a screenshot(using F8) on our website");
SendClientMessage(playerid, red, "xpsamp.co.in");
SendClientMessage(playerid, red, "You have been banned from the server please make a unban application at our forum");
SendClientMessage(playerid, red, "Forum xpsamp.co.in");
Kick(playerid);
}
mysql_free_result();
return 1;
}
See the sql works and if i join with that name it closes the conn it dosent say anything.
You need to delay the kick so messages will be shown. An example can be found in the wiki (link above).
Thanx you bro it really worked thank you. +rep for you