/admins problem
#1

man these are the errors im getting

Код:
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31068) : warning 219: local variable "i" shadows a variable at a preceding level
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31068) : error 017: undefined symbol "YSI_gSplayer"
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31068) : error 017: undefined symbol "YSI_gAplayer"
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31068) : warning 215: expression has no effect
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31068) : error 001: expected token: ";", but found "]"
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31068) : fatal error 107: too many error messages on one line

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


4 Errors.
and this is my command

Код:
CMD:admins(playerid,params[])
{
	new i;
    new Count = 0;
    new string[100], n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, 0x00FF00FF, "__________|Admins|__________");
    foreach(player, i)
    {
        if(PlayerInfo[i][Level] > 0)
        {
            GetPlayerName(i,n,sizeof(n));
            format(string,sizeof(string),"Level %d: %s (ID: %d) - %s", PlayerInfo[i][Level], n, i, GetRankFromLevel(i));
            SendClientMessage(playerid, 0xFF0000FF, string);
            Count++;
        }
    }
    if(Count == 0)
    {
        SendClientMessage(playerid, 0xFF0000FF, "There Are No Administrators Online.");
    }
    SendClientMessage(playerid, 0x00FF00FF, "____________________________");
    return 1;
}

stock GetRankFromLevel(playerid)
{
    new Rank[40];
    switch(PlayerInfo[playerid][Level])
    {
        case 0:
        {
            Rank = "Regular Player";
        }
        case 1:
        {
            Rank = "Trial Administrator";
        }
        case 2:
        {
            Rank = "Junior Moderator";
        }
        case 3:
        {
            Rank = "Moderator";
        }
        case 4:
        {
            Rank = "Head Moderator";
        }
        case 5:
        {
            Rank = "Junior Administrator";
        }
        case 6:
        {
            Rank = "Administrator";
        }
        case 7:
        {
            Rank = "Senior Administrator";
        }
        case 8:
        {
            Rank = "Head Administrator";
        }
        case 9:
        {
            Rank = "Developer";
        }
        case 10:
        {
            Rank = "Head Developer";
        }
    }
    return Rank;
}
please fix it
Reply
#2

Remove the
Код:
new i;
which is at the top, and compile.

Post your results if there are other errors.
Reply
#3

same errors

Код:
Код:
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31034) : error 017: undefined symbol "YSI_gSplayer"
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31034) : error 017: undefined symbol "YSI_gAplayer"
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31034) : warning 215: expression has no effect
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31034) : error 001: expected token: ";", but found "]"
C:\Users\AyushSekhari\Desktop\RevolutionX sa-mp server\gamemodes\RGXTDM.pwn(31034) : fatal error 107: too many error messages on one line

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


4 Errors.
and the line

Код:
   foreach(player, i)
Reply
#4

Use This
Код:
CMD:admins(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2) {
        SendClientMessageEx(playerid, COLOR_GRAD1, "Admins Online:");
        foreach(Player, i) {
            if(PlayerInfo[i][pAdmin] >= 2 && PlayerInfo[i][pAdmin] <= PlayerInfo[playerid][pAdmin]) {
                new string[128], sstring[128], rtoken;
                new strFromFile[128];
                new month, day, year;
                new playern[MAX_PLAYER_NAME];
                GetPlayerName(i, playern, sizeof(playern));
                getdate(year, month, day);
                format(sstring,sizeof(sstring),"admins/rtokens/%s[%d'%d'%d]",playern,month,day,year);
                if(fexist(sstring)) {
                    new File: file = fopen(sstring, io_read);
                    if(file) {
                        fread(file, strFromFile);
                        fclose(file);
                        rtoken = strval(strFromFile);
                    }
Reply
#5

Try this code:

Код:
CMD:admins(playerid,params[])
{
    new Count = 0;
    new string[100], n[MAX_PLAYER_NAME];
    SendClientMessage(playerid, 0x00FF00FF, "__________|Admins|__________");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][Level] > 0)
        {
            GetPlayerName(i,n,sizeof(n));
            format(string,sizeof(string),"Level %d: %s (ID: %d) - %s", PlayerInfo[i][Level], n, i, GetRankFromLevel(i));
            SendClientMessage(playerid, 0xFF0000FF, string);
            Count++;
        }
    }
    if(Count == 0)
    {
        SendClientMessage(playerid, 0xFF0000FF, "There Are No Administrators Online.");
    }
    SendClientMessage(playerid, 0x00FF00FF, "____________________________");
    return 1;
}

stock GetRankFromLevel(playerid)
{
    new Rank[40];
    switch(PlayerInfo[playerid][Level])
    {
        case 0:
        {
            Rank = "Regular Player";
        }
        case 1:
        {
            Rank = "Trial Administrator";
        }
        case 2:
        {
            Rank = "Junior Moderator";
        }
        case 3:
        {
            Rank = "Moderator";
        }
        case 4:
        {
            Rank = "Head Moderator";
        }
        case 5:
        {
            Rank = "Junior Administrator";
        }
        case 6:
        {
            Rank = "Administrator";
        }
        case 7:
        {
            Rank = "Senior Administrator";
        }
        case 8:
        {
            Rank = "Head Administrator";
        }
        case 9:
        {
            Rank = "Developer";
        }
        case 10:
        {
            Rank = "Head Developer";
        }
    }
    return Rank;
}
Reply
#6

oh thanks it compiled +rep to u iskull
Reply
#7

Anytime, buddy.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)