Код:
COMMAND:oban(playerid, params[])
{
if(playerData[playerid][playerLoggedIn])
{
if(playerData[playerid][playerLevel] >= 4)
{
new otherPlayer[24], reason[50];
if(sscanf(params, "s[50]s[50]", otherPlayer, reason)) return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}Usage: /oban <playername> <reason>");
{
new mysql[150], value[100][50], row[200];
format(mysql, sizeof(mysql), "SELECT * FROM `playerdata` WHERE `playerName` = '%s'", otherPlayer);
mysql_query(mysql);
mysql_store_result();
if(mysql_num_rows())
{
mysql_fetch_row(row, "|", connection);
explode(row, value, "|");
mysql_fetch_row(value[4], "playerIP");
new str[150];
format(str, sizeof(str), "SELECT * FROM `playerbans` WHERE `player_banned` = '%s'", otherPlayer);
mysql_query(str);
mysql_store_result();
if(mysql_num_rows())
{
SendClientMessage(playerid, -1, "{FF0000}[ERROR]{FFFFFF} This player is already banned.");
mysql_free_result();
}
else
{
new banreason[350], msg[250], msg1[250];
format(banreason, sizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s', '%s')", playerData[playerid][playerNamee], reason, otherPlayer, playerIP);
mysql_query(banreason);
format(msg, sizeof(msg), "{33AA33}[ADMIN] Adminstrator %s(%i) has offline banned %s. {FFFF00}[REASON: %s]", playerData[playerid][playerNamee], playerid, otherPlayer, reason);
SendClientMessageToAll(-1, msg);
format(msg1, sizeof(msg1), "{33AA33}[ADMIN]{FFFFFF} You've offline banned %s for %s.", otherPlayer, reason);
SendClientMessage(playerid, -1, msg1);
mysql_free_result();
}
mysql_free_result();
}
else
{
SendClientMessage(playerid, -1, "{FF0000}[ERROR]{FFFFFF} That player doesn't exist in the database.");
}
}
}
else
{
TextDrawSetString(NotAuthorized, "You are not authorized to use this command!");
TextDrawHideForPlayer(playerid, NotAuthorized);
TextDrawShowForPlayer(playerid, NotAuthorized);
SetTimerEx("una", 3000, false, "i", playerid);
}
}
else
{
SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You must be logged in to use commands.");
}
return 1;
}
Read the forum rules... 24 hour bumps only.