CMD:banid(playerid, params[])
{
if(IsPlayerAdmin2[playerid] == 2)
{
new targetid, reason[128], name[24], msg[64];
if(sscanf(params, "us", targetid)) SendClientMessage(playerid, COLOR_WHITE, "USAGE: /banid <playerid> <reason>");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "that player is not connected");
GetPlayerName(targetid, name, sizeof(name));
format(msg, sizeof(msg), "%s (%d) was banned. Reason: %s", name, targetid, reason);
SendClientMessageToAll(0xFFFFFFFF, msg);
if(GetPVarInt(targetid, "Logged"))
{
new filename[64];
format(filename, sizeof(filename), "MaceRP/users/%s.ini", PlayerName(targetid));
dini_IntSet(filename, "Banned", 1);
}
BanEx(targetid, reason);
return 1;
}
return 1;
}
if(sscanf(params, "us[128]", targetid, reason))
CMD:banid(playerid, params[])
{
if(IsPlayerAdmin2[playerid] == 2)
{
new targetid, reason[64], name[24], msg[64];
if(sscanf(params, "us[64]", targetid, reason)) SendClientMessage(playerid, COLOR_WHITE, "USAGE: /banid <playerid> <reason>");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "that player is not connected");
GetPlayerName(targetid, name, sizeof(name));
format(msg, sizeof(msg), "%s (%d) was banned. Reason: %s", name, targetid, reason);
SendClientMessageToAll(0xFFFFFFFF, msg);
if(GetPVarInt(targetid, "Logged"))
{
new filename[64];
format(filename, sizeof(filename), "MaceRP/users/%s.ini", PlayerName(targetid));
dini_IntSet(filename, "Banned", 1);
}
BanEx(targetid, reason);
GameTextForPlayer(targetid, "You has been banned", 4000, 3);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can't use this command.");
return 1;
}
}
dcmd_ban(playerid, params[])
{
if(IsPlayerAdmin2[playerid] == 2)
{
new level;
new pid;
if (sscanf(params, "us", pid, level))
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /ban [ID] [Reason] - Ban a rule-breaker.");
}
else if (pid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new pname[MAX_PLAYER_NAME];
GetPlayerName(pid, pname, sizeof(pname));
new string[256];
format(string, sizeof(string), "Administrator %s have banned %s for: %s", name, pname, level);
SendClientMessageToAll(COLOR_BLUE, string);
Ban(pid);
}
return 1;
}
else return SendClientMessage(playerid,COLOR_RED,"ERROR: You need to be an admin level 4 or higher to use this command.");
Here is my old /ban cmd modify for your needs:
pawn Код:
|
if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /banid <playerid> <reason>");
if(IsPlayerAdmin2[playerid] == 2)
if(IsPlayerAdmin2[playerid] >= 2)