From 304881b1233fef1bf7f2d81481f8509d86e6427d Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 1 Jan 2019 22:46:57 +1100 Subject: [PATCH] remove auto-save feature because it is already automatic now --- .../cnr/features/business/business.pwn | 1 - .../irresistible/cnr/features/hotel_da_novic.pwn | 1 - .../irresistible/cnr/features/houses/house.pwn | 1 - .../cnr/features/player/player_settings.pwn | 9 ++++----- .../cnr/features/vehicles/garages.pwn | 1 - .../cnr/features/vehicles/vdealership.pwn | 1 - .../cnr/20190101_cnr_remove_xp_autosave.sql | 13 +++++++++++++ gamemodes/sf-cnr.pwn | 16 ---------------- 8 files changed, 17 insertions(+), 26 deletions(-) create mode 100644 gamemodes/irresistible/config/migrations/cnr/20190101_cnr_remove_xp_autosave.sql diff --git a/gamemodes/irresistible/cnr/features/business/business.pwn b/gamemodes/irresistible/cnr/features/business/business.pwn index e0ece18..2b0ca50 100644 --- a/gamemodes/irresistible/cnr/features/business/business.pwn +++ b/gamemodes/irresistible/cnr/features/business/business.pwn @@ -453,7 +453,6 @@ CMD:business( playerid, params[ ] ) UpdateBusinessData( b ); UpdateBusinessTitle( b ); GivePlayerCash( playerid, -( g_businessData[ b ] [ E_COST ] ) ); - autosaveStart( playerid, true ); SendClientMessageFormatted( playerid, -1, ""COL_GREY"[BUSINESS]"COL_WHITE" You have bought this business for "COL_GOLD"%s"COL_WHITE".", cash_format( g_businessData[ b ] [ E_COST ] ) ); return 1; } diff --git a/gamemodes/irresistible/cnr/features/hotel_da_novic.pwn b/gamemodes/irresistible/cnr/features/hotel_da_novic.pwn index 83d49f8..9cbba28 100644 --- a/gamemodes/irresistible/cnr/features/hotel_da_novic.pwn +++ b/gamemodes/irresistible/cnr/features/hotel_da_novic.pwn @@ -160,7 +160,6 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) return SendError( playerid, "You don't have enough money for this ($5,000,000)." ); GivePlayerCash( playerid, -5000000 ); - autosaveStart( playerid, true ); // auto-save new aID = p_apartmentEnter{ playerid }; g_apartmentData[ aID ] [ E_CREATED ] = true; diff --git a/gamemodes/irresistible/cnr/features/houses/house.pwn b/gamemodes/irresistible/cnr/features/houses/house.pwn index e10727f..22af7d7 100644 --- a/gamemodes/irresistible/cnr/features/houses/house.pwn +++ b/gamemodes/irresistible/cnr/features/houses/house.pwn @@ -426,7 +426,6 @@ CMD:h( playerid, params[ ] ) return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); GivePlayerCash( playerid, -( g_houseData[ i ] [ E_COST ] ) ); - autosaveStart( playerid, true ); // force_save SendServerMessage( playerid, "You have bought this home for "COL_GOLD"%s"COL_WHITE"!", cash_format( g_houseData[ i ] [ E_COST ] ) ); SetHouseOwner( i, p_AccountID[ playerid ], ReturnPlayerName( playerid ) ); diff --git a/gamemodes/irresistible/cnr/features/player/player_settings.pwn b/gamemodes/irresistible/cnr/features/player/player_settings.pwn index eafffed..552530b 100644 --- a/gamemodes/irresistible/cnr/features/player/player_settings.pwn +++ b/gamemodes/irresistible/cnr/features/player/player_settings.pwn @@ -9,14 +9,14 @@ #include < YSI\y_hooks > /* ** Definitions ** */ -#define MAX_SETTINGS ( 14 ) +#define MAX_SETTINGS ( 13 ) #define SETTING_BAILOFFERS ( 0 ) #define SETTING_EVENT_TP ( 1 ) #define SETTING_GANG_INVITES ( 2 ) #define SETTING_CHAT_PREFIXES ( 3 ) #define SETTING_RANSOMS ( 4 ) -#define SETTING_AUTOSAVE ( 5 ) +#define SETTING_CHAT_ID ( 5 ) #define SETTING_CONNECTION_LOG ( 6 ) #define SETTING_HITMARKER ( 7 ) #define SETTING_VIPSKIN ( 8 ) @@ -24,14 +24,13 @@ #define SETTING_TOP_DONOR ( 10 ) #define SETTING_WEAPON_PICKUP ( 11 ) #define SETTING_PASSIVE_MODE ( 12 ) -#define SETTING_CHAT_ID ( 13 ) /* ** Variables ** */ static stock g_PlayerSettings [ MAX_SETTINGS ] [ 24 ] = { { "Prevent Bail Offers" }, { "Prevent Event Teleports" }, { "Prevent Gang Invites" }, { "Prevent Chat Prefixes" }, { "Prevent Ransom Offers" }, - { "Prevent Auto-Save" }, { "Display Connection Log" }, { "Display Hitmarker" }, { "Set V.I.P Skin" }, { "Hide Total Coin Bar" }, { "Hide Last Donor Text" }, - { "Manual Pickup Weapon" }, { "Prevent Passive Mode" }, { "Display User ID In Chat" } + { "Display User ID In Chat" }, { "Display Connection Log" }, { "Display Hitmarker" }, { "Set V.I.P Skin" }, { "Hide Total Coin Bar" }, { "Hide Last Donor Text" }, + { "Manual Pickup Weapon" }, { "Prevent Passive Mode" } }, bool: p_PlayerSettings [ MAX_PLAYERS ] [ MAX_SETTINGS char ] ; diff --git a/gamemodes/irresistible/cnr/features/vehicles/garages.pwn b/gamemodes/irresistible/cnr/features/vehicles/garages.pwn index 224911d..2440585 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/garages.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/garages.pwn @@ -210,7 +210,6 @@ CMD:garage( playerid, params[ ] ) UpdateGarageData( g ); UpdateGarageTitle( g ); GivePlayerCash( playerid, -( g_garageData[ g ] [ E_PRICE ] ) ); - autosaveStart( playerid, true ); // auto-save SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You have bought this garage for "COL_GOLD"%s"COL_WHITE".", cash_format( g_garageData[ g ] [ E_PRICE ] ) ); return 1; } diff --git a/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn b/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn index 620185a..607a18d 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn @@ -354,7 +354,6 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) new bID = CreateBuyableVehicle( playerid, model, random( 126 ), random( 126 ), X, Y, Z, fA, g_BuyableVehicleData[ data_id ] [ E_PRICE ] ); if ( bID == -1 ) return SendClientMessage( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" Unable to create a vehicle due to a unexpected error." ); GivePlayerCash( playerid, -g_BuyableVehicleData[ data_id ] [ E_PRICE ] ); - autosaveStart( playerid, true ); // auto-save GetVehicleParamsEx( g_vehicleData[ playerid ] [ bID ] [ E_VEHICLE_ID ], engine, lights, alarm, doors, bonnet, boot, objective ); SetVehicleParamsEx( g_vehicleData[ playerid ] [ bID ] [ E_VEHICLE_ID ], VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective ); diff --git a/gamemodes/irresistible/config/migrations/cnr/20190101_cnr_remove_xp_autosave.sql b/gamemodes/irresistible/config/migrations/cnr/20190101_cnr_remove_xp_autosave.sql new file mode 100644 index 0000000..d314d65 --- /dev/null +++ b/gamemodes/irresistible/config/migrations/cnr/20190101_cnr_remove_xp_autosave.sql @@ -0,0 +1,13 @@ +-- CREATE A MIGRATION ENTRY +INSERT INTO `DB_MIGRATIONS` (`MIGRATION`) VALUES ('20190101_cnr_remove_xp_autosave'); + +-- BEGIN + +-- -- REMOVE REDUNDANT COLUMN XP IN USERS +ALTER TABLE `USERS` DROP `XP`; + +-- -- REMOVE AUTO SAVE SETTING +DELETE FROM `SETTINGS` WHERE SETTING_ID = 5; + +-- -- REPLACE AUTO SAVE SETTING WITH CHAT ID SETTING +UPDATE SETTINGS SET SETTING_ID = 5 WHERE SETTING_ID = 13; \ No newline at end of file diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index aad42f5..d6222c6 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -8022,22 +8022,6 @@ stock returnCityName( city ) return string; } -stock autosaveStart( playerid, bool: force_save = false ) -{ - new - iTime = g_iTime; - - if ( IsPlayerSettingToggled( playerid, SETTING_AUTOSAVE ) && force_save == false ) - return; - - if ( GetPVarInt( playerid, "last_transaction" ) > iTime && force_save == false ) - return; - - SavePlayerData( playerid ); - SetPVarInt( playerid, "last_transaction", iTime + 15 ); - SendClientMessage( playerid, -1, IsPlayerSettingToggled( playerid, SETTING_AUTOSAVE ) ? ( ""COL_LRED"[AUTO-SAVE]"COL_WHITE" Your statistics have been saved." ) : (""COL_LRED"[AUTO-SAVE]"COL_WHITE" Your statistics have been saved, "COL_GREY"you can disable this over /cp"COL_WHITE"." ) ); -} - stock getCurrentDate( ) { static