see a list of names
#1

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

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

Does not work

Send empty message

[IMG][/IMG]
Reply
#4

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.

Reply
#5

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

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

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

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;

Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)