18.02.2014, 11:02
What is this tutorial? Making a public for a team or admins, or whatever you want, suit it for yourself.
What will we use? We're going to use public admins this time, notes for teams been added.
and also the DCMD command processor.
Now, we're going to create the public we're going to use
Then now we create the command.
Now, we call the command
What is DCMD? It's a command processor which is defined by the line we posted above.
I hope this helps you creating private chats for admins and teams.
Thank You,
Vanter
What will we use? We're going to use public admins this time, notes for teams been added.
Here we go
First, we'll define the color we're using for admin messages, team chat.and also the DCMD command processor.
PHP Code:
//Defining colors
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA
//Defining DCMD
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
PHP Code:
forward SendAdminMessage(color, string[]); //defining the public
public SendAdminMessage(color, string[]) //calling the public
{
for(new i = 0; i < MAX_PLAYERS; i++) //looping through all players
{
if(IsPlayerConnected(i)) //check if he's connected
{
if(IsPlayerAdmin(i)) //checking if the player is rcon connected, (you can edit it to fit your script, ex: (PlayerInfo[playerid][pAdmin] > 5) --- You can also edit this to make it "if(gTeam[i] == TEAM_EXAMPLE)
{
SendClientMessage(i, COLOR_YELLOW, string); //Sending the text to all admins, with the color we define.
}
}
}
}
PHP Code:
public OnPlayerCommandText(playerid, cmdtext[]) //Whenever someone types a command
{
if(IsPlayerAdmin(playerid)) //If player is RCON connected, edit it to fit your own.
{
dcmd(ac,2,cmdtext); //defining the command to pawn.
}
return 1;
}
PHP Code:
dcmd_ac(playerid,params[])
{
new string[128]; //creating the string we're gonna use
new pname[MAX_PLAYER_NAME]; //getting definition of the player username.
GetPlayerName(playerid,pname,sizeof(pname)); //putting the playername in shortcut = pname.
if(!strlen(params)) //if the player types (/ac) only
{
SendClientMessage(playerid,COLOR_RED,"(Error) /ac (Message)"); //edit this if you want to
return 1;
}
format(string,sizeof(string),"[ADMIN CHAT] Admin %s(%d): %s",pname,playerid,params); //formatting the command into (string)
SendAdminMessage(COLOR_YELLOW,string); //Sending string to all admins online as we defined in (public SendAdminMessage)
//IRC_GroupSay(gGroupID,IRC_ADMINCHANNEL,string); //Use this if you have IRC plugin installed with your ADMINCHANNEL.
return 1;
}
I hope this helps you creating private chats for admins and teams.
Thank You,
Vanter