help fixing some errors!!!
#1

this the cmd where the problems are:
Quote:

CMD:admins(playerid,params[]) {
#pragma unused params
new count = 0;
new string[128];
new ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, green, "___________ |- Online Admins -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][Level] >= 1
{
if(IsPlayerAdmin(i))
{
Level = "RCON Administrator";
ChangeColor = red;
}
else
{
switch(PlayerInfo[playerid][i][Level])
{
case 1: {
Level = "Basic Moderator";
ChangeColor = red;
}
case 2: {
Level = "Moderator";
ChangeColor = red;
}
case 3: {
Level = "Master Moderator";
ChangeColor = red;
}
case 4: {
Level = "Administrator";
ChangeColor = red;
}
case 5: {
Level = "Master Administrator";
ChangeColor = red;
}
}
}

format(string, 128, "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] );
SendClientMessage(playerid, ChangeColor, string);
count++;
}
}
}
if (count == 0)
SendClientMessage(playerid,red,"No admin online in the list");
SendClientMessage(playerid, green, " _______________________________________");
return 1;
}

and these are the errors i get when i compile:
Код HTML:
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22567) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22570) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22570) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22575) : warning 213: tag mismatch
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22575) : error 001: expected token: ")", but found "["
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22575) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22575) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22575) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22575) : fatal error 107: too many error messages on one line

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


6 Errors.
the lines in red are the lines where errors are.
Reply
#2

Which are lines 22567, 22570 and 22575?
Reply
#3

plz any one help me i really nedd this((
Reply
#4

I can't identify anything about this messed up code, please use this:

[pawn*]YOUR WHOLE CODE PASTE HERE[/pawn]

BUT without the * OKAY?
Reply
#5

pawn Код:
CMD:admins(playerid,params[]) {
#pragma unused params
new count = 0;
new string[128];
new ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, green, "___________ |- Online Admins -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][Level] >= 1
{
if(IsPlayerAdmin(i))
{
Level = "RCON Administrator";
ChangeColor = red;
}
else
{
switch(PlayerInfo[playerid][i][Level])
{
case 1: {
Level = "Basic Moderator";
ChangeColor = red;
}
case 2: {
Level = "Moderator";
ChangeColor = red;
}
case 3: {
Level = "Master Moderator";
ChangeColor = red;
}
case 4: {
Level = "Administrator";
ChangeColor = red;
}
case 5: {
Level = "Master Administrator";
ChangeColor = red;
}
}
}

format(string, 128, "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] );
SendClientMessage(playerid, ChangeColor, string);
count++;
}
}
}
if (count == 0)
SendClientMessage(playerid,red,"No admin online in the list");
SendClientMessage(playerid, green, " _______________________________________");
return 1;
}
ok done plz help me
Reply
#6

pawn Код:
CMD:admins(playerid, params[]) {
    new
        count = 0,
        string[128],
        ChangeColor[15],
        AdminSyntax[75];
       
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(PlayerInfo[playerid][Level] >= 1) {
           
                if(IsPlayerAdmin(i)) {
                    AdminSyntax = "RCON Administrator";
                    ChangeColor = "red";
                    return true;
                }
                switch(PlayerInfo[playerid][i][Level])
                {
                    case 1: {
                        AdminSyntax = "Basic Moderator";
                        ChangeColor = red;
                    }
                    case 2: {
                        AdminSyntax = "Moderator";
                        ChangeColor = red;
                    }
                    case 3: {
                        AdminSyntax = "Master Moderator";
                        ChangeColor = red;
                    }
                    case 4: {
                        AdminSyntax = "Administrator";
                        ChangeColor = red;
                    }
                    case 5: {
                        AdminSyntax = "Master Administrator";
                        ChangeColor = red;
                    }
                }
                format(string, 128, "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] );
                SendClientMessage(playerid, ChangeColor, string);
                count++;
            }
        }
    }
    if (count == 0) {
        SendClientMessage(playerid,red,"No admin online in the list");
        SendClientMessage(playerid, green, " _______________________________________");
    }
    return true;
}
Does this do what you intended it to?
Reply
#7

i got these errors when i treid your code:
Код HTML:
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22572) : warning 213: tag mismatch
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22572) : error 001: expected token: ")", but found "["
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22572) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22572) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22572) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\[0.3c R2] SATDM~RP V9_FINAL\[0.3c R2]SATDM~RP V9_FINAL\Gamemodes\SATDM_v9.pwn(22572) : fatal error 107: too many error messages on one line

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


4 Errors.
all on this line: switch(PlayerInfo[playerid][i][Level])
Reply
#8

What is line 22572?
Reply
#9

it's switch(PlayerInfo[playerid][i][Level])
Reply
#10

pawn Код:
CMD:admins(playerid, params[]) {
    new
        count = 0,
        string[128],
        ChangeColor[15],
        AdminSyntax[75];
       
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(PlayerInfo[playerid][Level] >= 1) {
           
                if(IsPlayerAdmin(i)) {
                    AdminSyntax = "RCON Administrator";
                    ChangeColor = "red";
                    return true;
                }
                if(PlayerInfo[playerid][Level] == 1) {
                    AdminSyntax = "Basic Moderator";
                    ChangeColor = red;
                }
                else if(PlayerInfo[playerid][Level] == 2) {
                    AdminSyntax = "Moderator";
                    ChangeColor = red;
                }
                else if(PlayerInfo[playerid][Level] == 3) {
                    AdminSyntax = "Master Moderator";
                    ChangeColor = red;
                }
                else if(PlayerInfo[playerid][Level] == 4) {
                    AdminSyntax = "Administrator";
                    ChangeColor = red;
                }
                else if(PlayerInfo[playerid][Level] == 5) {
                    AdminSyntax = "Master Administrator";
                    ChangeColor = red;
                }
                format(string, 128, "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] );
                SendClientMessage(playerid, ChangeColor, string);
                count++;
            }
        }
    }
    if (count == 0) {
        SendClientMessage(playerid,red,"No admin online in the list");
        SendClientMessage(playerid, green, " _______________________________________");
    }
    return true;
}
Used another less efficient way, but it will work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)