24.08.2012, 14:05
I need to know how to make an admin chat command from scratch, some codes
Can someone help?
Little question
Everything is working, except that it's not MUTING the player.
pawn Код:
enum pInfo
{
pPass,
pCash,
pScore,
pAdminLevel,
pKills,
pDeaths,
pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerCommandText(playerid, cmdtext[])
{
//All Player's Commands.
dcmd(rules,5,cmdtext);
//Admins Commands.
if(PlayerInfo[playerid][pAdminLevel] == 1)
{
dcmd(ann,3,cmdtext);
dcmd(slap,4,cmdtext);
dcmd(acar,4,cmdtext);
dcmd(amotor,6,cmdtext);
return 1;
}
if(PlayerInfo[playerid][pAdminLevel] == 2)
{
dcmd(freeze,6,cmdtext);
dcmd(unfreeze,8,cmdtext);
dcmd(mute,4,cmdtext);
dcmd(ann,3,cmdtext);
dcmd(slap,4,cmdtext);
dcmd(acar,4,cmdtext);
dcmd(amotor,6,cmdtext);
return 1;
}
if(PlayerInfo[playerid][pAdminLevel] == 3)
{
dcmd(freeze,6,cmdtext);
dcmd(unfreeze,8,cmdtext);
dcmd(mute,4,cmdtext);
dcmd(ann,3,cmdtext);
dcmd(slap,4,cmdtext);
dcmd(acar,4,cmdtext);
dcmd(amotor,6,cmdtext);
return 1;
}
if(PlayerInfo[playerid][pAdminLevel] == 3)
{
dcmd(freeze,6,cmdtext);
dcmd(unfreeze,8,cmdtext);
dcmd(mute,4,cmdtext);
dcmd(ann,3,cmdtext);
dcmd(slap,4,cmdtext);
dcmd(acar,4,cmdtext);
dcmd(amotor,6,cmdtext);
return 1;
}
return 1;
}
Little question
pawn Код:
dcmd_mute(playerid,params[])
{
#pragma unused params
new pname[MAX_PLAYER_NAME];
new string[128];
new cmdreason[100];
new id;
if(sscanf(params,"us[100]",id,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"Usage: /mute (Player Name/ID) (Reason)");
return 1;
}
GetPlayerName(id,pname,sizeof pname);
if(IsMuted[id] == 1)
{
format(string,sizeof(string),"%s(%d) is already muted by an Administrator.",pname,id);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
IsMuted[id] =1;
format(string,sizeof(string),"An Administrator has muted %s(%d). (Reason: %s.)",pname,id,cmdreason);
SendClientMessageToAll(COLOR_PINK,string);
/*format(string,sizeof(string),"9[ADMIN] Administrator has frozen %s(%d) for reason: %s.",PlayerName(ID),ID,cmdreason);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);*/
return 1;
}