SA-MP Forums Archive
[Ajuda] /Admins Crash - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] /Admins Crash (/showthread.php?tid=618272)



/Admins Crash - FalcaoNC - 03.10.2016

@RESOLVIDO


Re: /Admins Crash - RodrigoMSR - 03.10.2016

Mande o cуdigo.


Re: /Admins Crash - FalcaoNC - 03.10.2016

resolvido.


Re: /Admins Crash - RodrigoMSR - 03.10.2016

A pasta "AUSENTES" existe na scriptfiles?


Re: /Admins Crash - FalcaoNC - 03.10.2016

Quote:
Originally Posted by RodrigoMSR
Посмотреть сообщение
A pasta "AUSENTES" existe na scriptfiles?
Siim


Re: /Admins Crash - RodrigoMSR - 03.10.2016

Tente isso:
Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new PTstring[500], PTstr2[128], stringCargo[30], playerNome[MAX_PLAYER_NAME];

    for(new i = 0, mp = GetPlayerPoolSize(); i <= mp; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
        {
            if(HideAdm[i] != 0)
                continue;

            switch(PlayerInfo[i][pAdmin])
            {
                case 1: stringCargo = "Temporario";
                case 2: stringCargo = "Moderador";
                case 3: stringCargo = "Auxiliar";
                case 4: stringCargo = "Administrador";
                case 1337: stringCargo = "Master Editor";
                case 1338: stringCargo = "Responsavel Lider";
                case 1339: stringCargo = "Supervidor";
                case 1340: stringCargo = "Gerente";
                case 1341: stringCargo = "Sub Dono";
                case 1342: stringCargo = "Fundador";
                case 3000: stringCargo = "Resposavel Geral";

            }
            GetPlayerName(i, playerNome, sizeof(playerNome));

            if(away[i] == 0)
            {
                format(PTstr2, sizeof(PTstr2), "{FF69B4}%s {FFFFFF}- Cargo: {FF69B4}%s{FFFFFF} - Modo: %s", playerNome, stringCargo, admtrampando[i] == 1 ? ("{00B2EE} Trabalhando") : ("{32CD32} Jogando"));
                strcat(PTstring, PTstr2, sizeof(PTstring));
            }
            else
            {
                new datatext[129];
                format(datatext, sizeof(datatext), "AUSENTES/%s.txt",sendername);
                if(fexist(datatext))
                {
                    new File:handle = fopen(datatext, io_read), buf[128];
                    if(handle)
                    {
                        while(fread(handle, buf))
                        {
                            datatext = buf;
                        }
                        fclose(handle);
                    }

                }
                else
                {
                    datatext = "Sem Motivo";
                }
                format(PTstr2, sizeof(PTstr2), "{FF69B4}%s {FFFFFF}- Cargo: {FF69B4}%s{FFFFFF} - Modo:{FFFF00} Ausente{FFFFFF} - Motivo:{FFFF00} %s", playerNome, stringCargo, datatext);
                strcat(PTstring, PTstr2, sizeof(PTstring));
            }
        }
    }
    ShowPlayerDialog(playerid, 1999, DIALOG_STYLE_LIST, "{FF69B4}» {FFFFFF} Admins Online: {FF69B4} «", PTstring, "Ok", "");
    return 1;
}



Re: /Admins Crash - FalcaoNC - 03.10.2016

