View Single Post
Old 22/12/2018, 01:51 PM   #3425
InsaneBR
Big Clucker
 
InsaneBR's Avatar
 
Join Date: Feb 2018
Posts: 104
Reputation: 8
Default Re: Códigos Úteis #1

PHP Code:
getLine(filename[], numberLinebool:typeLog falseplayerid = -1)
{
    
/*         Use getLine para obter a string em uma linha específica de arquivo.         **
    ************************************** PARÂMETROS ***************************************                                                                  
    ** »» filename[] = Nome do arquivo.                                                    **
    **                                                                                     **
    ** »» numberLine = Número da linha para getar sua string.                              **
    **                                                                                     **
    ** »» typeLog false = Envia a string via print(console).                               **
    **    getLine(filename[], numberLine, false);                                          **
    **                                                                                     **
    ** »» typeLog true = Envia a string via SendClientMessage.                             **                                                             
    **    Use o parâmetro playerid para enviar somente ao jogador que executou a função.   **
    **    getLine(filename[], numberLine, true, playerid);                                 **
    **                                                                                     **
    **    Não use o parâmetro playerid para enviar a todos RCON's online.                  **
    **    getLine(filename[], numberLine, true);                                           **
    *****************************************************************************************/
     
    
if(!fexist(filename))
        return 
printf("[getLine ERROR]: O arquivo %s não existe."filename);
     
    new 
File:archive fopen(filenameio_read),
        
str[2][128],
        
nLine[22],
        
countLine
    
;
    while(
fread(archivestr[0])) {
        
countLine++;
        if(
countLine == numberLinestrcat(str[1], str[0]);
    }
    
format(nLinesizeof(nLine), "[getLine %d]: "numberLine);
    
strins(str[1], nLine0);
    if(
typeLog) {
        if(
playerid != -1)
            
SendClientMessage(playerid, -1str[1]);
         else
             for(new 
i<= GetPlayerPoolSize(); i++)
                if(
IsPlayerAdmin(i)) SendClientMessage(i, -1str[1]);
    }
    else print(
str[1]);
    
    return
        
fclose(archive);


Last edited by InsaneBR; 01/01/2019 at 11:31 PM.
InsaneBR is offline   Reply With Quote