12.12.2014, 14:53
Hey guys i have been working on making a /bugreports command. the commands is meant to show a dialog with the bug reports from the .txt. file, the problem i have is that it shows the dialog and only shows the last report, could anyone help me get more reports showing please. i will rep the one whos help works for me.
here is the code so far
i also try to write it another way and can not figure out how to load it at all on this one
If you could help on either on that will be great.
Thanks in advance
here is the code so far
pawn Код:
#include <a_samp>
#include <zcmd>
new File:bugs;
#define DIALOG_BUGS 2008
#define COLOR_YELLOW 0xFFFF00AA // Server Message & Numbers & Names
#define C_White "{FFFFFF}" //Text
CMD:bug(playerid,params[])
{
new string[192], name[MAX_PLAYER_NAME];
if(isnull(params))
{
SendClientMessage(playerid, COLOR_YELLOW, "Usage: "C_White"/bug [Description of the bug]");
return 1;
}
GetPlayerName(playerid, name, sizeof(name));
bugs = fopen("Bugs.txt", io_append);
format(string,sizeof(string),"Reporter: %s | Bug:%s\r\n", name, params);
fwrite(bugs, string);
fclose(bugs);
SendClientMessage(playerid, COLOR_YELLOW, "Server: "C_White"Your bug report sent.");
return 1;
}
CMD:bugreports(playerid, params[])
{
new str[500];
bugs = fopen("Reported_Bugs.txt", io_read);
while(fread(bugs, str, sizeof str, false))
{
ShowPlayerDialog(playerid, DIALOG_BUGS, DIALOG_STYLE_MSGBOX, "Bug Reports", str, "Close", "");
}
fclose(bugs);
return 1;
}
pawn Код:
//Y_INI Version
#include <a_samp>
#include <zcmd>
#include <YSI\y_ini>
CMD:bug(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /bug [Description of the bug]");
BugLog("Bugs.ini", params);
SendClientMessage(playerid, -1, "Server: Bug report sent.");
return 1;
}
CMD:bugreports(playerid, params[])
{
return 1;
}
stock BugLog(file[] , text[])
{
new File:Bugs=fopen(file,io_append);
fwrite(Bugs,text);
fwrite(Bugs,"\r\n");
fclose(Bugs);
return 1;
}
Thanks in advance