03.06.2018, 13:19
The server crash when i enter right player name, why?
PHP код:
COMMAND:oban(playerid, params[])
{
if(playerData[playerid][playerLoggedIn])
{
if(playerData[playerid][playerLevel] >= 4)
{
new otherPlayer, reason;
if(sscanf(params, "us[250]", otherPlayer, reason)) return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}Usage: /oban <playername> <reason>");
{
new mysql[250], value[100][50], row[200];
// new rows = mysql_num_rows();
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, "|");
new mysql1[250];
format(mysql1, sizeof(mysql1), "SELECT * FROM `playerdata` WHERE `playerName` = '%s'", otherPlayer);
mysql_query(mysql1);
mysql_fetch_row(value[4], "playerIP");
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')", GetName(playerid), reason, otherPlayer, playerIP);
mysql_query(banreason);
format(msg, sizeof(msg), "{33AA33}[ADMIN] Adminstrator %s(%i) has offline banned %s. {FFFF00}[REASON: %s]", GetName(playerid), playerid, otherPlayer);
SendClientMessageToAll(-1, msg);
format(msg1, sizeof(msg1), "{33AA33}[ADMIN]{FFFFFF} You've offline banned %s for %s.", otherPlayer, reason);
SendClientMessage(playerid, -1, msg1);
}
else
{
SendClientMessage(playerid, -1, "{FF0000}[ERROR]{FFFFFF} That player doesn't exist in the database.");
}
}
}
}
else
{
SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You must be logged in to use commands.");
}
return 1;
}