[Tutorial] . txt file Dialog. That is, how to use the Dialog. Txt with.
#1

Hi there!

Today I will explain what I have learned yet ano Pedro master. Now create a new tab and enter this line is 2.
pawn Code:
#include <a_samp>
#include <zcmd>
a_samp: Fund must as without can not be converted.
zcmd: Due command.

Then create a command.
pawn Code:
CMD:help(playerid) {
If you're so far to create a "output" and a "line" is.
pawn Code:
new output[2048], line[512];
 output[0] = EOS;
Although do you have a file in the folder scriptfiles Eg help.txt
pawn Code:
new File:tmp=fopen("commands/help.txt");
In this way you do that. Txt file to bring up. But now comes a layover you can not really understand. First I do not understand it easy.
pawn Code:
if(tmp) {
     while(fread(tmp, line, 512)) strins(output, line, strlen(output), sizeof(output));
     fclose(tmp);
 }
In the meantime, read the open file as long as it is taken. (while) repeats until the result is non-zero reading (fread) set of files.
Now view the Dialog.
pawn Code:
ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "{FFFFFF}Help", kimenet, "Ok", "");
Thus, so the command is fully operational. But we are still not ready. Be alive to finish the order.
pawn Code:
return 1;
}
And we are ready. Now we test. Enter into a txt to file, for example:.. Many a letter "a".
Results.:

(Hungary contains letters)
Full code.:
pawn Code:
#include <a_samp>
#include <zcmd>
 
CMD:help(playerid) {
        new output[2048], line[512];
        output[0] = EOS;
        new File:tmp=fopen("commands/help.txt");
        if(tmp) {
            while(fread(tmp, line, 512)) strins(output, line, strlen(output), sizeof(output));
            fclose(tmp);
        }
        ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "{FFFFFF}Help", output, "Ok", "[x]");
        return 1;
}
Thank you for your attention! Further around a lot.
Reply
#2

Have you tested this code? AFAIK you shouldn't use strins inside any function because it would entirely bug the server. You can use format or strcat instead.
Reply
#3

Tested in the code. What causes a server error? Because I never had any problems with it!
Reply
#4

what is Kimenet ?
Reply
#5

Quote:
Originally Posted by ChandraLouis
View Post
what is Kimenet ?
output
Reply
#6

ops... kimenet=output
Reply
#7

How to next list ?




Code:
#include <a_samp>
#include <zcmd>
 
CMD:help(playerid) {
        new output[2048], line[512];
        output[0] = EOS;
        new File:tmp=fopen("commands/help.txt");
        if(tmp) {
            while(fread(tmp, line, 512)) strins(output, line, strlen(output), sizeof(output));
            fclose(tmp);
        }
        ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "{FFFFFF}Help", output, "Ok", "[x]");
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)