Quote:
Originally Posted by RodrigoMSR
Посмотреть сообщение
Tente isso:
Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new PTstring[500], PTstr2[128], stringCargo[30], playerNome[MAX_PLAYER_NAME];

    for(new i = 0, mp = GetPlayerPoolSize(); i <= mp; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
        {
            if(HideAdm[i] != 0)
                continue;

            switch(PlayerInfo[i][pAdmin])
            {
                case 1: stringCargo = "Temporario";
                case 2: stringCargo = "Moderador";
                case 3: stringCargo = "Auxiliar";
                case 4: stringCargo = "Administrador";
                case 1337: stringCargo = "Master Editor";
                case 1338: stringCargo = "Responsavel Lider";
                case 1339: stringCargo = "Supervidor";
                case 1340: stringCargo = "Gerente";
                case 1341: stringCargo = "Sub Dono";
                case 1342: stringCargo = "Fundador";
                case 3000: stringCargo = "Resposavel Geral";

            }
            GetPlayerName(i, playerNome, sizeof(playerNome));

            if(away[i] == 0)
            {
                format(PTstr2, sizeof(PTstr2), "{FF69B4}%s {FFFFFF}- Cargo: {FF69B4}%s{FFFFFF} - Modo: %s", playerNome, stringCargo, admtrampando[i] == 1 ? ("{00B2EE} Trabalhando") : ("{32CD32} Jogando"));
                strcat(PTstring, PTstr2, sizeof(PTstring));
            }
            else
            {
                new datatext[129];
                format(datatext, sizeof(datatext), "AUSENTES/%s.txt",sendername);
                if(fexist(datatext))
                {
                    new File:handle = fopen(datatext, io_read), buf[128];
                    if(handle)
                    {
                        while(fread(handle, buf))
                        {
                            datatext = buf;
                        }
                        fclose(handle);
                    }

                }
                else
                {
                    datatext = "Sem Motivo";
                }
                format(PTstr2, sizeof(PTstr2), "{FF69B4}%s {FFFFFF}- Cargo: {FF69B4}%s{FFFFFF} - Modo:{FFFF00} Ausente{FFFFFF} - Motivo:{FFFF00} %s", playerNome, stringCargo, datatext);
                strcat(PTstring, PTstr2, sizeof(PTstring));
            }
        }
    }
    ShowPlayerDialog(playerid, 1999, DIALOG_STYLE_LIST, "{FF69B4}» {FFFFFF} Admins Online: {FF69B4} «", PTstring, "Ok", "");
    return 1;
}
Код:
(50017) : error 017: undefined symbol "GetPlayerPoolSize"



Re: /Admins Crash - RodrigoMSR - 03.10.2016

Essa funзгo й da versгo 0.3.7, atualize a versгo ou substitua por GetMaxPlayers().


Re: /Admins Crash - FalcaoNC - 03.10.2016

Quote:
Originally Posted by RodrigoMSR
Посмотреть сообщение
Essa funзгo й da versгo 0.3.7, atualize a versгo ou substitua por GetMaxPlayers().
Mudei, mas ainda continua crashando.


Re: /Admins Crash - RodrigoMSR - 03.10.2016

Encontrei o erro, vocк esqueceu de pular a linha a cada novo administrador incluido, tente:
Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new PTstring[500], PTstr2[128], stringCargo[30], playerNome[MAX_PLAYER_NAME];

    for(new i = 0; i <= MaiorID; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
        {
            if(HideAdm[i] != 0)
                continue;

            switch(PlayerInfo[i][pAdmin])
            {
                case 1: stringCargo = "Temporario";
                case 2: stringCargo = "Moderador";
                case 3: stringCargo = "Auxiliar";
                case 4: stringCargo = "Administrador";
                case 1337: stringCargo = "Master Editor";
                case 1338: stringCargo = "Responsavel Lider";
                case 1339: stringCargo = "Supervidor";
                case 1340: stringCargo = "Gerente";
                case 1341: stringCargo = "Sub Dono";
                case 1342: stringCargo = "Fundador";
                case 3000: stringCargo = "Resposavel Geral";

            }
            GetPlayerName(i, playerNome, sizeof(playerNome));

            if(away[i] == 0)
            {
                format(PTstr2, sizeof(PTstr2), "{FF69B4}%s {FFFFFF}- Cargo: {FF69B4}%s{FFFFFF} - Modo: %s\n", playerNome, stringCargo, admtrampando[i] == 1 ? ("{00B2EE} Trabalhando") : ("{32CD32} Jogando"));
                strcat(PTstring, PTstr2, sizeof(PTstring));
            }
            else
            {
                new datatext[129];
                format(datatext, sizeof(datatext), "AUSENTES/%s.txt",sendername);
                if(fexist(datatext))
                {
                    new File:handle = fopen(datatext, io_read), buf[128];
                    if(handle)
                    {
                        while(fread(handle, buf))
                        {
                            datatext = buf;
                        }
                        fclose(handle);
                    }

                }
                else
                {
                    datatext = "Sem Motivo";
                }
                format(PTstr2, sizeof(PTstr2), "{FF69B4}%s {FFFFFF}- Cargo: {FF69B4}%s{FFFFFF} - Modo:{FFFF00} Ausente{FFFFFF} - Motivo:{FFFF00} %s\n", playerNome, stringCargo, datatext);
                strcat(PTstring, PTstr2, sizeof(PTstring));
            }
        }
    }
    ShowPlayerDialog(playerid, 1999, DIALOG_STYLE_LIST, "{FF69B4}» {FFFFFF} Admins Online: {FF69B4} «", PTstring, "Ok", "");
    return 1;
}