03.03.2012, 10:23
How to make this threaded?
pawn Код:
CMD:banacc(playerid, params[])
{
if(PVar[playerid][pLevel] >= 1)
{
new Player[MAX_PLAYER_NAME], querySz[256], reason[40];
if(sscanf(params,"s[24]s[40]",Player, reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /banacc [exact name] [Reason] (offline ban)");
format(querySz, sizeof(querySz), "SELECT user FROM playerinfo WHERE user = '%s'", Player);
mysql_query(querySz);
mysql_store_result();
if(mysql_num_rows() == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Error: No account with that name.");
mysql_free_result();
return 1;
}
format(querySz, sizeof(querySz), "UPDATE playerinfo SET Banned = 1 WHERE user = '%s'", Player);
mysql_query(querySz);
mysql_free_result();
format(querySz, sizeof(querySz), "[AdminInfo]{FFFFFF} %s has banned %s's account. Reason: %s", PVar[playerid][pAdminRank], Player, reason);
SendAdminMessage(COLOR_YELLOW,querySz);
}
return 1;
}