Sending reports to a .txt file in my database.
#1

Hey guys, I am currently making my admin system. I have a report command, and I want all the reports to be sent to a .txt file in my database. Because, if there isn't an Admin online to handle the report, I can check the file and handle it myself.

I use Y_ini. Here is my report command:

Код:
CMD:report( playerid, params[ ] )
{
    new
        targetid,
        reason[ 128 ];

    if ( sscanf( params, "us", targetid, reason ) )
        return SendUsageError( playerid, "/report [Name/ID] [Reason]" );

    if ( targetid == playerid )
        return	SendClientMessage( playerid, RED, "ERROR: {FFFFFF}You cannot report yourself." );

    if ( targetid == INVALID_PLAYER_ID )
        return InvalidPlayerError( playerid );

    SendClientMessage( playerid, RED, "Your report has been successfully been sent to all online Administrators!" );

    new
        playerName[ MAX_PLAYER_NAME ],
        targetName[ MAX_PLAYER_NAME ],
        str[ 128 ];

    GetPlayerName( playerid, playerName, MAX_PLAYER_NAME );
    GetPlayerName( targetid, targetName, MAX_PLAYER_NAME );

    format( str, 128, "[NEW REPORT]: %s [%d] has reported %s [%d]",
    playerName, playerid, targetName, targetid );
    SendMessageToAdmins( 0xFF9500FF, str );

    format( str, 128, "Report reason: %s", reason );
    SendMessageToAdmins( 0xFF9500FF, str );

    return 1;
}
Please help!
Reply
#2

Help?
Reply
#3

You don't necessarily have to use Y_Ini for such a simple task. You can use the fwrite native.
See https://sampwiki.blast.hk/wiki/Fwrite for some examples.
Reply
#4

Or use this.
Even more easy.
Reply
#5

But how do i use fwrite and store reports in it? Plz answer
Reply
#6

There is a perfectly good example provided on the wiki. There are also many examples on these forums. If you are to learn anything you need to stop being lazy and do some research.
Reply
#7

Quote:
Originally Posted by Jay_
Посмотреть сообщение
There is a perfectly good example provided on the wiki. There are also many examples on these forums. If you are to learn anything you need to stop being lazy and do some research.
Your attitude against me is disgusting! You are not helping me, it only has 1 example of fwrite. Can you give me an example
Reply
#8

if(!fexist("Reports.txt)) return 0;
new File:File = fopen("Reports.txt",io_append);
fwrite(File,"SomeText");
fclose(File);
Reply
#9

Yes, and he also said this:

Quote:
Originally Posted by Jay_
Посмотреть сообщение
There are also many examples on these forums.
Quit making a new thread for every single problem you encounter.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)