13.01.2017, 15:24
Hi Brothers. I have a problem when I use my cmd /ban it show nothing just bans me..
My cmd..
Even the first SendClientMessageToAll dosen't gets triggered. But the ban in last gets triggered.
My cmd..
PHP код:
CMD:ban(playerid, params[])
{
new bstring[200], btargid, breason[45];
if(PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid, 0xFF0000FF, "You must be an admin to use this command");//I have to change
if(sscanf(params, "us[45]", btargid, breason)) return SCM(playerid, 0xFF0000FF, "USAGE: /ban [id] [reason]");
if(!IsPlayerConnected(btargid)) return SCM(playerid, 0xFF0000FF, "Your specified player is not connected");
if(btargid == INVALID_PLAYER_ID) return SCM(playerid, 0xFF0000FF, "You have specified an invaild player id");
format(bstring, sizeof(bstring), "Admin %s (%i) has banned %s (%i) for %s", getName(playerid), playerid, getName(btargid), btargid, breason);
SendClientMessageToAll(COLOR_YELLOW, bstring);
new bstr[51];
SCM(playerid, 0x00FF00FF, "Cheater banned!");
SCM(btargid, 0x0000FFFF, "You are BANNED!");
format(bstr, sizeof(bstr), "~r~BANNED FOR %s", breason);
GameTextForPlayer(btargid, bstr, 2000, 1);
Ban(btargid);
new query[512], PlayerIP[16];
GetPlayerIp(btargid, PlayerIP, sizeof(PlayerIP));
mysql_format(mysql, query, sizeof(query), "INSERT INTO `bans` (Admin = '%e', Reason = '%e', Ip = '%e') WHERE Name = '%e'", getName(playerid), breason, PlayerIP, getName(btargid));
mysql_tquery(mysql, query, " ", " ");
return 1;
}