[Pedido] Alguem me arranja [ FS DE mostrar os nicks que o player entrou no server]
#9

Crie a pasta AKA!

pawn Код:
#include a_samp


public OnFilterScriptInit(){

    if(!fexist("/AKA/"))
        return SendRconCommand("exit");
       
    return true;
}


public OnPlayerConnect(playerid){

    static
        File:Arquivo,
        String[200],
        Nomes[100],
        Nome[30],
        IP[16]
    ;
   
    GetPlayerIp(playerid, IP, 16);
   
    format(Nome, 30, "/AKA/%s.ini", IP);
    if(!fexist(Nome)){
        format(String, 128, "Player: %s entrou no servidor", (GetPlayerName(playerid, Nome, 24), Nome));
       
        format(Nome, 30, "/AKA/%s.ini", IP);
        Arquivo = fopen(Nome, io_append);
        GetPlayerName(playerid, Nome, 24);
        strcat(Nome, "\r\n");
        fwrite(Arquivo, Nome);
        fclose(Arquivo);
       
    }else{
   
        static tmp_string[30];
        format(tmp_string, 30, "/AKA/%s.ini", IP);

        GetPlayerName(playerid, Nome, 24);
        format(String, 200, "Player: %s entrou no servidor, mais conhecido como: %s", (GetPlayerName(playerid, Nome, 24), Nome), ReadNomesFromFile(tmp_string, (GetPlayerName(playerid, Nome, 24), Nome)));
       

        if(strfind(ReadNomesFromFile(tmp_string, Nome), Nome) == -1){
            format(Nome, 30, "/AKA/%s.ini", IP);
            Arquivo = fopen(Nome, io_append);
            GetPlayerName(playerid, Nome, 24);
       
            strcat(Nome, "\r\n");
            fwrite(Arquivo, Nome);
            fclose(Arquivo);
        }
    }
   
    SendClientMessageToAll(-1, String);
   
    String[0]   = '\0';
    Nomes[0]    = '\0';
    Nome[0]     = '\0';
    IP[0]       = '\0';
    return true;
}

stock ReadNomesFromFile(filename[], nome[]){
    static
        File: Arquivo,
        Nomes[100],
        Saida[128]
    ;

    Nomes[0] = '\0', Saida[0] = '\0';
    Arquivo = fopen(filename, io_read);
    while(fread(Arquivo, Nomes)){
        strcat(Saida, Nomes);
    }
   
    static
        str_pos,
        part_s
    ;

    str_pos = strfind(Saida, nome);
    part_s  = strlen(nome);

    if(str_pos != -1){
        strdel(Saida, str_pos, part_s);
    }
   
    return Saida;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)