Admin Message
#1

I have this makeadmin script, and I want to make it so admins get a message when someone makes somebody an admin. I am stuck on:
Код:
stock SendAdminMessage(playerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(PlayerInfo[pAdmin] >= 4) continue;
makeadmin:
Код:
CMD:makeadmin(playerid, params[])
{
    if (!Player[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{09F7DF}DENIED: {ffffff}No access");

    new para1, level;
    if (sscanf(params, "ri", para1, level)) return SendClientMessage(playerid, -1, "{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]");
    if (para1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player");
    if (!(1 <= level <= 1338)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 1338");

    new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];

    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));

    Player[para1][pAdmin] = level;

    printf("AdmWarning: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
    format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, 128, "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin.", sendername, giveplayer, level);
	SendAdminMessage(-1, string);
	return 1;
}
Reply
#2

but as your code you set it for Level 4 or Higher admins can see that
You can make it for lower admins also by changing it to 1 , 2, 3 its your choice

Код:
stock SendAdminMessage(Color,string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(PlayerInfo[i][pAdmin] >= 4) 
          {   
 	  SendClientMessage(i, Color, string);
	
         }
       } 
}
Have Fun cheers
Reply
#3

Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : warning 215: expression has no effect
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 001: expected token: ";", but found "]"
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 029: invalid expression, assumed zero
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
stock SendAdminMessage(Color,string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(PlayerInfo[pAdmin] >= 4)
     	{
 		SendClientMessage(i, Color, string);
		}
}
Reply
#4

Something like this, But don't copy/paste, i think i miss some things, cuz i'm on phone :3

PHP код:
stock SendAdminMessage(colormessage[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
Player[i][pAdmin] >= 4)
            {
SendClientMessage(icolormsssage);}
        }

Reply
#5

Quote:
Originally Posted by JXF
Посмотреть сообщение
Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : warning 215: expression has no effect
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 001: expected token: ";", but found "]"
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 029: invalid expression, assumed zero
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
stock SendAdminMessage(Color,string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(PlayerInfo[pAdmin] >= 4)
     	{
 		SendClientMessage(i, Color, string);
		}
}
Change PlayerInfo to Player
Reply
#6

Quote:
Originally Posted by JXF
Посмотреть сообщение
Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : warning 215: expression has no effect
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 001: expected token: ";", but found "]"
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 029: invalid expression, assumed zero
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
stock SendAdminMessage(Color,string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(PlayerInfo[pAdmin] >= 4)
     	{
 		SendClientMessage(i, Color, string);
		}
}
Код:
stock SendAdminMessage(Color,sstring[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(Player[i][pAdmin] >= 4)
     	{
 		SendClientMessage(i, Color, sstring);
		}
}
}
my mistake
Reply
#7

Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : warning 213: tag mismatch
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 033: array must be indexed (variable "Player")
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(40) : error 035: argument type mismatch (argument 2)
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(35) : warning 203: symbol is never used: "color"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
??

Код:
stock SendAdminMessage(color, message[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Player[pAdmin] >= 4)
        SendClientMessage(i, message, color);
        }
}
Reply
#8

Quote:
Originally Posted by MBilal
Посмотреть сообщение
Код:
stock SendAdminMessage(Color,sstring[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(Player[i][pAdmin] >= 4)
     	{
 		SendClientMessage(i, Color, sstring);
		}
}
}
my mistake
Код:
C:\Users\Marius\Desktop\GM\gamemodes\GM.pwn(39) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
sorry if im being a pain.
Reply
#9

use my code above i have edited it (or MBilal one).
They will work.
Reply
#10

Try this code

PHP код:
stock SendAdminMessage(colormessage[])
{
    for (new 
0PLAYERSi++)
    {
        if (
IsPlayerConnected(i) && Player[i][pAdmin] >= 4SendClientMessage(icolormessage);
    }
}
CMD:makeadmin(playeridparams[])
{
    if (!
Player[playerid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"{09F7DF}DENIED: {ffffff}No access");
    new 
para1level;
    if (
sscanf(params"ri"para1level)) return SendClientMessage(playerid, -1"{00E6FF}UTILIZARE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]");
    if (
para1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Invalid player");
    if (!(
<= level <= 1338)) return SendClientMessage(playerid, -1"Invalid level. It must be between 1 and 1338");
    new 
giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];
    
GetPlayerName(para1giveplayersizeof(giveplayer));
    
GetPlayerName(playeridsendernamesizeof(sendername));
    
Player[para1][pAdmin] = level;
    
printf("AdmWarning: %s has promoted %s to a level %d admin."sendernamegiveplayerlevel);
    
format(stringsizeof(string), "   You have been promoted to a level %d admin by %s"levelsendername);
    
SendClientMessage(para1COLOR_LIGHTBLUEstring);
    
format(string128"{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin."sendernamegiveplayerlevel);
    
SendAdminMessage(-1string);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)