From 02ac78962924a91fb661ae12941b457b5560d78b Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 23 Dec 2018 10:20:13 +1100 Subject: [PATCH] move /changes to command module --- .../irresistible/cnr/commands/_commands.pwn | 5 +- .../irresistible/cnr/commands/cmd_changes.pwn | 73 ++++++++++++++ gamemodes/irresistible/config/server.pwn | 4 +- gamemodes/sf-cnr.pwn | 98 ------------------- 4 files changed, 80 insertions(+), 100 deletions(-) create mode 100644 gamemodes/irresistible/cnr/commands/cmd_changes.pwn diff --git a/gamemodes/irresistible/cnr/commands/_commands.pwn b/gamemodes/irresistible/cnr/commands/_commands.pwn index 82d358d..123e3dc 100644 --- a/gamemodes/irresistible/cnr/commands/_commands.pwn +++ b/gamemodes/irresistible/cnr/commands/_commands.pwn @@ -5,5 +5,8 @@ * Purpose: encloses all commands */ -/* ** Includes ** */ +/* ** Directories ** */ #include "irresistible\cnr\commands\admin\_admin.pwn" + +/* ** Files ** */ +#include "irresistible\cnr\commands\cmd_changes.pwn" \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/commands/cmd_changes.pwn b/gamemodes/irresistible/cnr/commands/cmd_changes.pwn new file mode 100644 index 0000000..0acb97a --- /dev/null +++ b/gamemodes/irresistible/cnr/commands/cmd_changes.pwn @@ -0,0 +1,73 @@ +/* + * 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; +} \ No newline at end of file diff --git a/gamemodes/irresistible/config/server.pwn b/gamemodes/irresistible/config/server.pwn index 4e29a53..b8df375 100644 --- a/gamemodes/irresistible/config/server.pwn +++ b/gamemodes/irresistible/config/server.pwn @@ -19,7 +19,9 @@ #define SERVER_WEBSITE "www.sfcnr.com" #define SERVER_IP "54.36.127.43:7777" -//#define SERVER_RULES_URL "files.sfcnr.com/en_rules.txt" // comment to disable feature +/* ** Comment line to disable feature ** */ +#define SERVER_RULES_URL "files.sfcnr.com/en_rules.txt" +#define SERVER_CHANGES_FILE "updates.txt" /* ** Hooks ** */ hook OnScriptInit( ) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 00a3695..149b50e 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -2069,46 +2069,6 @@ public OnPlayerText( playerid, text[ ] ) return 1; } -function Untaze( playerid, taze_immunity_seconds ) -{ - if ( !IsPlayerConnected( playerid ) || !p_Tazed{ playerid } ) // || p_Detained{ playerid } == true - return 0; - - if ( ! IsPlayerTied( playerid ) ) - TogglePlayerControllable( playerid, 1 ); - - if ( GetPlayerSpecialAction( playerid ) != SPECIAL_ACTION_CUFFED ) - SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE ); - - ClearAnimations( playerid ); - p_BulletInvulnerbility[ playerid ] = g_iTime + 3; - p_TazingImmunity[ playerid ] = g_iTime + taze_immunity_seconds; - p_Tazed{ playerid } = false; - return 1; -} - -function Uncuff( playerid ) -{ - if ( !IsPlayerConnected( playerid ) || !IsPlayerCuffed( playerid ) || !IsPlayerAttachedObjectSlotUsed( playerid, 2 ) ) - return 0; - - TogglePlayerControllable( playerid, 1 ); - RemovePlayerAttachedObject( playerid, 2 ); - SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE ); - if ( !IsPlayerInAnyVehicle( playerid ) ) { - ClearAnimations( playerid ); - } - p_Cuffed{ playerid } = false; - //p_Detained{ playerid } = false; - //Delete3DTextLabel( p_DetainedLabel[ playerid ] ); - //p_DetainedLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; - //p_DetainedBy[ playerid ] = INVALID_PLAYER_ID; - p_BulletInvulnerbility[ playerid ] = g_iTime + 5; - - SendGlobalMessage( -1, ""COL_GREY"[SERVER]{FFFFFF} %s(%d) has been uncuffed and undetained by the anti-abuse system.", ReturnPlayerName( playerid ), playerid ); - return 1; -} - function RapeDamage( playerid ) { if ( !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || p_InfectedHIV{ playerid } == false || p_Jailed{ playerid } == true ) @@ -3017,64 +2977,6 @@ CMD:vipjob( playerid, params[ ] ) return 1; } -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; -} - CMD:tweets( playerid, params[ ] ) return cmd_twitter( playerid, params ); CMD:twitter( playerid, params[ ] ) {