/a (admin) chat -
anumaz - 17.03.2011
Hi,
I was wondering how you can create an "admin" chat.
The line to check if someone's an admin is: if ( GetPVarInt( playerid, "Level" ) > 1 )
I've had a few ideas but I can't really work on them, as I have no idea how to script it successfully.
Thanks for helping!
Re: /a (admin) chat -
grand.Theft.Otto - 17.03.2011
Well it depends on what kind of variables you are using. In Lethal Admin script, this is the code for the admin chat:
pawn Код:
if(text[0] == '#' && if ( GetPVarInt( playerid, "Level" ) > 1 ) { // I REPLACED WITH YOUR VARIABLE
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); MessageToAdmins(green,string);
return 0;
}
I doubt it will work, but give it a try. Place it under OnPlayerText.
If it doesn't work (99% it probably wont
), I recommend downloading an admin script.
Re: /a (admin) chat -
Calgon - 17.03.2011
pawn Код:
CMD:a(playerid, params[]) {
// Checking if is OVER 1, note so level 1 admin won't work for this command, add '=' after the '>' for it to work.
if(GetPVarInt(playerid, "Level") > 1) {
new
szPlayerName[MAX_PLAYER_NAME],
szMessage[128];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "[Admin Chat] %s says: %s", szPlayerName, params);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && GetPVarInt(i, "Level") > 1) {
SendClientMessage(i, 0xFFFF00AA, szMessage);
}
}
}
return 1;
}
CMD:admin(playerid, params[]) {
return cmd_a(playerid, params);
}
Here you go.
Re: /a (admin) chat -
anumaz - 17.03.2011
Thank you,
Is there a way to create like a "SendMessageToAdmins(RED, "blablabla I put it here"); ??
Re: /a (admin) chat -
grand.Theft.Otto - 17.03.2011
There already is one?
You already have SendClientMessage(i, 0xFFFF00AA, szMessage); under CMD:a
Re: /a (admin) chat -
Calgon - 17.03.2011
Yep, but change '0xFFFF00AA' to the hex/colour for 'RED:'
pawn Код:
CMD:amessage(playerid, params[]) {
// Checking if is OVER 1, note so level 1 admin won't work for this command, add '=' after the '>' for it to work.
if(GetPVarInt(playerid, "Level") > 1) {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && GetPVarInt(i, "Level") > 1) {
SendClientMessage(i, 0xFFFF00AA, params);
}
}
}
return 1;
}
Re: /a (admin) chat -
anumaz - 17.03.2011
No no, I mean.
Let's say, there is "SendClientMessage(playerid, color, params);"
But is there a way to create a: SendClientMessageToAdmins(color, params);
Like I could include it to a few other commands. Like "/mute ID" and I'd add: SendClientMessageToAdmins(RED, "Blabla has muted Blabla");
Thanks
Re: /a (admin) chat -
Calgon - 17.03.2011
Ah, sorry. Here you go:
pawn Код:
stock SendClientMessageToAdmins(color, params[]) {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && GetPVarInt(i, "Level") > 1) {
SendClientMessage(i, color, params);
}
}
return 1;
}
Re: /a (admin) chat -
anumaz - 17.03.2011
Okay, and a VERY last question, haha I feel really dumb. I know it could be found somewhere in the many tutorials but it's really simple, for you. Heh :/
Basically, would it work if I'd do:
Код:
new admindude = GetPlayerName(playerid);
new muteddude = GetPlayerName(params); // Params being the "/mute Playername" (playername)
SendClientMessageToAdmins(RED, "%s has muted %d", admindude, muteddude);
Something like that... like... yeah... to "save" or "set" the guy who types the command, and then what is the first word after the command, or the second, you get me I think
Re: /a (admin) chat -
Marricio - 17.03.2011
No, that wont work, use formats..
pawn Код:
new string[128];
format(string,128,"%s has muted %d",admindude, muteddude);
SendClientMessageToAdmins(RED,string);