From 4c93b2e8883a68d7c7fd99f5eef866e3c9f3a79f Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 23:12:41 +1000 Subject: [PATCH 1/7] include house name in realestate sale --- gamemodes/irresistible/cnr/features/houses/realestate.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/houses/realestate.pwn b/gamemodes/irresistible/cnr/features/houses/realestate.pwn index f614367..6ef9148 100644 --- a/gamemodes/irresistible/cnr/features/houses/realestate.pwn +++ b/gamemodes/irresistible/cnr/features/houses/realestate.pwn @@ -246,7 +246,7 @@ thread HouseListing_OnBuyHome( playerid, house_listing_id ) if ( 0 <= sellerid < MAX_PLAYERS && Iter_Contains( Player, sellerid ) ) { p_OwnedHouses[ sellerid ] --; GivePlayerIrresistibleCoins( sellerid, ask_price ); - SendServerMessage( sellerid, "You have successfully sold your house for "COL_GOLD"%s IC"COL_WHITE" to %s(%d)!", number_format( ask_price, .decimals = 2 ), ReturnPlayerName( playerid ), playerid ); + SendServerMessage( sellerid, "You have successfully sold your home (%s) for "COL_GOLD"%s IC"COL_WHITE" to %s(%d)!", g_houseData[ houseid ] [ E_HOUSE_NAME ], number_format( ask_price, .decimals = 2 ), ReturnPlayerName( playerid ), playerid ); } else { mysql_single_query( sprintf( "UPDATE `USERS` SET `COINS` = `COINS` + %f WHERE `ID` = %d", ask_price, owner_account_id ) ); } From 1c70a050e3536f5ee3fb2f5d428ae17aaafd3996 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 23:28:31 +1000 Subject: [PATCH 2/7] compile error and add back in pool --- gamemodes/irresistible/cnr/features/_features.pwn | 2 +- gamemodes/irresistible/cnr/features/houses/realestate.pwn | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/_features.pwn b/gamemodes/irresistible/cnr/features/_features.pwn index 8a09567..6ea9c75 100644 --- a/gamemodes/irresistible/cnr/features/_features.pwn +++ b/gamemodes/irresistible/cnr/features/_features.pwn @@ -33,4 +33,4 @@ // #include "irresistible\cnr\features\eastereggs.pwn" // pool -// #include "irresistible\cnr\features\pool.pwn" +#include "irresistible\cnr\features\pool.pwn" diff --git a/gamemodes/irresistible/cnr/features/houses/realestate.pwn b/gamemodes/irresistible/cnr/features/houses/realestate.pwn index 6ef9148..ee7302e 100644 --- a/gamemodes/irresistible/cnr/features/houses/realestate.pwn +++ b/gamemodes/irresistible/cnr/features/houses/realestate.pwn @@ -236,6 +236,7 @@ thread HouseListing_OnBuyHome( playerid, house_listing_id ) // credit seller if they are on/offline new + houseid = cache_get_field_content_int( 0, "HOUSE_ID" ), sellerid; foreach ( sellerid : Player ) if ( GetPlayerAccountID( sellerid ) == owner_account_id ) { @@ -251,8 +252,6 @@ thread HouseListing_OnBuyHome( playerid, house_listing_id ) mysql_single_query( sprintf( "UPDATE `USERS` SET `COINS` = `COINS` + %f WHERE `ID` = %d", ask_price, owner_account_id ) ); } - new - houseid = cache_get_field_content_int( 0, "HOUSE_ID" ); // show sellers name & house name SendServerMessage( playerid, "You have successfully bought %s's home (%s"COL_WHITE") for "COL_GOLD"%s IC"COL_WHITE"!", g_houseData[ houseid ] [ E_OWNER ], g_houseData[ houseid ] [ E_HOUSE_NAME ], number_format( ask_price, .decimals = 2 ) ); From df5038457eb984137d23843355021ae76f49b164 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 23:36:53 +1000 Subject: [PATCH 3/7] fix crowdfund SQL error --- gamemodes/irresistible/cnr/features/crowdfund.pwn | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/crowdfund.pwn b/gamemodes/irresistible/cnr/features/crowdfund.pwn index dc90c51..cda56e8 100644 --- a/gamemodes/irresistible/cnr/features/crowdfund.pwn +++ b/gamemodes/irresistible/cnr/features/crowdfund.pwn @@ -112,7 +112,7 @@ CMD:crowdfunds( playerid, params[ ] ) return ShowPlayerCrowdfunds( playerid ); /* ** Functions ** */ stock ShowPlayerCrowdfunds( playerid ) { return mysql_tquery( dbHandle, - "SELECT CROWDFUNDS.ID, CROWDFUNDS.FEATURE, CROWDFUNDS.FUND_TARGET, SUM(CROWDFUND_PATREONS.AMOUNT) AS RAISED, UNIX_TIMESTAMP(RELEASE_DATE) AS RELEASE, UNIX_TIMESTAMP(END_DATE) AS END FROM CROWDFUNDS " \ + "SELECT CROWDFUNDS.ID, CROWDFUNDS.FEATURE, CROWDFUNDS.FUND_TARGET, SUM(CROWDFUND_PATREONS.AMOUNT) AS RAISED, UNIX_TIMESTAMP(RELEASE_DATE) AS RELEASE_TS, UNIX_TIMESTAMP(END_DATE) AS END_TS FROM CROWDFUNDS " \ "LEFT JOIN CROWDFUND_PATREONS on CROWDFUNDS.ID = CROWDFUND_PATREONS.CROWDFUND_ID " \ "GROUP BY CROWDFUNDS.ID ORDER BY CROWDFUNDS.ID DESC LIMIT " # MAX_CROWDFUNDS, "OnDisplayCrowdfunds", "i", playerid @@ -230,9 +230,7 @@ thread OnDisplayCrowdfundInfo( playerid, crowdfund_id ) thread OnDisplayCrowdfunds( playerid ) { new - rows; - - cache_get_data( rows, tmpVariable ); + rows = cache_get_row_count( ); if ( ! rows ) { return SendError( playerid, "There is no crowdfund to show. Try again later." ); @@ -259,8 +257,8 @@ thread OnDisplayCrowdfunds( playerid ) new Float: percent_raised = ( amount_raised / target_amount ) * 100.0; new curr_timestamp = gettime( ); - new release_timestamp = cache_get_field_content_int( row, "RELEASE", dbHandle ); - new end_timestamp = cache_get_field_content_int( row, "END", dbHandle ); + new release_timestamp = cache_get_field_content_int( row, "RELEASE_TS", dbHandle ); + new end_timestamp = cache_get_field_content_int( row, "END_TS", dbHandle ); // inactive if ( ( curr_timestamp > release_timestamp && release_timestamp != 0 ) || ( curr_timestamp > end_timestamp ) ) From c535ca1796c58c1eba730e1384023cc11ac31700 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 23:46:30 +1000 Subject: [PATCH 4/7] fix potential sql injection vulernability :O --- gamemodes/irresistible/cnr/features/houses/house.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/houses/house.pwn b/gamemodes/irresistible/cnr/features/houses/house.pwn index ea28f62..cec64c5 100644 --- a/gamemodes/irresistible/cnr/features/houses/house.pwn +++ b/gamemodes/irresistible/cnr/features/houses/house.pwn @@ -320,7 +320,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) new houseid = p_InHouse[ playerid ]; format( g_houseData[ houseid ] [ E_HOUSE_NAME ], 30, "%s", inputtext); - mysql_format( dbHandle, szNormalString, sizeof( szNormalString ), "UPDATE `HOUSES` SET `NAME`='%s' WHERE `ID`=%d", g_houseData[ houseid ] [ E_HOUSE_NAME ], p_InHouse[ playerid ] ); + mysql_format( dbHandle, szNormalString, sizeof( szNormalString ), "UPDATE `HOUSES` SET `NAME`='%e' WHERE `ID`=%d", g_houseData[ houseid ] [ E_HOUSE_NAME ], p_InHouse[ playerid ] ); mysql_single_query( szNormalString ); format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ houseid ] [ E_HOUSE_NAME ], houseid, g_houseData[ houseid ] [ E_OWNER ], cash_format( g_houseData[ houseid ] [ E_COST ] ) ); UpdateDynamic3DTextLabelText( g_houseData[ houseid ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString ); From 3d54f3f266d141da8294301583c57f285d3d44c8 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 23:50:01 +1000 Subject: [PATCH 5/7] random msg for stephanie and estate --- gamemodes/irresistible/cnr/features/random_messages.pwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/random_messages.pwn b/gamemodes/irresistible/cnr/features/random_messages.pwn index 4e499cc..21c37fe 100644 --- a/gamemodes/irresistible/cnr/features/random_messages.pwn +++ b/gamemodes/irresistible/cnr/features/random_messages.pwn @@ -68,7 +68,8 @@ static stock { "{8ADE47}Stephanie:"COL_WHITE" Race your friends in a street race or outrun race by using "COL_GREY"/race"COL_WHITE"!" }, { "{8ADE47}Stephanie:"COL_WHITE" Want 3 days of free V.I.P? Add an "COL_GREY"/email"COL_WHITE" to your account!" }, { "{8ADE47}Stephanie:"COL_WHITE" Contribute to our feature "COL_GREY"/crowdfunds"COL_WHITE"! Early supporters get benefits!" }, - { "{8ADE47}Stephanie:"COL_WHITE" Don't want to be interrupted as an innocent player? Enter passive mode with "COL_GREY"/passive"COL_WHITE"!" } + { "{8ADE47}Stephanie:"COL_WHITE" Don't want to be interrupted as an innocent player? Enter passive mode with "COL_GREY"/passive"COL_WHITE"!" }, + { "{8ADE47}Stephanie:"COL_WHITE" You can buy premium player homes using "COL_GREY"/estate"COL_WHITE"!" } }, g_randomMessageTick = 0 ; From bd597eb945ecb7f919f2bf73f9fcd49e34f62045 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 23:54:59 +1000 Subject: [PATCH 6/7] remove pool function placeholder --- gamemodes/sf-cnr.pwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index e976c38..7ac9af7 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -53,7 +53,7 @@ native gpci ( playerid, serial[ ], len ); new bool: False = false; -#define IsPlayerPlayingPool(%0) (False) +// #define IsPlayerPlayingPool(%0) (False) /* ** SF-CNR ** */ #include "irresistible\_main.pwn" @@ -18008,7 +18008,7 @@ stock GivePlayerWantedLevel( playerid, wantedlevel, bool:loadingstats = false ) format( szWanted, sizeof( szWanted ), "] %d ]", p_WantedLevel[ playerid ] ); PlayerTextDrawSetString( playerid, p_WantedLevelTD[ playerid ], szWanted ); if ( ! p_inMovieMode{ playerid } ) PlayerTextDrawShow( playerid, p_WantedLevelTD[ playerid ] ); - PassiveMode_Reset( playerid, 0 ); // remove passive mode if the player is wanted + ResetPlayerPassiveMode( playerid, .passive_disabled = true ); // remove passive mode if the player is wanted } } else SetPlayerColorToTeam( playerid ), PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] ), Uncuff( playerid ); From cdfe84671d8be6d39f6e060b63633b9937d294ee Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 26 Sep 2018 00:23:25 +1000 Subject: [PATCH 7/7] allow players over the vip limit to utilize their houses/vehicles --- gamemodes/irresistible/cnr/features/houses/house.pwn | 2 ++ gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn | 2 ++ gamemodes/irresistible/cnr/vip.pwn | 2 ++ gamemodes/sf-cnr.pwn | 2 ++ 4 files changed, 8 insertions(+) diff --git a/gamemodes/irresistible/cnr/features/houses/house.pwn b/gamemodes/irresistible/cnr/features/houses/house.pwn index cec64c5..806e662 100644 --- a/gamemodes/irresistible/cnr/features/houses/house.pwn +++ b/gamemodes/irresistible/cnr/features/houses/house.pwn @@ -392,10 +392,12 @@ CMD:h( playerid, params[ ] ) if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ); +#if VIP_ALLOW_OVER_LIMIT == false if ( ! p_VIPLevel[ playerid ] && p_OwnedHouses[ playerid ] > GetPlayerHouseSlots( playerid ) && ! strmatch( params, "sell" ) ) { ResetSpawnLocation( playerid ); return SendError( playerid, "Please renew your V.I.P or sell this home to match your house allocated limit (/h sell)." ); } +#endif new ID = p_InHouse[ playerid ]; diff --git a/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn b/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn index 7c7030c..b2416bb 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn @@ -245,6 +245,7 @@ CMD:v( playerid, params[ ] ) if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED ) return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ); +#if VIP_ALLOW_OVER_LIMIT == false // force hoarders to sell if ( ! p_VIPLevel[ playerid ] && p_OwnedVehicles[ playerid ] > GetPlayerVehicleSlots( playerid ) && ! strmatch( params, "sell" ) && ! strmatch( params, "bring" ) ) { for( new i = 0; i < p_OwnedVehicles[ playerid ]; i++ ) if ( g_vehicleData[ playerid ] [ i ] [ E_OWNER_ID ] == p_AccountID[ playerid ] ) { @@ -252,6 +253,7 @@ CMD:v( playerid, params[ ] ) } return SendError( playerid, "Please renew your V.I.P or sell this vehicle to match your vehicle allocated limit. (/v sell/bring only)" ); } +#endif new vehicleid = GetPlayerVehicleID( playerid ), diff --git a/gamemodes/irresistible/cnr/vip.pwn b/gamemodes/irresistible/cnr/vip.pwn index ee0c38c..546e350 100644 --- a/gamemodes/irresistible/cnr/vip.pwn +++ b/gamemodes/irresistible/cnr/vip.pwn @@ -39,6 +39,8 @@ #define ICM_NAME ( 7 ) #define ICM_VEH_SLOT ( 8 ) +#define VIP_ALLOW_OVER_LIMIT ( true ) + /* ** Variables ** */ enum E_IC_MARKET_DATA { diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 7ac9af7..d1cd45c 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -14124,10 +14124,12 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( ! response ) return ShowPlayerSpawnMenu( playerid ); + #if VIP_ALLOW_OVER_LIMIT == false if ( ! p_VIPLevel[ playerid ] && p_OwnedHouses[ playerid ] > GetPlayerHouseSlots( playerid ) ) { ResetSpawnLocation( playerid ); return SendError( playerid, "Please renew your V.I.P or sell this home to match your house allocated limit (/h sell)." ); } + #endif new x = 0;