show changelogs in _changelogs.cfg file
This commit is contained in:
parent
a3eee5ae26
commit
a62aae90c4
@ -8,83 +8,153 @@
|
|||||||
/* ** Includes ** */
|
/* ** Includes ** */
|
||||||
#include < YSI\y_hooks >
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
#define GetServerVersion(%0) \
|
|
||||||
( "UNKNOWN" )
|
|
||||||
#endinput
|
|
||||||
/* ** Error Checking ** */
|
/* ** Error Checking ** */
|
||||||
#if !defined SERVER_CHANGES_DIRECTORY
|
#if !defined SERVER_CHANGES_DIRECTORY
|
||||||
|
#define GetServerVersion(%0) ( "UNKNOWN" )
|
||||||
|
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ** Definitions ** */
|
/* ** Definitions ** */
|
||||||
#define CHANGELOG_INDEX_FILE ( SERVER_CHANGES_DIRECTORY # "/_changelogs.cfg" )
|
#define CHANGELOG_INDEX_FILE ( SERVER_CHANGES_DIRECTORY # "/_changelogs.cfg" )
|
||||||
|
#define DIALOG_CHANGELOGS ( 8372 )
|
||||||
|
|
||||||
/* ** Commands ** */
|
/* ** Commands ** */
|
||||||
// CMD:changes( playerid, params[ ] ) return cmd_updates( playerid, params ); // Command by Cloudy & Sponyy
|
CMD:changes( playerid, params[ ] ) return cmd_updates( playerid, params );
|
||||||
// CMD:updates( playerid, params[ ] )
|
CMD:updates( playerid, params[ ] )
|
||||||
// {
|
{
|
||||||
// new
|
new
|
||||||
// File: handle = fopen( SERVER_CHANGES_DIRECTORY # "/updates.txt", io_read );
|
File: handle = fopen( CHANGELOG_INDEX_FILE, io_read );
|
||||||
|
|
||||||
// if ( ! handle )
|
if ( ! handle )
|
||||||
// return SendError( playerid, "There are no updates to show." );
|
return SendError( playerid, "There are no updates to show." );
|
||||||
|
|
||||||
// erase( szNormalString );
|
new
|
||||||
// erase( szHugeString );
|
changelogs = 0;
|
||||||
|
|
||||||
// while ( fread( handle, szNormalString ) )
|
szHugeString = ""COL_WHITE"Version\t \n";
|
||||||
// {
|
|
||||||
// new
|
|
||||||
// find = strfind( szNormalString, "(+)" );
|
|
||||||
|
|
||||||
// // additions
|
// read each line in the changelog index file
|
||||||
// if( find != -1 )
|
while ( fread( handle, szNormalString ) )
|
||||||
// {
|
{
|
||||||
// strins( szNormalString, "{23D96F}added{FFFFFF}\t\t", find + 3 );
|
// remove white spaces
|
||||||
// strdel( szNormalString, find, find + 3);
|
strreplace( szNormalString, "\n", "" ), trimString( szNormalString );
|
||||||
// }
|
|
||||||
|
|
||||||
// // removals
|
// format string
|
||||||
// find = strfind( szNormalString, "(-)" );
|
format( szHugeString, sizeof( szHugeString ), "%s%s\t%s\n", szHugeString, szNormalString, ! changelogs ? ( COL_GREEN # "CURRENT" ) : ( " " ) );
|
||||||
// if( find != -1 )
|
changelogs ++;
|
||||||
// {
|
}
|
||||||
// strins( szNormalString, "{D92323}removed{FFFFFF}\t", find + 3 );
|
|
||||||
// strdel( szNormalString, find, find + 3 );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // fixes
|
// list all changelogs
|
||||||
// find = strfind( szNormalString, "(*)" );
|
ShowPlayerDialog( playerid, DIALOG_CHANGELOGS, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Changelogs", szHugeString, "Select", "Close" );
|
||||||
// if ( find != -1 )
|
return 1;
|
||||||
// {
|
}
|
||||||
// strins( szNormalString, "{D9A823}fixed{FFFFFF}\t\t", find + 3 );
|
|
||||||
// strdel( szNormalString, find, find + 3 );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // fixes
|
/* ** Hooks ** */
|
||||||
// find = strfind( szNormalString, "(/)" );
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
// if ( find != -1 )
|
{
|
||||||
// {
|
if ( dialogid == DIALOG_CHANGELOGS && response )
|
||||||
// strins( szNormalString, "{c0c0c0}changed{FFFFFF}\t", find + 3 );
|
{
|
||||||
// strdel( szNormalString, find, find + 3 );
|
new File: handle = fopen( CHANGELOG_INDEX_FILE, io_read );
|
||||||
// }
|
|
||||||
|
|
||||||
// // append
|
if ( ! handle )
|
||||||
// strcat( szHugeString, szNormalString );
|
return SendError( playerid, "There are no updates to show." );
|
||||||
// }
|
|
||||||
|
|
||||||
// fclose( handle );
|
new version[ 32 ], x = 0;
|
||||||
// ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, sprintf( "{FFFFFF}Recent Updates - %s", GetServerVersion( ) ), szHugeString, "Okay", "" );
|
|
||||||
// SendServerMessage( playerid, "You're now viewing the latest changes to the gamemode (version %s).", GetServerVersion( ) );
|
while ( fread( handle, version ) )
|
||||||
// return 1;
|
{
|
||||||
// }
|
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 ** */
|
/* ** Functions ** */
|
||||||
stock GetServerVersion( )
|
stock GetServerVersion( )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
version[ 32 ];
|
version[ 32 ];
|
||||||
printf( "Version: %s", version );
|
|
||||||
|
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;
|
return version;
|
||||||
}
|
}
|
@ -1 +1,2 @@
|
|||||||
|
v11.50.142
|
||||||
v11.50.140
|
v11.50.140
|
2
scriptfiles/changelogs/cnr/v11.50.142.txt
Normal file
2
scriptfiles/changelogs/cnr/v11.50.142.txt
Normal 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.
|
Loading…
Reference in New Issue
Block a user