SA-MP Forums Archive
see a list of names - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: see a list of names (/showthread.php?tid=533250)



see a list of names - Alvaro89 - 23.08.2014

Hi, I have a txt file, and I want to see those names that are there by command.

/members

new File:example = fopen("4.txt", io_read);

[IMG][/IMG]


Re: see a list of names - Kyance - 23.08.2014

Example;
pawn Код:
new
    File:members = fopen("4.txt", io_read),
    string[120];
    if(members)
    {
        while(fread(members, string))
        {
            format(string, sizeof(string), "%s\n%s", string, string);
        }
    }
    SendClientMessage(playerid, -1, string);



Respuesta: see a list of names - Alvaro89 - 23.08.2014

Does not work

Send empty message

[IMG][/IMG]


Re: Respuesta: see a list of names - Ada32 - 23.08.2014

Quote:
Originally Posted by Alvaro89
Посмотреть сообщение
Does not work
just as cyborg boy predicted..fortunately he offered a solution hint:
Quote:

[cyborg chatter.]...but you just need two different arrays.




Re: Respuesta: see a list of names - Stinged - 23.08.2014

Check this https://sampforum.blast.hk/showthread.php?tid=529759
Read Jeff's reply. It was removing the last 2 characters so do what I did (Read the last reply)

Quote:
Originally Posted by Ada32
Посмотреть сообщение
just as cyborg boy predicted..fortunately he offered a solution hint:
Why are you calling him "cyborg boy" o_o


Re: see a list of names - Stinged - 23.08.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
That "-2" was to remove the newline characters, which depend on OS - Windows uses "\r\n" (i.e. two characters), Linux uses "\n" and some versions of Mac use "\r" - both 1 character obviously.
Well for some reason it was removing the last two characters (Not \n\r)
For example if I have "Hello", it would send "Hel"


Respuesta: see a list of names - Alvaro89 - 23.08.2014

Try this, but does not work

CMD:test(playerid, params[])
{
new
File:members = fopen("4.txt", io_read),
string[120],string2[120], str[512];
if(members)
{
while(fread(members, string))
{
format(string2, sizeof(string2), "%s\n%s", string2, string);
}
}
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "-", string, "Ok", "");
return 1;
}


Respuesta: see a list of names - Alvaro89 - 23.08.2014

Fail XD




PHP код:
CMD:test(playeridparams[])
{
new
    
File:members fopen("4.txt"io_read),
    
string[512], str[512];
    new 
len;
    if(
members)
    {
        
//while(fread(members, string))
        
while((len fread(members,string)))
        {
            
string[len 2] = 0;
            
strcat(str,string);
        }
        
fclose(members);
    }
    
ShowPlayerDialog(playerid11DIALOG_STYLE_MSGBOX""cVerde"Thanks to"str"Ok""");
    return 
1;




Re: see a list of names - Stinged - 23.08.2014

Read that topic again. You're using dialogs not client messages, so use the first way.


Respuesta: see a list of names - Alvaro89 - 23.08.2014

You can not do with
Код HTML:
DIALOG_STYLE_MSGBOX
?