SA-MP Forums Archive
[AJUDA] Funзгo para jogador offline. - 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] Funзгo para jogador offline. (/showthread.php?tid=282548)



[AJUDA] Funзгo para jogador offline. - Avalanche! - 11.09.2011

Como eu faзo um esquema para mim poder ver as stats de quem estб offline?
ex.: /stats fulano, aн se ele estiver off, vai mostrar as stats que fica no "nome dele.ini"

Obrigadгo aн galera


Re: [AJUDA] Funзгo para jogador offline. - WLSF - 11.09.2011

posso te fazer um exemplo, pois nгo sei como й o seu sistema todo ai e.e
pawn Код:
if(strcmp(cmd,"/ver", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        tmp = strtok(cmdtext,idx);
        new File:ver = fopen(tmp, io_read);
        if(!fexist(tmp)) return SendClientMessage(playerid, -1,"Conta inexistente");
        format(string,32, level: %d, PlayerInfo[tmp][pLevel]);fread(ver, string);
        fclose(ver);
        return 1;
    }
}
Tenta assim ><


Re: [AJUDA] Funзгo para jogador offline. - RockFire - 11.09.2011

pawn Код:
if(!strcmp(cmdtext, "/status", true))
{
    if(strlen(cmdtext) < 9)
        return false;
    new
        arrStr[40],
        File:file;

    format(arrStr, 40, "%s.ini", cmdtext[9]);
    file = fopen(arrStr, io_read)

    if(!file)
        return false;

    while(fread(file, arrStr))
    {
        if(strfind(arrStr, "Password") != -1) continue;
        SendClientMessage(playerid, -1, arrStr);
    }

    return 1;
}



Re: [AJUDA] Funзгo para jogador offline. - WLSF - 11.09.2011

me explica o seu Rock? (:


Re: [AJUDA] Funзгo para jogador offline. - RockFire - 11.09.2011

vai ler o arquivo da conta do player linha por linha, se tiver "Password" ele passa pro proximo giro do loop


Re: [AJUDA] Funзгo para jogador offline. - Ricop522 - 11.09.2011

pawn Код:
if(!strcmp(cmdtext, "/ver", true)) {
    if(!cmdtext[5]) return 1;
    new string[MAX_PLAYER_NAME+10];
    format(string, 24, "%s - %i", cmdtext[6], dini_Int(cmdtext[6], "Level");
    SendClientMessage(playerid, -1, string);
    return 1;
}



Re: [AJUDA] Funзгo para jogador offline. - [O.z]Caroline - 11.09.2011

Use o cуdigo do Ricop, parece estar certo.


Re: [AJUDA] Funзгo para jogador offline. - [M]onsieur - 11.09.2011

Nгo estб correto o cуdigo de Ricop.

Nгo coloque cmdtext[9], coloque strlen(cmdtext) < 9

Pois colocar cmdtext[9], caso o iterator 9 nгo existir, irб dar um erro no acesso da array.

Seria como new array[5]; array[-1] = 10;
Pode Crash no samp-server


Re: [AJUDA] Funзгo para jogador offline. - [O.z]Caroline - 11.09.2011

Quote:
Originally Posted by [M]onsieur
Посмотреть сообщение
Nгo estб correto o cуdigo de Ricop.

Nгo coloque cmdtext[9], coloque strlen(cmdtext) < 9

Pois colocar cmdtext[9], caso o iterator 9 nгo existir, irб dar um erro no acesso da array.

Seria como new array[5]; array[-1] = 10;
Pode Crash no samp-server
pawn Код:
if(!strcmp(cmdtext,"/status", true, 6)) // status nome ?
    {
        static name[24];
        if(sscanf(cmdtext,"s[24", name))
            return SendClientMessage(playerid, -1,"ERRO: /status <Nome>");
           
        static string[128], ah[30];
        format(ah, sizeof(ah),"%s.ini", name);
       
        if(!fexist(ah))
            return SendClientMessage(playerid, -1,"Conta inexistente!");

        format(string, sizeof(string),"Player: %s, Score: %d", name, dini_Get(ah,"Score"));
        return SendClientMessage(playerid, -1, string);
    }



Re: [AJUDA] Funзгo para jogador offline. - Ricop522 - 11.09.2011

Score й um integer.. '-'