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;
}
Originally Posted by SAMPWiki
As of SA-MP 0.3x, any action taken directly before Ban() (such as sending a message with SendClientMessage) will not reach the player. A timer must be used to delay the ban.
|
You must delay the "Ban" function.
https://sampwiki.blast.hk/wiki/Ban https://sampforum.blast.hk/showthread.php?tid=540505 |