Merged in changelog (pull request #71)

Changelog
This commit is contained in:
Lorenc Pekaj 2019-02-03 10:15:18 +00:00
commit 750fab8abb
11 changed files with 171 additions and 81 deletions

3
.gitignore vendored
View File

@ -35,7 +35,8 @@ gamemodes/irresistible/config/database.pwn
scriptfiles/**/*
!scriptfiles/COD/
!scriptfiles/COD/**
!scriptfiles/updates.txt
!scriptfiles/changelogs/
!scriptfiles/changelogs/**
# npc
npcmodes/**/*

View File

@ -20,6 +20,7 @@
#include "irresistible\cnr\wanted_level.pwn"
#include "irresistible\cnr\jobs.pwn"
#include "irresistible\cnr\model_preview.pwn"
#include "irresistible\cnr\changelog.pwn"
// reliant on core definitions
#include "irresistible\cnr\auth\_auth.pwn"

View File

@ -0,0 +1,160 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Cloudy, Lorenc
* Module: cnr\commands\cmd_changes.pwn
* Purpose: /changes to show all changes by a player
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined SERVER_CHANGES_DIRECTORY
#define GetServerVersion(%0) ( "UNKNOWN" )
#endinput
#endif
/* ** Definitions ** */
#define CHANGELOG_INDEX_FILE ( SERVER_CHANGES_DIRECTORY # "/_changelogs.cfg" )
#define DIALOG_CHANGELOGS ( 8372 )
/* ** Commands ** */
CMD:changes( playerid, params[ ] ) return cmd_updates( playerid, params );
CMD:updates( playerid, params[ ] )
{
new
File: handle = fopen( CHANGELOG_INDEX_FILE, io_read );
if ( ! handle )
return SendError( playerid, "There are no updates to show." );
new
changelogs = 0;
szHugeString = ""COL_WHITE"Version\t \n";
// read each line in the changelog index file
while ( fread( handle, szNormalString ) )
{
// remove white spaces
strreplace( szNormalString, "\n", "" ), trimString( szNormalString );
// format string
format( szHugeString, sizeof( szHugeString ), "%s%s\t%s\n", szHugeString, szNormalString, ! changelogs ? ( COL_GREEN # "CURRENT" ) : ( " " ) );
changelogs ++;
}
// list all changelogs
ShowPlayerDialog( playerid, DIALOG_CHANGELOGS, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Changelogs", szHugeString, "Select", "Close" );
return 1;
}
/* ** Hooks ** */
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( dialogid == DIALOG_CHANGELOGS && response )
{
new File: handle = fopen( CHANGELOG_INDEX_FILE, io_read );
if ( ! handle )
return SendError( playerid, "There are no updates to show." );
new version[ 32 ], x = 0;
while ( fread( handle, version ) )
{
if ( x == listitem )
{
// remove white spaces
strreplace( version, "\n", "" ), trimString( version );
// open the single changelog
new File: changelog_handle = fopen( sprintf( SERVER_CHANGES_DIRECTORY # "/%s.txt", version ), io_read );
if ( ! changelog_handle )
return SendError( playerid, "There are no updates to show for this version." );
erase( szNormalString );
erase( szHugeString );
while ( fread( changelog_handle, szNormalString ) )
{
new
find = strfind( szNormalString, "(+)" );
// additions
if( find != -1 )
{
strins( szNormalString, "{23D96F}added{FFFFFF}\t\t", find + 3 );
strdel( szNormalString, find, find + 3);
}
// removals
find = strfind( szNormalString, "(-)" );
if( find != -1 )
{
strins( szNormalString, "{D92323}removed{FFFFFF}\t", find + 3 );
strdel( szNormalString, find, find + 3 );
}
// fixes
find = strfind( szNormalString, "(*)" );
if ( find != -1 )
{
strins( szNormalString, "{D9A823}fixed{FFFFFF}\t\t", find + 3 );
strdel( szNormalString, find, find + 3 );
}
// fixes
find = strfind( szNormalString, "(/)" );
if ( find != -1 )
{
strins( szNormalString, "{c0c0c0}changed{FFFFFF}\t", find + 3 );
strdel( szNormalString, find, find + 3 );
}
// append
strcat( szHugeString, szNormalString );
}
fclose( changelog_handle );
ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, sprintf( "{FFFFFF}Recent Updates - %s", version ), szHugeString, "Okay", "" );
SendServerMessage( playerid, "You're now viewing the changes to the gamemode (version %s).", version );
}
x ++;
}
fclose( handle );
}
return 1;
}
/* ** Functions ** */
stock GetServerVersion( )
{
static
version[ 32 ];
if ( version[ 0 ] == '\0' )
{
new
File: handle = fopen( CHANGELOG_INDEX_FILE, io_read );
if ( handle )
{
// read the first line of the index file
fread( handle, version );
// remove white spaces
strreplace( version, "\n", "" ), trimString( version );
}
else
{
version = "UNKNOWN";
}
fclose( handle );
}
return version;
}

View File

@ -9,7 +9,6 @@
#include "irresistible\cnr\commands\admin\_admin.pwn"
/* ** Files ** */
#include "irresistible\cnr\commands\cmd_changes.pwn"
#include "irresistible\cnr\commands\cmd_twitter.pwn"
#include "irresistible\cnr\commands\cmd_highscores.pwn"
#include "irresistible\cnr\commands\cmd_nametags.pwn"

View File

@ -320,7 +320,7 @@ CMD:svrstats( playerid, params[ ] )
return SendError( playerid, ADMIN_COMMAND_REJECT );
if ( strmatch( params, "version" ) )
return SendServerMessage( playerid, "Current version is "COL_GREY"%s", FILE_BUILD ), 1;
return SendServerMessage( playerid, "Current version is "COL_GREY"%s", GetServerVersion( ) ), 1;
if ( strmatch( params, "ticks" ) )
return SendServerMessage( playerid, "Current tick rate of server is: %d", GetServerTickRate( ) ), 1;

View File

@ -1,73 +0,0 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Cloudy, Lorenc
* Module: cnr\commands\cmd_changes.pwn
* Purpose: /changes to show all changes by a player
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined SERVER_CHANGES_FILE
#endinput
#endif
/* ** Commands ** */
CMD:changes( playerid, params[ ] ) return cmd_updates( playerid, params ); // Command by Cloudy & Sponyy
CMD:updates( playerid, params[ ] )
{
new
File: handle = fopen( "updates.txt", io_read );
if ( ! handle )
return SendError( playerid, "There are no updates to show." );
erase( szNormalString );
erase( szHugeString );
while ( fread( handle, szNormalString ) )
{
new
find = strfind( szNormalString, "(+)" );
// additions
if( find != -1 )
{
strins( szNormalString, "{23D96F}added{FFFFFF}\t\t", find + 3 );
strdel( szNormalString, find, find + 3);
}
// removals
find = strfind( szNormalString, "(-)" );
if( find != -1 )
{
strins( szNormalString, "{D92323}removed{FFFFFF}\t", find + 3 );
strdel( szNormalString, find, find + 3 );
}
// fixes
find = strfind( szNormalString, "(*)" );
if ( find != -1 )
{
strins( szNormalString, "{D9A823}fixed{FFFFFF}\t\t", find + 3 );
strdel( szNormalString, find, find + 3 );
}
// fixes
find = strfind( szNormalString, "(/)" );
if ( find != -1 )
{
strins( szNormalString, "{c0c0c0}changed{FFFFFF}\t", find + 3 );
strdel( szNormalString, find, find + 3 );
}
// append
strcat( szHugeString, szNormalString );
}
fclose( handle );
ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{FFFFFF}Recent Updates - " #FILE_BUILD, szHugeString, "Okay", "" );
SendServerMessage( playerid, "You're now viewing the latest changes to the gamemode (version "#FILE_BUILD")." );
return 1;
}

View File

@ -9,8 +9,6 @@
#include < YSI\y_hooks >
/* ** Definitions ** */
#define FILE_BUILD "v11.45.130"
#define SERVER_NAME "San Fierro Cops And Robbers (0.3.7)"
#define SERVER_MODE_TEXT "Cops And Robbers / DM / Gangs"
#define SERVER_MAP "San Fierro"
@ -23,7 +21,7 @@
#define SERVER_RULES_URL "files.sfcnr.com/en_rules.txt" // used for /rules (cnr\features\server_rules.pwn)
#define SERVER_TWITTER_FEED_URL "files.sfcnr.com/cnr_twitter.php" // used for /twitter (cnr\commands\cmd_twitter.pwn)
#define SERVER_HELP_API_URL "sfcnr.com/api/player/help" // used for /help (cnr\commands\cmd_help.pwn)
#define SERVER_CHANGES_FILE "updates.txt" // used for /changes (cnr\commands\cmd_changes.pwn)
#define SERVER_CHANGES_DIRECTORY "changelogs/cnr" // used for /changes (cnr\changelog.pwn)
#define SERVER_PLS_DONATE_MP3 "http://files.sfcnr.com/game_sounds/pls_donate.mp3" // used for advertising vip (cnr\features\vip\coin_market.pwn)
#define SERVER_MIGRATIONS_FOLDER "./gamemodes/irresistible/config/migrations/cnr/" // used for migrations checking (config\migrations\_migrations.pwn)

View File

@ -148,7 +148,7 @@ public OnGameModeInit()
rl_ServerUpdate = SetTimer( "OnServerUpdateTimer", 960, true );
rl_ZoneUpdate = SetTimer( "OnServerSecondTick", 980, true );
printf( "[SF-CNR] SF-CnR has been successfully initialized. (Build: "#FILE_BUILD" | Time: %d | Tickcount: %d)", ( g_ServerUptime = gettime( ) ), GetTickCount( ) );
printf( "[SF-CNR] SF-CnR has been successfully initialized. (Build: %s | Time: %d | Tickcount: %d)", GetServerVersion( ), ( g_ServerUptime = gettime( ) ), GetTickCount( ) );
return 1;
}
@ -431,7 +431,7 @@ public OnPlayerConnect( playerid )
jailDoors( playerid, false, false );
SendClientMessage( playerid, 0xa9c4e4ff, "{FF0000}[WARNING]{a9c4e4} The concept in this server and GTA in general may be considered explicit material." );
SendClientMessage( playerid, 0xa9c4e4ff, "{FF0000}[INFO]{a9c4e4} The server is currently operating on version " # FILE_BUILD "." );
SendClientMessageFormatted( playerid, 0xa9c4e4ff, "{FF0000}[INFO]{a9c4e4} The server is currently operating on version %s.", GetServerVersion( ) );
if ( IsValidServerVariable( "connectsong" ) )
{

View File

@ -0,0 +1,2 @@
v11.50.142
v11.50.140

View File

@ -0,0 +1,2 @@
(+) You can now use /GPS to find the closest ATM or vehicle with /gps [ATM/VEHICLE].
(+) /changes will show a list of changelogs from hereon out.