How to make a /bugreport CMD [REP ++]
#1

ok well if i player finds a bug he can /gubreport and a dialog will pop up allowing him to enter the bug then he can either click submit or cancel and if he clicks submit it will send him a message saying you have successfully submitted a bug report and then that report will save to a log file in the logs folder so say after a week i can open up the log and see a list of all the bugs please help
Reply
#2

It's very simple
pawn Код:
// Command
CMD:bugreport(playerid) return ShowPlayerDialog( playerid, ... );

// Dialog
if(!response) return ( 0 );

new
    File:_File = fopen( "BugReports.txt", io_append ),
    String[500]
;

if( ( _File ) )
{
    format( String, 500, "[BUG REPORT]: %s.\r\n", inputtext );
    fwrite( ( _File ), String );
    fclose( ( _File ) );
}
Reply
#3

see i like that but can you do the hole thing for me lol that doesnt look complete
Reply
#4

Ok..
pawn Код:
// Command
CMD:bugreport(playerid) return ShowPlayerDialog( playerid, 1000, DIALOG_STYLE_INPUT, "Bug Report", "{FFFFFF}Type the bug you have found bellow:", "Send", "Cancel" );

// Dialog ( You add it at the OnDialogResponse Callback )
if( dialogid == 1000 )
{
    if(!response) return ( 0 );

    new
        File:_File = fopen( "BugReports.txt", io_append ),
        String[500]
    ;

    if( ( _File ) )
    {
        format( String, 500, "[BUG REPORT]: %s.\r\n", inputtext );
        fwrite( ( _File ), String );
        fclose( ( _File ) );
    }

    SendClientMessage( playerid, -1, "Your Bug has been sent successfully!" );
   
    return 1;
}
Reply
#5

pawn Код:
// the command
CMD:bugreport(playerid, params[])
{
    ShowPlayerDialog(playerid, 1212, DIALOG_STYLE_INPUT, "Describe the bug", "Please provide us more information with the bug then click Submit", "Submit", "Close");
    return 1;
}
// the Dialog response
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1212)
    {
        if(response)
        {
            new File:Bugs = fopen("Logs/Bugs.txt", io_append); // change accordingly
            new pName[MAX_PLAYER_NAME], Str[256];
            GetPlayerName(playerid, pName, sizeof(pName));
            format(Str, sizeof(Str), "%s Has Reported The Following Problem : %s", pName, inputtext);
            fwrite(Bugs, Str);
            fclose(Bugs);
            SendClientMessage(playerid, -1, "your bug has been submitted successfully
        }
    }
    return 1;
}
NOTE: i didn't compile the script so if you have any errors tell me

And please this is not a place for asking scripts.

EDIT: I was too late.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)