[AJUDA] Funзгo para jogador offline.
#1

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
Reply
#2

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 ><
Reply
#3

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;
}
Reply
#4

me explica o seu Rock? (:
Reply
#5

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

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;
}
Reply
#7

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

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
Reply
#9

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);
    }
Reply
#10

Score й um integer.. '-'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)