Admins online
#1

Uhm too much errors
Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdminLevel] >= 1)
            {
                if(PlayerInfo[i][pAdminLevel] == 1) AdminPos=""cyellow"Moderator";
                else if(PlayerInfo[i][pAdminLevel] == 2) AdminPos=""cyellow"Administrator";
                else if(PlayerInfo[i][pAdminLevel] == 3) AdminPos=""cgreen"Head Administrator";
                else if(PlayerInfo[i][pAdminLevel] == 4) AdminPos=""cred"Owner";
                format(string,sizeof(string),"%s"cgreen2"%s(ID:%d) "cyellow2"- "cblue"%s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,""cwhite"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",""cred"No Admins Online!","OK","");
        }
    }
    return 1;
}
Код:
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1170) : error 001: expected token: "-string end-", but found "-identifier-"
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1170) : error 017: undefined symbol "cyellow"
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1170) : warning 215: expression has no effect
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1171) : error 029: invalid expression, assumed zero
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1171) : warning 215: expression has no effect
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1171) : error 001: expected token: ";", but found "if"
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1171) : error 001: expected token: "-string end-", but found "-identifier-"
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1171) : fatal error 107: too many error messages on one line

Error line
Код:
if(PlayerInfo[i][pAdminLevel] == 1) AdminPos=""cyellow"Moderator";
Reply
#2

What does this do: AdminPos=""cyellow"Moderator";
Reply
#3

Ah I resolved all almost all errors now, but I get some different error (on 1 line only)
Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    new GetPName[MAX_PLAYER_NAME];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdminLevel] >= 1)
            {
                if(PlayerInfo[i][pAdminLevel] == 1) AdminPos="Moderator";
                else if(PlayerInfo[i][pAdminLevel] == 2) AdminPos="Administrator";
                else if(PlayerInfo[i][pAdminLevel] == 3) AdminPos="Head Administrator";
                else if(PlayerInfo[i][pAdminLevel] == 4) AdminPos="Owner";
                format(string,sizeof(string),"%s %s(ID:%d) %s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online","No Admins Online!","OK","");
        }
    }
    return 1;
}
Error line:
Код:
format(string,sizeof(string),"%s %s(ID:%d) %s \n",string,GetPName(i),i,AdminPos);
Reply
#4

You may change the admin levels etc..

