20.11.2012, 15:55
Can someone make /ban CMD ? I'm using ZCMD, thanks.
CMD:ban(playerid,params[])
{
new Target,Reason;
if(!sscanf(params,"us[124]",Target,Reason))
{
if(IsPlayerConnected(Target))
{
if(pInfo[Target][Admin] > pInfo[playerid][Admin])
{
SendClientMessage(playerid,-1,"WARNING: An error occured. [Reason: Banning higher level admins is forbidden.");
}
else
{
new String[124],Name[MAX_PLAYER_NAME];
GetPlayerName(Target,Name,sizeof(Name));
format(String,sizeof(String),"%s has been banned. [Reason: %s]",Name,Reason);
SendClientMessageToAll(-1,String);
Ban(Target);
}
}
else
{
SendClientMessage(playerid,-1,"WARNING: An error occured. [Reason: Player is not connected.");
}
}
else
{
SendClientMessage(playerid,-1,"USAGE: /Ban [Playerid] [Reason]");
}
return 1;
}
CMD:ban(playerid, params[])
{
new pID, reason[68], msg[128], name[MAX_PLAYER_NAME], bannername[MAX_PLAYER_NAME];
if(sscanf(params, "us", pID, reason)) return SendClientMessage(playerid, 0xDF0000FF, "USAGE: /ban [playerid] [reason]");
{
GetPlayerName(pID, name, sizeof(name));
GetPlayerName(pID, bannername, sizeof(bannername));
format(msg, sizeof(msg), "[AdmCmd]: %s has been banned by %s, reason: %s", name, bannername, reason);
SendClientMessageToAll(0xDF0000FF, msg);
BanEx(pID, reason);
}
return 1;
}
pawn Код:
|
if(sscanf(params, "us", pID, reason))
if(sscanf(params, "us[68]", pID, reason))
COMMAND:ban(playerid, params[])
{
new targetId, banReason[64];
if(!IsPlayerAdmin(playerid) /* Or change to a variable */) return SendClientMessage(playerid, COLOR_RED, "You're not an administrator!");
else if(sscanf(params, "us[64]", targetId, banReason)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /ban [id][reason]");
else if(!IsPlayerConnected(targetId)) return SendClientMessage(playerid, COLOR_RED, "That player isn't connected!");
else
{
new playerName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME], banMessage[128];
GetPlayerName(playerid, playerName, sizeof(playerName));
GetPlayerName(targetId, targetName, sizeof(targetName));
format(banMessage, sizeof(banMessage), "Administrator %s(%d) has banned player %s(%d). Reason: %s", playerName, playerid, targetName, targetId, banReason);
SendClientMessageToAll(COLOR_RED, banMessage);
print(banMessage);
format(banMessage, sizeof(banMessage), "Banned by %s. Reason: %s", playerName, banReason);
BanEx(targetId, banMessage);
}
return 1;
}
#define COLOR_RED 0xFF0000FF
#define COLOR_ORANGE 0xFF8000FF
pawn Код:
|