12.10.2012, 07:02
(
Последний раз редактировалось _Khaled_; 13.10.2012 в 07:52.
)
Hey, some people will say test it and come
I just don't have anyone to test it with right now, and I have to get off the PC and get on it next week end,
so just, here we go
http://pastebin.com/fkKRJXep
I'd appreciate help.
I just don't have anyone to test it with right now, and I have to get off the PC and get on it next week end,
so just, here we go
pawn Код:
dcmd_ban(playerid,params[])
{
#pragma unused params
new pname[MAX_PLAYER_NAME];
new Spname[MAX_PLAYER_NAME];
new string[128];
new cmdreason[100];
new id;
if(sscanf(params,"us[100]",id,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"Usage: /ban (Player Name/ID) (Reason)");
return 1;
}
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid, COLOR_RED, "The player is not connected to the server");
return 1;
}
GetPlayerName(id, pname, sizeof(pname));
format(string,sizeof(string),"***An Administrator has banned %s(%d) from the server. (Reason: %s)",pname,id,cmdreason);
SendClientMessageToAll(COLOR_PINK,string);
PlayerInfo[id][pBanned] =1;
GameTextForPlayer(id, "~r~BANNED",1000000,4);
Kick(id);
GetPlayerName(id, pname, sizeof(pname));
format(string,sizeof(string),"***An Administrator has banned %s(%d) from the server. (Reason: %s)",pname,id,cmdreason);
IRC_GroupSay(groupID,IRC_CHANNEL,string);
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
GetPlayerName(id,pname,MAX_PLAYER_NAME);
GetPlayerName(playerid,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has banned %s(%d). (Reason: %s)",Spname,playerid,pname,id,cmdreason);
SendAdminMessage(COLOR_PINK, string);
return 1;
}
//============================================================================//
dcmd_unban(playerid,params[])
{
#pragma unused params
new pname[MAX_PLAYER_NAME];
new Spname[MAX_PLAYER_NAME];
new path[128];
new string[128];
if(sscanf(params,"u",pname))
{
SendClientMessage(playerid,COLOR_ERROR,"Usage: /unban (Player Name/ID) (Reason)");
return 1;
}
GetPlayerName(playerid,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",Spname, playerid, pname);
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
GetPlayerName(playerid,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",Spname,playerid,pname);
SendAdminMessage(COLOR_PINK, string);
if(!fexist(path)) return SendClientMessage(playerid,COLOR_RED,"ERROR: Player Unknown to the Database.");
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Banned",0);
INI_Close(File);
return 1;
}
//============================================================================//
//Command BAN.
IRCCMD:iunban(botid, channel[], user[], host[], params[])
{
// Check if the user is at least an op in the channel
if (IRC_IsOp(botid, channel, user))
{
new playerid, reason[64];
// Check if the user at least entered a player ID
if (sscanf(params, "dS(No reason)[64]", playerid, reason))
{
return 1;
}
// Echo the formatted message
new name[MAX_PLAYER_NAME];
new path[128];
new string[128];
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
SendAdminMessage(COLOR_PINK, string);
if(!fexist(path))
{
format(string,sizeof(string),"ERROR: Player not known to database.");
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
}
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Banned",0);
INI_Close(File);
}
return 1;
}
//============================================================================//
//Command UNBAN.
IRCCMD:iunban(botid, channel[], user[], host[], params[])
{
// Check if the user is at least an op in the channel
if (IRC_IsOp(botid, channel, user))
{
new playerid, reason[64];
new id;
// Check if the user at least entered a player ID
if (sscanf(params, "dS(No reason)[64]", playerid, reason))
{
return 1;
}
// Check if the player is connected
if (IsPlayerConnected(id))
{
// Echo the formatted message
new name[MAX_PLAYER_NAME];
new path[128];
new string[128];
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
SendAdminMessage(COLOR_PINK, string);
if(!fexist(path))
{
format(string,sizeof(string),"ERROR: Player not known to database.");
IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
}
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Banned",0);
INI_Close(File);
}
}
return 1;
}
I'd appreciate help.