17.08.2015, 10:53
Hi,
I've made an script that ban players. It works fine but when i type 1 letter in reason, it will ban me.
Example: /ban 5 a
I have the same problem with /kick
What's wrong?
I've made an script that ban players. It works fine but when i type 1 letter in reason, it will ban me.
Example: /ban 5 a
PHP код:
CMD:ban(playerid, params[])
{
new
targetid,
Reason,
AdminName[MAX_PLAYERS],
TargetName[MAX_PLAYER_NAME],
banmsg[128];
if(PlayerInfo[pAdmin][playerid]>2)
{
if(sscanf(params, "is[50]", targetid, Reason)) return SendClientMessage(playerid, 0xE90A0AFF, "[CMD] /ban [playerid] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xE90A0AFF, "[ERROR] Invalid player ID.");
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(targetid, TargetName, sizeof(TargetName));
format(banmsg, sizeof(banmsg), "[ADMIN] Admin %s has banned %s [Reason: %s]", AdminName, TargetName, Reason);
SendClientMessageToAll(0xE90A0AFF, banmsg);
TextDrawShowForPlayer(targetid, Textdraw0);
TextDrawShowForPlayer(targetid, Textdraw1);
TextDrawShowForPlayer(targetid, Textdraw2);
PlayerInfo[Banned][targetid] = 1;
Kick(targetid);
}
else
{
SendClientMessage(playerid, 0xE90A0AFF, "[ERROR] You are not authorized.");
}
return 1;
}
What's wrong?