pawn Код:
CMD:admins(playerid, params[])
{
    new string[128];
    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 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);
                    }
                }

                if(PlayerInfo[i][pAdminDuty] == 1)
                if(PlayerInfo[playerid][pAdmin] >= 1337) {
                    if(PlayerInfo[i][pAdmin] == 2) {
                        format(string, sizeof(string), "*Junior Admin: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 3) {
                        format(string, sizeof(string), "*General Admin: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 4) {
                        format(string, sizeof(string), "*Senior Admin: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 1337) {
                        format(string, sizeof(string), "*Elite Admin: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 1338) {
                        format(string, sizeof(string), "*Head Admin: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 1339) {
                        format(string, sizeof(string), "*Co-Executive Director: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 99998) {
                        format(string, sizeof(string), "*Server Co-Owner: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 99999) {
                        format(string, sizeof(string), "*Server Owner: %s (Reports Today: %d)(On-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else {
                        format(string, sizeof(string), "*Undefined Admin (%d): %s", PlayerInfo[i][pAdmin], GetPlayerNameEx(i));
                    }
                }
                else {
                    if(PlayerInfo[i][pAdmin] == 2) {
                        format(string, sizeof(string), "*Junior Admin: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 3) {
                        format(string, sizeof(string), "*General Admin: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 4) {
                        format(string, sizeof(string), "*Senior Admin: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 1337) {
                        format(string, sizeof(string), "*Elite Admin: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 1338) {
                        format(string, sizeof(string), "*Head Admin: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 1339) {
                        format(string, sizeof(string), "*Co-Executive Director: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 99998) {
                        format(string, sizeof(string), "*Server Co-Owner: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 99999) {
                        format(string, sizeof(string), "*Server Owner: %s (On-Duty)", GetPlayerNameEx(i));
                    }
                    else {
                        format(string, sizeof(string), "*Undefined Admin (%d): %s (On-Duty)", PlayerInfo[i][pAdmin], GetPlayerNameEx(i));
                    }
                }

                if(PlayerInfo[i][pAdminDuty] == 0)
                if(PlayerInfo[playerid][pAdmin] >= 4) {
                    if(PlayerInfo[i][pAdmin] == 2) {
                        format(string, sizeof(string), "*Junior Admin: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 3) {
                        format(string, sizeof(string), "*General Admin: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 4) {
                        format(string, sizeof(string), "*Senior Admin: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 1337) {
                        format(string, sizeof(string), "*Elite Admin: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 1338) {
                        format(string, sizeof(string), "*Head Admin: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 1339) {
                        format(string, sizeof(string), "*Co-Executive Director: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 99998) {
                        format(string, sizeof(string), "*Server Co-Owner: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else if(PlayerInfo[i][pAdmin] == 99999) {
                        format(string, sizeof(string), "*Server Owner: %s (Reports Today: %d)(Off-Duty)", GetPlayerNameEx(i), rtoken);
                    }
                    else {
                        format(string, sizeof(string), "*Undefined Admin (%d): %s", PlayerInfo[i][pAdmin], GetPlayerNameEx(i));
                    }
                }
                else {
                    if(PlayerInfo[i][pAdmin] == 2) {
                        format(string, sizeof(string), "*Junior Admin: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 3) {
                        format(string, sizeof(string), "*General Admin: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 4) {
                        format(string, sizeof(string), "*Senior Admin: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 1337) {
                        format(string, sizeof(string), "*Elite Admin: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 1339) {
                        format(string, sizeof(string), "*Head Admin: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 1339) {
                        format(string, sizeof(string), "*Co-Executive Director: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 99998) {
                        format(string, sizeof(string), "*Server Co-Owner: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else if(PlayerInfo[i][pAdmin] == 99999) {
                        format(string, sizeof(string), "*Server Owner: %s (Off-Duty)", GetPlayerNameEx(i));
                    }
                    else {
                        format(string, sizeof(string), "*Undefined Admin (%d): %s", PlayerInfo[i][pAdmin], GetPlayerNameEx(i));
                    }
                }


                if(PlayerInfo[i][pBanAppealer]) strcat(string, " [BA]");
                if(PlayerInfo[i][pShopTech]) strcat(string, " [ST]");
                if(PlayerInfo[i][pUndercover]) strcat(string, " [UC]");
                if(PlayerInfo[i][pFactionModerator]) strcat(string, " [FMOD]");
                if(PlayerInfo[i][pGangModerator]) strcat(string, " [GMOD]");
                if(PlayerInfo[i][pTogReports]) strcat(string, " [SPEC MODE]");
                SendClientMessageEx(playerid, COLOR_GRAD2, string);
            }
        }
    }
    else {
        foreach(Player, i) {
            if(PlayerInfo[i][pAdmin] >= 2) {
                if(PlayerInfo[i][pAdminDuty] == 1) {
                    format(string, sizeof(string), "%s (Level: %d)(On-Duty)", GetPlayerNameEx(i), PlayerInfo[i][pAdmin]);
                    SendClientMessageEx(playerid, COLOR_YELLOW, string);
                }
            }
        }
        SendClientMessageEx(playerid, COLOR_YELLOW, "If you have questions regarding gameplay, or the server use /n.");
        SendClientMessageEx(playerid, COLOR_YELLOW, "If you see suspicious happenings/players /report [id] [reason].");
    }
    return 1;
}
Reply
#5

I need my code fixed

Код:
format(string,sizeof(string),"%s %s(ID:%d) %s \n",string,GetPName(i),i,AdminPos);
Reply
#6

What's the error?
Reply
#7

This one
Код:
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1172) : error 012: invalid function call, not a valid address
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1172) : warning 215: expression has no effect
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1172) : error 001: expected token: ";", but found ")"
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1172) : error 029: invalid expression, assumed zero
D:\Scripting\SAMP 0.3x server\gamemodes\Lvtdm.pwn(1172) : fatal error 107: too many error messages on one line
Reply
#8

Hmm well I see AdminPos, assuming that's holding a float, you'll want to use %f not %s.

So like this:

format(string,sizeof(string),"%s %s(ID:%d) %f \n",string,GetPName(i),i,AdminPos);
Reply
#9

The admin pos is
if(PlayerInfo[i][pAdminLevel] == 1) AdminPos="Moderator";


Edit: Nope, still doesnt work.

This is the entire stuff.
Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    new GetPName[MAX_PLAYER_NAME];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdminLevel] >= 1)
            {
                if(PlayerInfo[i][pAdminLevel] == 1) AdminPos="Moderator";
                else if(PlayerInfo[i][pAdminLevel] == 2) AdminPos="Administrator";
                else if(PlayerInfo[i][pAdminLevel] == 3) AdminPos="Head Administrator";
                else if(PlayerInfo[i][pAdminLevel] == 4) AdminPos="Owner";
                format(string,sizeof(string),"%s %s(ID:%d) %s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online","No Admins Online!","OK","");
        }
    }
    return 1;
}
Reply
#10

Try editing that part of the code, so it looks like:

pawn Код:
if(PlayerInfo[i][pAdminLevel] == 1)
{
    AdminPos = "{colorhexcodehere}Moderator";
}
else if(PlayerInfo[i][pAdminLevel] == 2)
{
    AdminPos = "{colorhexcodehere}Administrator";
}
else if(PlayerInfo[i][pAdminLevel] == 3)
{
    AdminPos = "{colorhexcodehere}Head Administrator";
}
else if(PlayerInfo[i][pAdminLevel] == 4)
{
    AdminPos = "{colorhexcodehere}Owner";
}
EDIT: Sorry the format line would be %s not %f, i posted that before I saw what AdminPos was.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)