PDA

View Full Version : Unknown Command


TheBeastKhan
13/06/2018, 12:48 PM
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;
}


On execution, it is showing Unknown Command rather than Ban ....

TheBeastKhan
13/06/2018, 03:46 PM
Bump

Sew_Sumi
13/06/2018, 04:18 PM
Read the forum rules... 24 hour bumps only.

GTLS
13/06/2018, 04:51 PM
Use Crashdetect and post the server logs.

TheBeastKhan
14/06/2018, 12:28 PM
I am using crashdetect, Nothing in server logs -_-

TheBeastKhan
17/06/2018, 03:21 PM
bump, Please help me!

Lucases
17/06/2018, 10:43 PM
Why are you using mysql_free_result inside the if statement and outside it?
Won't it try to free the result twice?