Posts: 149
Threads: 28
Joined: Jul 2008
Reputation:
0
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!
Posts: 6,129
Threads: 36
Joined: Jan 2009
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.
Posts: 149
Threads: 28
Joined: Jul 2008
Reputation:
0
Thank you,
Is there a way to create like a "SendMessageToAdmins(RED, "blablabla I put it here"); ??
Posts: 6,129
Threads: 36
Joined: Jan 2009
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;
}
Posts: 149
Threads: 28
Joined: Jul 2008
Reputation:
0
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
Posts: 6,129
Threads: 36
Joined: Jan 2009
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;
}