diff --git a/gamemodes/irresistible/cnr/features/houses/furniture.pwn b/gamemodes/irresistible/cnr/features/houses/furniture.pwn index 3f87b28..c769ae6 100644 --- a/gamemodes/irresistible/cnr/features/houses/furniture.pwn +++ b/gamemodes/irresistible/cnr/features/houses/furniture.pwn @@ -1,8 +1,8 @@ /* * Irresistible Gaming (c) 2018 * Developed by Lorenc Pekaj - * Module: - * Purpose: + * Module: cnr\features\houses\furniture.pwn + * Purpose: furniture module for homes */ /* ** Includes ** */ @@ -463,7 +463,11 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( !IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); - new vip_slots = 20 + ( p_VIPLevel[ playerid ] * 10 ); + new vip_slots = 25 + ( GetPlayerVIPLevel( playerid ) * 5 ); + + if ( vip_slots > MAX_FURNITURE ) + vip_slots = MAX_FURNITURE; // just to be sure + new total_furniture = Iter_Count( housefurniture[ houseid ] ); if ( total_furniture > vip_slots ) diff --git a/gamemodes/irresistible/cnr/features/houses/realestate.pwn b/gamemodes/irresistible/cnr/features/houses/realestate.pwn index 3ba5d52..d79586d 100644 --- a/gamemodes/irresistible/cnr/features/houses/realestate.pwn +++ b/gamemodes/irresistible/cnr/features/houses/realestate.pwn @@ -126,7 +126,7 @@ CMD:estate( playerid, params[ ] ) else if ( ! IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this home." ); else if ( coins < 25.0 ) return SendError( playerid, "Please specify an ask price greater than 25.00 IC." ); else if ( coins > 25000.0 ) return SendError( playerid, "Please specify an ask price less than 25,000 IC." ); - else if ( GetPlayerCash( playerid ) < HOUSE_LISTING_FEE && GetPlayerVIPLevel( playerid ) < VIP_GOLD ) return SendError( playerid, "You need at least %s to create a house listing.", cash_format( HOUSE_LISTING_FEE ) ); + else if ( GetPlayerCash( playerid ) < HOUSE_LISTING_FEE && GetPlayerVIPLevel( playerid ) < VIP_PLATINUM ) return SendError( playerid, "You need at least %s to create a house listing.", cash_format( HOUSE_LISTING_FEE ) ); else { mysql_tquery( dbHandle, sprintf( "SELECT * FROM `HOUSE_LISTINGS` WHERE `HOUSE_ID` = %d AND `SALE_DATE` IS NULL", houseid ), "HouseListing_OnCreateListing", "ddf", playerid, houseid, coins ); @@ -135,7 +135,7 @@ CMD:estate( playerid, params[ ] ) } else { - SendServerMessage( playerid, "You can list your own home using "COL_GREY"/estate list"COL_WHITE" for %s.", p_VIPLevel[ playerid ] < VIP_GOLD ? ( cash_format( HOUSE_LISTING_FEE ) ) : ( "FREE" ) ); + SendServerMessage( playerid, "You can list your own home using "COL_GREY"/estate list"COL_WHITE" for %s.", p_VIPLevel[ playerid ] < VIP_PLATINUM ? ( cash_format( HOUSE_LISTING_FEE ) ) : ( "FREE" ) ); return ShowPlayerHomeListings( playerid ); } } @@ -308,7 +308,7 @@ thread HouseListing_OnCreateListing( playerid, houseid, Float: ask_price ) if ( ! rows ) { // debit user account - if ( GetPlayerVIPLevel( playerid ) < VIP_GOLD ) { + if ( GetPlayerVIPLevel( playerid ) < VIP_PLATINUM ) { GivePlayerCash( playerid, -HOUSE_LISTING_FEE ); } diff --git a/gamemodes/irresistible/cnr/jobs.pwn b/gamemodes/irresistible/cnr/jobs.pwn index e304c04..9800001 100644 --- a/gamemodes/irresistible/cnr/jobs.pwn +++ b/gamemodes/irresistible/cnr/jobs.pwn @@ -27,7 +27,7 @@ /* ** Functions ** */ stock IsPlayerJob( playerid, jobid ) { - return ( p_Job{ playerid } == jobid ) || ( p_VIPLevel[ playerid ] >= VIP_GOLD && p_VIPJob{ playerid } == jobid ); + return ( p_Job{ playerid } == jobid ) || ( p_VIPLevel[ playerid ] >= VIP_DIAMOND && p_VIPJob{ playerid } == jobid ); } stock GetJobIDFromName( szJob[ ] ) diff --git a/gamemodes/irresistible/cnr/vip/vip.pwn b/gamemodes/irresistible/cnr/vip/vip.pwn index 2325e8b..785569a 100644 --- a/gamemodes/irresistible/cnr/vip/vip.pwn +++ b/gamemodes/irresistible/cnr/vip/vip.pwn @@ -21,7 +21,7 @@ #define ICM_PAGE_DEFAULT ( 0 ) #define ICM_PAGE_CASHCARD ( 1 ) #define ICM_PAGE_ASSETS ( 2 ) -#define ICM_PAGE_UPGRADE ( 3 ) +//#define ICM_PAGE_UPGRADE ( 3 ) #define VIP_REGULAR ( 1 ) #define VIP_BRONZE ( 2 ) @@ -51,8 +51,10 @@ enum E_IC_MARKET_DATA new g_irresistibleVipItems [ ] [ E_IC_MARKET_DATA ] = { - { VIP_GOLD, "Gold V.I.P", 1800.0 }, - { VIP_BRONZE, "Bronze V.I.P", 1000.0 }, + { VIP_DIAMOND, "Diamond V.I.P", 10000.0 }, + { VIP_PLATINUM, "Platinum V.I.P", 5000.0 }, + { VIP_GOLD, "Gold V.I.P", 2500.0 }, + { VIP_BRONZE, "Bronze V.I.P", 1500.0 }, { VIP_REGULAR, "Regular V.I.P", 500.0 } }, g_irresistibleCashCards [ ] [ E_IC_MARKET_DATA ] = @@ -70,8 +72,8 @@ new { ICM_COKE_BIZ, "Coke Business", 1500.0 }, { ICM_METH_BIZ, "Meth Business", 700.0 }, { ICM_WEED_BIZ, "Weed Business", 500.0 }, - { ICM_VEHICLE, "Select Vehicle", 450.0 }, - { ICM_HOUSE, "Select House", 400.0 }, + { ICM_VEHICLE, "Select Vehicle", 500.0 }, + { ICM_HOUSE, "Select House", 500.0 }, { ICM_GATE, "Custom Gate", 350.0 }, { ICM_VEH_SLOT, "Extra Vehicle Slot", 350.0 }, { ICM_GARAGE, "Select Garage", 250.0 }, @@ -85,58 +87,25 @@ new ; -/* ** Forwards ** */ -forward Float: GetPlayerUpgradeVIPCost( playerid, Float: days_left = 30.0 ); - /* ** Hooks ** */ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { if ( dialogid == DIALOG_IC_MARKET && response ) { - new current_vip = GetPlayerVIPLevel( playerid ); - new Float: days_left = float( GetPlayerVIPDuration( playerid ) ) / 86400.0; + //new current_vip = GetPlayerVIPLevel( playerid ); - if ( listitem == sizeof( g_irresistibleVipItems ) ) - { - new - Float: upgrade_cost = floatround( GetPlayerUpgradeVIPCost( playerid, days_left ), floatround_ceil ); - - if ( current_vip >= VIP_REGULAR && current_vip < VIP_GOLD && days_left >= 7.0 && upgrade_cost ) - { - p_CoinMarketPage{ playerid } = ICM_PAGE_UPGRADE; - return ShowPlayerDialog( playerid, DIALOG_YOU_SURE_VIP, DIALOG_STYLE_MSGBOX, ""COL_GOLD"Irresistible Coin -{FFFFFF} Confirmation", sprintf( ""COL_WHITE"Are you sure that you want to spend %s IC?", number_format( upgrade_cost, .decimals = 2 ) ), "Yes", "No" ); - } - else - { - SendError( playerid, "Upgrading your V.I.P is currently unavailable." ); - return ShowPlayerCoinMarketDialog( playerid ); - } - } - else if ( listitem == sizeof( g_irresistibleVipItems ) + 1 ) { + if ( listitem == sizeof( g_irresistibleVipItems ) ) { return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_CASHCARD ); } - else if ( listitem == sizeof( g_irresistibleVipItems ) + 2 ) { + else if ( listitem == sizeof( g_irresistibleVipItems ) + 1 ) { return ShowPlayerHomeListings( playerid ); } - else if ( listitem > sizeof( g_irresistibleVipItems ) + 2 ) { + else if ( listitem > sizeof( g_irresistibleVipItems ) + 1 ) { return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS ); } else { new Float: iCoinRequirement = g_irresistibleVipItems[ listitem ] [ E_PRICE ] * GetGVarFloat( "vip_discount" ); - new selected_vip = g_irresistibleVipItems[ listitem ] [ E_ID ]; - - if ( current_vip > VIP_GOLD ) { - current_vip = VIP_GOLD; - } - - if ( current_vip != 0 && current_vip != selected_vip ) { - if ( current_vip > selected_vip ) { - SendError( playerid, "You must wait until your V.I.P is expired in order to downgrade it." ); - } else { - SendError( playerid, "You must upgrade your current V.I.P level first." ); - } - return ShowPlayerCoinMarketDialog( playerid ); - } + //new selected_vip = g_irresistibleVipItems[ listitem ] [ E_ID ]; p_CoinMarketPage{ playerid } = ICM_PAGE_DEFAULT; p_CoinMarketSelectedItem{ playerid } = listitem; @@ -168,66 +137,17 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( !response ) return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } ); - new current_vip = GetPlayerVIPLevel( playerid ); new Float: player_coins = GetPlayerIrresistibleCoins( playerid ); - new Float: days_left = float( GetPlayerVIPDuration( playerid ) ) / 86400.0; // restore listitem of whatever player selected listitem = p_CoinMarketSelectedItem{ playerid }; - // upgrade player vip - if ( p_CoinMarketPage{ playerid } == ICM_PAGE_UPGRADE ) - { - if ( current_vip >= VIP_REGULAR && current_vip < VIP_GOLD && days_left >= 7.0 ) - { - new Float: upgrade_cost = floatround( GetPlayerUpgradeVIPCost( playerid, days_left ), floatround_ceil ); - new new_vip_item = ( current_vip == VIP_BRONZE ? 0 : 1 ); - - if ( player_coins < upgrade_cost ) { - SendError( playerid, "You need around %s coins before you can upgrade your V.I.P!", number_format( upgrade_cost - player_coins, .decimals = 2 ) ); - return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } ); - } - - // if it's zero then the player is not regular/bronze - if ( upgrade_cost ) - { - // set level no interval, deduct and notify - SetPlayerVipLevel( playerid, g_irresistibleVipItems[ new_vip_item ] [ E_ID ], .interval = 0 ); - GivePlayerIrresistibleCoins( playerid, -upgrade_cost ); - SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[VIP PACKAGE]"COL_WHITE" You have upgraded to %s for %s Irresistible Coins!", g_irresistibleVipItems[ new_vip_item ] [ E_NAME ], number_format( upgrade_cost, .decimals = 0 ) ); - } - else - { - SendError( playerid, "There seemed to be an error while upgrading your V.I.P, please contact Lorenc." ); - } - return 1; - } - else - { - SendError( playerid, "Upgrading your V.I.P is currently unavailable." ); - return ShowPlayerCoinMarketDialog( playerid ); - } - } - // default page - else if ( p_CoinMarketPage{ playerid } == ICM_PAGE_DEFAULT ) + if ( p_CoinMarketPage{ playerid } == ICM_PAGE_DEFAULT ) { new Float: iCoinRequirement = g_irresistibleVipItems[ listitem ] [ E_PRICE ] * GetGVarFloat( "vip_discount" ); new selected_vip = g_irresistibleVipItems[ listitem ] [ E_ID ]; - if ( current_vip > VIP_GOLD ) { - current_vip = VIP_GOLD; - } - - if ( current_vip != 0 && current_vip != selected_vip ) { - if ( current_vip > selected_vip ) { - SendError( playerid, "You must wait until your V.I.P is expired in order to downgrade it." ); - } else { - SendError( playerid, "You must upgrade your current V.I.P level first." ); - } - return ShowPlayerCoinMarketDialog( playerid ); - } - if ( player_coins < iCoinRequirement ) { SendError( playerid, "You need around %s coins before you can get this V.I.P!", number_format( iCoinRequirement - player_coins, .decimals = 2 ) ); return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } ); @@ -243,7 +163,18 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[VIP PACKAGE]"COL_WHITE" You have redeemed %s V.I.P for %s Irresistible Coins! Congratulations! :D", VIPToString( selected_vip ), number_format( iCoinRequirement, .decimals = 0 ) ); // Redirect player - ShowPlayerVipRedeemedDialog( playerid ); + if ( selected_vip == VIP_DIAMOND ) + { + ShowPlayerDialog( playerid, DIALOG_DONATED_DIAGOLD, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Diamond V.I.P, you have the option of gifting Gold VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); + } + else if ( selected_vip == VIP_PLATINUM ) + { + ShowPlayerDialog( playerid, DIALOG_DONATED_PLATBRONZE, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Platinum V.I.P, you have the option of gifting Bronze VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); + } + else + { + ShowPlayerVipRedeemedDialog( playerid ); + } return 1; } @@ -383,6 +314,68 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { return ShowPlayerCoinMarketDialog( playerid ); } + else if ( dialogid == DIALOG_DONATED_PLATBRONZE ) + { + if ( response ) + { + new + pID; + + if ( sscanf( inputtext, "u", pID ) ) + { + SendError( playerid, "Please enter a player's ID or name." ); + ShowPlayerDialog( playerid, DIALOG_DONATED_PLATBRONZE, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Platinum V.I.P, you have the option of gifting Bronze VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); + } + else if ( !IsPlayerConnected( pID ) ) + { + SendError( playerid, "This player is not connected." ); + ShowPlayerDialog( playerid, DIALOG_DONATED_PLATBRONZE, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Platinum V.I.P, you have the option of gifting Bronze VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); + } + else + { + SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[V.I.P]"COL_WHITE" You have gifted Bronze V.I.P to %s(%d)!", ReturnPlayerName( pID ), pID ); + SetPlayerVipLevel( pID, VIP_BRONZE ); + ShowPlayerVipRedeemedDialog( playerid ); + } + } + else + { + AddPlayerNote( playerid, -1, "{CD7F32}Bronze V.I.P" #COL_WHITE ); + SendServerMessage( playerid, "This has been noted down for your account and will be given to you at a stage that you want, contact an executive." ); + ShowPlayerVipRedeemedDialog( playerid ); + } + } + else if ( dialogid == DIALOG_DONATED_DIAGOLD ) + { + if ( response ) + { + new + pID; + + if ( sscanf( inputtext, "u", pID ) ) + { + SendError( playerid, "Please enter a player's ID or name." ); + ShowPlayerDialog( playerid, DIALOG_DONATED_DIAGOLD, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Diamond V.I.P, you have the option of gifting Gold VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); + } + else if ( !IsPlayerConnected( pID ) ) + { + SendError( playerid, "This player is not connected." ); + ShowPlayerDialog( playerid, DIALOG_DONATED_DIAGOLD, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Diamond V.I.P, you have the option of gifting Gold VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); + } + else + { + SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[V.I.P]"COL_WHITE" You have gifted Gold V.I.P to %s(%d)!", ReturnPlayerName( pID ), pID ); + SetPlayerVipLevel( pID, VIP_GOLD ); + ShowPlayerVipRedeemedDialog( playerid ); + } + } + else + { + AddPlayerNote( playerid, -1, ""COL_GOLD"Gold V.I.P" #COL_WHITE ); + SendServerMessage( playerid, "This has been noted down for your account and will be given to you at a stage that you want, contact an executive." ); + ShowPlayerVipRedeemedDialog( playerid ); + } + } return 1; } @@ -437,35 +430,20 @@ stock ShowPlayerCoinMarketDialog( playerid, page = ICM_PAGE_DEFAULT ) new Float: discount = GetGVarFloat( "vip_discount" ); new szMarket[ 512 ] = ""COL_GREY"Item Name\t"COL_GREY"Coins Needed\n"; - if ( page == ICM_PAGE_DEFAULT || page == ICM_PAGE_UPGRADE ) + if ( page == ICM_PAGE_DEFAULT ) { - new current_vip = GetPlayerVIPLevel( playerid ); - new Float: days_left = float( GetPlayerVIPDuration( playerid ) ) / 86400.0; - - if ( current_vip > VIP_GOLD ) { - current_vip = VIP_GOLD; - } + //new current_vip = GetPlayerVIPLevel( playerid ); for( new i = 0; i < sizeof( g_irresistibleVipItems ); i++ ) { new Float: iCoinRequirement = g_irresistibleVipItems[ i ] [ E_PRICE ] * discount; - if ( current_vip != 0 && current_vip != g_irresistibleVipItems[ i ] [ E_ID ] ) { + /*if ( current_vip != 0 && current_vip != g_irresistibleVipItems[ i ] [ E_ID ] ) { format( szMarket, sizeof( szMarket ), "%s{333333}%s\t{333333}%s\n", szMarket, g_irresistibleVipItems[ i ] [ E_NAME ], number_format( iCoinRequirement, .decimals = 0 ) ); - } else { - format( szMarket, sizeof( szMarket ), "%s%s\t"COL_GOLD"%s\n", szMarket, g_irresistibleVipItems[ i ] [ E_NAME ], number_format( iCoinRequirement, .decimals = 0 ) ); - } - } + } else { }*/ - // upgrade vip - new - Float: upgrade_cost = floatround( GetPlayerUpgradeVIPCost( playerid, days_left ), floatround_ceil ); - - if ( current_vip >= VIP_REGULAR && current_vip < VIP_GOLD && days_left >= 7.0 && upgrade_cost ) - { - format( szMarket, sizeof( szMarket ), "%sUpgrade V.I.P\t"COL_GOLD"%s\n", szMarket, number_format( upgrade_cost, .decimals = 0 ) ); + format( szMarket, sizeof( szMarket ), "%s%s\t"COL_GOLD"%s\n", szMarket, g_irresistibleVipItems[ i ] [ E_NAME ], number_format( iCoinRequirement, .decimals = 0 ) ); } - else strcat( szMarket, "{333333}Upgrade V.I.P\t{333333}Unavailable\n" ); // thats it strcat( szMarket, ""COL_GREEN"Buy shark cards...\t"COL_GREEN">>>\n" ); @@ -502,11 +480,17 @@ stock GetPlayerHouseSlots( playerid ) switch( vip_level ) { - case VIP_GOLD, VIP_PLATINUM, VIP_DIAMOND: - slots = 255; // 99 infinite + case VIP_DIAMOND: + slots = 255; // infinite + + case VIP_PLATINUM: + slots = 10; + + case VIP_GOLD: + slots = 8; case VIP_BRONZE: - slots = 10; + slots = 6; case VIP_REGULAR: slots = 5; @@ -520,21 +504,17 @@ stock GetPlayerGarageSlots( playerid ) return GetPlayerHouseSlots( playerid ); stock GetPlayerVehicleSlots( playerid ) { static const - slots[ 4 ] = { 3, 5, 10, 20 }; + slots[ 5 ] = { 3, 6, 8, 10, 20 }; - new vip_level = GetPlayerVIPLevel( playerid ); - - return slots[ ( vip_level > VIP_GOLD ? VIP_GOLD : vip_level ) ] + p_ExtraAssetSlots{ playerid }; + return slots[ GetPlayerVIPLevel( playerid ) ] + p_ExtraAssetSlots{ playerid }; } stock GetPlayerPimpVehicleSlots( playerid ) { static const - slots[ 4 ] = { 3, 4, 6, 10 }; + slots[ 5 ] = { 2, 4, 6, 8, 10 }; - new vip_level = GetPlayerVIPLevel( playerid ); - - return slots[ ( vip_level > VIP_GOLD ? VIP_GOLD : vip_level ) ]; + return slots[ GetPlayerVIPLevel( playerid ) ]; } stock VIPToString( viplvl ) @@ -544,8 +524,8 @@ stock VIPToString( viplvl ) switch( viplvl ) { - case VIP_DIAMOND: string = "Legacy Diamond"; - case VIP_PLATINUM: string = "Legacy Platinum"; + case VIP_DIAMOND: string = "Diamond"; + case VIP_PLATINUM: string = "Platinum"; case VIP_GOLD: string = "Gold"; case VIP_BRONZE: string = "Bronze"; case VIP_REGULAR: string = "Regular"; @@ -571,22 +551,64 @@ stock VIPToColor( viplvl ) return string; } -stock Float: GetPlayerUpgradeVIPCost( playerid, Float: days_left = 30.0 ) +stock SetPlayerVipLevel( playerid, level, interval = 2592000 ) { - new - current_vip = GetPlayerVIPLevel( playerid ); + if ( ! IsPlayerConnected( playerid ) ) + return; - if ( current_vip != VIP_BRONZE && current_vip != VIP_REGULAR ) - return 0.0; - - new - Float: total_cost = 0.0; - - switch ( current_vip ) - { - case VIP_BRONZE: total_cost = g_irresistibleVipItems[ 0 ] [ E_PRICE ] - g_irresistibleVipItems[ 1 ] [ E_PRICE ]; - case VIP_REGULAR: total_cost = g_irresistibleVipItems[ 1 ] [ E_PRICE ] - g_irresistibleVipItems[ 2 ] [ E_PRICE ]; + // force upgrade + if ( p_VIPLevel[ playerid ] < level ) { + p_VIPLevel[ playerid ] = level; } - return total_cost * GetGVarFloat( "vip_discount" ) * ( days_left / 30.0 ); + // check if player already has vip + if ( level ) { + if ( p_VIPExpiretime[ playerid ] > g_iTime ) p_VIPExpiretime[ playerid ] += interval; + else p_VIPExpiretime[ playerid ] += ( g_iTime + interval ); + } + + // expire the players vip if level 0 + else { + p_VIPExpiretime[ playerid ] = 0; + } + + // give player appropriate notes/items + switch ( level ) + { + case VIP_REGULAR: + { + GivePlayerCash( playerid, 500000 ); + } + case VIP_BRONZE: + { + GivePlayerCash( playerid, 2500000 ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P House (Bronze)" ); + SendClientMessageToAdmins( -1, ""COL_PINK"[VIP NOTE]"COL_GREY" %s(%d) needs a House. (/viewnotes)", ReturnPlayerName( playerid ), playerid ); + } + case VIP_GOLD: + { + GivePlayerCash( playerid, 5000000 ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P House (Gold)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Vehicle (Gold)" ); + SendClientMessageToAdmins( -1, ""COL_PINK"[VIP NOTE]"COL_GREY" %s(%d) needs a House and Vehicle. (/viewnotes)", ReturnPlayerName( playerid ), playerid ); + } + case VIP_PLATINUM: + { + GivePlayerCash( playerid, 12500000 ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P House (Platinum)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Vehicle (Platinum)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Garage" ); + SendClientMessageToAdmins( -1, ""COL_PINK"[VIP NOTE]"COL_GREY" %s(%d) needs a House, Vehicle and Garage. (/viewnotes)", ReturnPlayerName( playerid ), playerid ); + } + case VIP_DIAMOND: + { + GivePlayerCash( playerid, 25000000 ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P House (Diamond)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Vehicle (Diamond)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Garage (Diamond)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Gate (Diamond)" ); + AddPlayerNote( playerid, 1, COL_GOLD # "V.I.P Weed Business (Diamond)" ); + SendClientMessageToAdmins( -1, ""COL_PINK"[VIP NOTE]"COL_GREY" %s(%d) needs a House, Vehicle, Garage, Gate and Weed Biz. (/viewnotes)", ReturnPlayerName( playerid ), playerid ); + } + } } diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index ceb7006..e5fc6b0 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -414,24 +414,24 @@ public OnGameModeInit() mysql_function_query( dbHandle, "DELETE a2,a3 FROM `USERS` a1 " \ "LEFT JOIN `FURNITURE` a2 on a1.`ID` = a2.`OWNER` "\ "LEFT JOIN `APARTMENTS` a3 on a1.`NAME` = a3.`OWNER` "\ - "WHERE UNIX_TIMESTAMP()-a1.`LASTLOGGED` > IF(a1.`VIP_PACKAGE` >= 3, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 3 ); + "WHERE UNIX_TIMESTAMP()-a1.`LASTLOGGED` > IF(a1.`VIP_PACKAGE` >= 5, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 3 ); mysql_function_query( dbHandle, "UPDATE `USERS` a1 JOIN `HOUSES` a2 ON a1.`NAME` = a2.`OWNER` "\ "SET a2.`NAME`='Home', a2.`OWNER`='No-one', a2.`TX`=" #H_DEFAULT_X ", a2.`TY`=" #H_DEFAULT_Y ", a2.`TZ`=" #H_DEFAULT_Z ", a2.`INTERIOR`=2, a2.`PASSWORD`='N/A', a2.`WEAPONS`='0.0.0.0.0.0.0.', a2.`AMMO`='-1.-1.-1.-1.-1.-1.-1.' "\ - "WHERE UNIX_TIMESTAMP()-a1.`LASTLOGGED` > IF(a1.`VIP_PACKAGE` >= 3, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 4 ); + "WHERE UNIX_TIMESTAMP()-a1.`LASTLOGGED` > IF(a1.`VIP_PACKAGE` >= 5, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 4 ); // Truncate banned players after 2 weeks mysql_function_query( dbHandle, "UPDATE `USERS` a1 JOIN `BANS` a2 ON a1.`NAME` = a2.`NAME` "\ "SET a1.`BANKMONEY`=0, a1.`CASH`=0 "\ - "WHERE UNIX_TIMESTAMP()-a1.`LASTLOGGED` > IF(a1.`VIP_PACKAGE` >= 3, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 5 ); + "WHERE UNIX_TIMESTAMP()-a1.`LASTLOGGED` > IF(a1.`VIP_PACKAGE` >= 5, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 5 ); // Update vehicles with inactive garages. mysql_function_query( dbHandle, "UPDATE `VEHICLES` v JOIN `GARAGES` g ON g.`ID` = v.`GARAGE` JOIN `USERS` u ON u.`ID` = v.`OWNER` "\ "SET v.`X`=g.`X`, v.`Y`=g.`Y`, v.`Z`=g.`Z`, v.`GARAGE`=-1 "\ - "WHERE v.`GARAGE` != -1 AND UNIX_TIMESTAMP()-u.`LASTLOGGED` > IF(u.`VIP_PACKAGE` >= 3, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 6 ); + "WHERE v.`GARAGE` != -1 AND UNIX_TIMESTAMP()-u.`LASTLOGGED` > IF(u.`VIP_PACKAGE` >= 5, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 6 ); // mysql_function_query( dbHandle, "UPDATE `GARAGES` g JOIN `USERS` u ON u.`ID` = g.`OWNER` SET g.`OWNER`=0, g.`INTERIOR`=0 WHERE UNIX_TIMESTAMP()-u.`LASTLOGGED` > 1209600;", true, "onRemoveInactiveRows", "d", 6 ); - mysql_function_query( dbHandle, "DELETE g FROM `GARAGES` g JOIN `USERS` u ON u.`ID` = g.`OWNER` WHERE UNIX_TIMESTAMP()-u.`LASTLOGGED` > IF(u.`VIP_PACKAGE` >= 3, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 7 ); + mysql_function_query( dbHandle, "DELETE g FROM `GARAGES` g JOIN `USERS` u ON u.`ID` = g.`OWNER` WHERE UNIX_TIMESTAMP()-u.`LASTLOGGED` > IF(u.`VIP_PACKAGE` >= 5, 2592000, 1209600)", true, "onRemoveInactiveRows", "d", 7 ); // Remove 25% of wealth off 2 weeks inactive players. // mysql_function_query( dbHandle, "UPDATE `USERS` SET `CASH`=`CASH`*0.75,`BANKMONEY`=`BANKMONEY`*0.75 WHERE UNIX_TIMESTAMP()-`LASTLOGGED`>1209600", true, "onRemoveInactiveRows", "d", 8 ); @@ -1134,10 +1134,10 @@ public ZoneTimer( ) Float: iCoinGenRate = 35.0; // VIP check - if ( p_VIPLevel[ playerid ] >= VIP_GOLD ) + if ( p_VIPLevel[ playerid ] >= VIP_DIAMOND ) iCoinGenRate *= 0.75; // Reduce by 25% if Diamond - else if ( p_VIPLevel[ playerid ] == VIP_BRONZE ) + else if ( p_VIPLevel[ playerid ] == VIP_PLATINUM ) iCoinGenRate *= 0.90; // Reduce by 10% if Diamond // Happy Hour @@ -1927,9 +1927,9 @@ public OnPlayerSpawn( playerid ) SetPlayerVirtualWorld( playerid, 0 ); if ( p_VIPLevel[ playerid ] >= VIP_REGULAR && p_VIPWep1{ playerid } != 0 ) GivePlayerWeapon( playerid, p_VIPWep1{ playerid }, 200 ); - if ( p_VIPLevel[ playerid ] >= VIP_BRONZE && p_VIPWep2{ playerid } != 0 ) GivePlayerWeapon( playerid, p_VIPWep2{ playerid }, 200 ); - if ( p_VIPLevel[ playerid ] >= VIP_GOLD && p_VIPWep3{ playerid } != 0 ) GivePlayerWeapon( playerid, p_VIPWep3{ playerid }, 200 ); - if ( p_VIPLevel[ playerid ] >= VIP_BRONZE ) SetPlayerArmour( playerid, 100.0 ); // Free armour on spawn. + if ( p_VIPLevel[ playerid ] >= VIP_GOLD && p_VIPWep2{ playerid } != 0 ) GivePlayerWeapon( playerid, p_VIPWep2{ playerid }, 200 ); + if ( p_VIPLevel[ playerid ] >= VIP_PLATINUM && p_VIPWep3{ playerid } != 0 ) GivePlayerWeapon( playerid, p_VIPWep3{ playerid }, 200 ); + if ( p_VIPLevel[ playerid ] >= VIP_GOLD ) SetPlayerArmour( playerid, 100.0 ); // Free armour on spawn. CallLocalFunction( "SetPlayerRandomSpawn", "d", playerid ); @@ -2330,7 +2330,7 @@ thread OnTaxEconomy( starting ) // players foreach ( new playerid : Player ) { - new Float: tax_discount = p_VIPLevel[ playerid ] >= VIP_GOLD ? 0.5 : 1.0; + new Float: tax_discount = p_VIPLevel[ playerid ] >= VIP_DIAMOND ? 0.5 : 1.0; new player_tax = floatround( float( GetPlayerTotalCash( playerid ) ) * tax_rate * tax_discount ); if ( player_tax > 0 ) { @@ -2352,7 +2352,7 @@ thread OnTaxEconomy( starting ) } // queries - mysql_single_query( sprintf( "UPDATE `USERS` SET `CASH`=`CASH`*IF(`VIP_PACKAGE`>=3,%f,%f),`BANKMONEY`=`BANKMONEY`*IF(`VIP_PACKAGE`>=3,%f,%f) WHERE `ONLINE`=0 AND (`BANKMONEY`+`CASH`)>0", 1.0 - tax_rate / 2.0, 1.0 - tax_rate, 1.0 - tax_rate / 2.0, 1.0 - tax_rate ) ); + mysql_single_query( sprintf( "UPDATE `USERS` SET `CASH`=`CASH`*IF(`VIP_PACKAGE`>=3,%f,%f),`BANKMONEY`=`BANKMONEY`*IF(`VIP_PACKAGE`>=5,%f,%f) WHERE `ONLINE`=0 AND (`BANKMONEY`+`CASH`)>0", 1.0 - tax_rate / 2.0, 1.0 - tax_rate, 1.0 - tax_rate / 2.0, 1.0 - tax_rate ) ); mysql_single_query( sprintf( "UPDATE `BUSINESSES` SET `BANK`=`BANK`*%f WHERE `BANK`>0", 1.0 - tax_rate ) ); mysql_single_query( sprintf( "UPDATE `GANGS` SET `BANK`=`BANK`*%f WHERE `BANK`>0", 1.0 - tax_rate ) ); @@ -4184,7 +4184,7 @@ CMD:vipcmds( playerid, params[ ] ) CMD:vipspawnwep( playerid, params[ ] ) { if ( p_VIPLevel[ playerid ] < VIP_REGULAR ) return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); - format( szNormalString, sizeof( szNormalString ), "%s\n"COL_BRONZE"%s\n"COL_GOLD"%s", p_VIPWep1{ playerid } ? ReturnWeaponName( p_VIPWep1{ playerid } ) : ( "Nothing" ), p_VIPWep2{ playerid } ? ReturnWeaponName( p_VIPWep2{ playerid } ) : ( "Nothing" ), p_VIPWep3{ playerid } ? ReturnWeaponName( p_VIPWep3{ playerid } ) : ( "Nothing" ) ); + format( szNormalString, sizeof( szNormalString ), "%s\n"COL_GOLD"%s\n"COL_PLATINUM"%s", p_VIPWep1{ playerid } ? ReturnWeaponName( p_VIPWep1{ playerid } ) : ( "Nothing" ), p_VIPWep2{ playerid } ? ReturnWeaponName( p_VIPWep2{ playerid } ) : ( "Nothing" ), p_VIPWep3{ playerid } ? ReturnWeaponName( p_VIPWep3{ playerid } ) : ( "Nothing" ) ); ShowPlayerDialog( playerid, DIALOG_VIP_WEP, DIALOG_STYLE_LIST, "{FFFFFF}Spawn Weapons", szNormalString, "Select", "" ); return 1; } @@ -4246,8 +4246,8 @@ CMD:vipjob( playerid, params[ ] ) if ( p_VIPLevel[ playerid ] < VIP_REGULAR ) return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); - if ( p_VIPLevel[ playerid ] < VIP_GOLD ) - return SendError( playerid, "This command requires you to be Gold V.I.P." ); + if ( p_VIPLevel[ playerid ] < VIP_DIAMOND ) + return SendError( playerid, "This command requires you to be Diamond V.I.P." ); if ( isnull( params ) ) return SendUsage( playerid, "/vipjob [PART OF JOB NAME]" ); @@ -9064,16 +9064,16 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( !IsPlayerInRangeOfPoint( playerid, 5.0, -1966.1591, 852.7100, 1214.2678 ) && !IsPlayerInRangeOfPoint( playerid, 5.0, -1944.1324, 830.0725, 1214.2678 ) && !IsPlayerInRangeOfPoint( playerid, 5.0, 60.3115, 121.5226, 1017.4534 ) ) return SendError( playerid, "You must be near a gun vending machine inside the V.I.P lounge to use this." ); - if ( p_VIPArmourRedeem[ playerid ] > g_iTime && p_VIPLevel[ playerid ] < VIP_GOLD ) + if ( p_VIPArmourRedeem[ playerid ] > g_iTime && p_VIPLevel[ playerid ] < VIP_DIAMOND ) return SendError( playerid, "You must wait %d seconds to redeem another armour set again.", p_VIPArmourRedeem[ playerid ] - g_iTime ); SetPlayerArmour( playerid, 100.0 ); - p_VIPArmourRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_BRONZE ? 60 : 300 ); + p_VIPArmourRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_PLATINUM ? 60 : 300 ); SendServerMessage( playerid, "You have redeemed an armour set." ); } else { - if ( p_VIPWeaponRedeem[ playerid ] > g_iTime && p_VIPLevel[ playerid ] < VIP_GOLD ) + if ( p_VIPWeaponRedeem[ playerid ] > g_iTime && p_VIPLevel[ playerid ] < VIP_DIAMOND ) return SendError( playerid, "You must wait %d seconds to redeem another weapon again.", p_VIPWeaponRedeem[ playerid ] - g_iTime ); new weaponid; @@ -9085,7 +9085,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) } GivePlayerWeapon( playerid, weaponid, 0xFFFF ); SendServerMessage( playerid, "You have redeemed a %s.", ReturnWeaponName( weaponid ) ); - p_VIPWeaponRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_BRONZE ? 60 : 300 ); + p_VIPWeaponRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_PLATINUM ? 60 : 300 ); } } if ( ( dialogid == DIALOG_FIGHTSTYLE ) && response ) @@ -9150,8 +9150,8 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) } if ( ( dialogid == DIALOG_VIP_WEP ) && response ) { - if ( listitem == 1 && p_VIPLevel[ playerid ] < VIP_BRONZE ) return SendError( playerid, "You can only use this slot if you are a "COL_BRONZE"Bronze V.I.P{FFFFFF} or higher." ); - if ( listitem == 2 && p_VIPLevel[ playerid ] < VIP_GOLD ) return SendError( playerid, "You can only use this slot if you are a "COL_GOLD"Gold V.I.P{FFFFFF} or higher." ); + if ( listitem == 1 && p_VIPLevel[ playerid ] < VIP_GOLD ) return SendError( playerid, "You can only use this slot if you are a "COL_BRONZE"Gold V.I.P{FFFFFF} or higher." ); + if ( listitem == 2 && p_VIPLevel[ playerid ] < VIP_PLATINUM ) return SendError( playerid, "You can only use this slot if you are a "COL_GOLD"Platinum V.I.P{FFFFFF} or higher." ); ShowPlayerDialog( playerid, DIALOG_VIP_WEP_SELECT, DIALOG_STYLE_LIST, "{FFFFFF}Weapon Select", ""COL_RED"Remove Weapon On This Slot\n9mm Pistol\nSilenced Pistol\nDesert Eagle\nShotgun\nSawn-off Shotgun\nSpas 12\nMac 10\nMP5\nAK-47\nM4\nTec 9\nRifle\nSniper", "Select", "Cancel"); p_VIPWep_Modify{ playerid } = listitem; } @@ -9725,68 +9725,6 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) DeletePVar( playerid, "just_donated" ); return UpdateGlobalDonated( playerid, fAmount, !response ); } - /*if ( dialogid == DIALOG_DONATED_PLATBRONZE ) - { - if ( response ) - { - new - pID; - - if ( sscanf( inputtext, "u", pID ) ) - { - SendError( playerid, "Please enter a player's ID or name." ); - ShowPlayerDialog( playerid, DIALOG_DONATED_PLATBRONZE, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Platinum V.I.P, you have the option of gifting Bronze VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); - } - else if ( !IsPlayerConnected( pID ) ) - { - SendError( playerid, "This player is not connected." ); - ShowPlayerDialog( playerid, DIALOG_DONATED_PLATBRONZE, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Platinum V.I.P, you have the option of gifting Bronze VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); - } - else - { - SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[V.I.P]"COL_WHITE" You have gifted Bronze V.I.P to %s(%d)!", ReturnPlayerName( pID ), pID ); - SetPlayerVipLevel( pID, VIP_BRONZE ); - ShowPlayerVipRedeemedDialog( playerid ); - } - } - else - { - AddPlayerNote( playerid, -1, "{CD7F32}Bronze V.I.P" #COL_WHITE ); - SendServerMessage( playerid, "Okay. This has been noted down for your account and will be given to you at a stage that you want, do contact Lorenc though." ); - ShowPlayerVipRedeemedDialog( playerid ); - } - }*/ - /*if ( dialogid == DIALOG_DONATED_DIAGOLD ) - { - if ( response ) - { - new - pID; - - if ( sscanf( inputtext, "u", pID ) ) - { - SendError( playerid, "Please enter a player's ID or name." ); - ShowPlayerDialog( playerid, DIALOG_DONATED_DIAGOLD, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Diamond V.I.P, you have the option of gifting Gold VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); - } - else if ( !IsPlayerConnected( pID ) ) - { - SendError( playerid, "This player is not connected." ); - ShowPlayerDialog( playerid, DIALOG_DONATED_DIAGOLD, DIALOG_STYLE_INPUT, ""COL_GOLD"SF-CNR Donation", ""COL_WHITE"As you've redeemed Diamond V.I.P, you have the option of gifting Gold VIP to someone.\n\nIf you would like to gift it to yourself, type your name/id or the person you're gifting it to.\n\n"COL_ORANGE"If you just don't know yet, cancel and PM Lorenc on the forum when you make a decision!", "Gift it!", "I'll Think!" ); - } - else - { - SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[V.I.P]"COL_WHITE" You have gifted Gold V.I.P to %s(%d)!", ReturnPlayerName( pID ), pID ); - SetPlayerVipLevel( pID, VIP_GOLD ); - ShowPlayerVipRedeemedDialog( playerid ); - } - } - else - { - AddPlayerNote( playerid, -1, ""COL_GOLD"Gold V.I.P" #COL_WHITE ); - SendServerMessage( playerid, "Okay. This has been noted down for your account and will be given to you at a stage that you want, do contact Lorenc though." ); - ShowPlayerVipRedeemedDialog( playerid ); - } - }*/ if ( ( dialogid == DIALOG_UNBAN_CLASS ) && response ) { cmd_unbanme( playerid, "" ); @@ -12105,27 +12043,6 @@ stock hasBadDrivebyWeapon( playerid ) return false; } -stock SetPlayerVipLevel( pID, level, interval = 2592000 ) -{ - if ( IsPlayerConnected( pID ) ) - { - // force upgrade - if ( p_VIPLevel[ pID ] < level ) { - p_VIPLevel[ pID ] = level; - } - - if ( level ) { - if ( p_VIPExpiretime[ pID ] > g_iTime ) p_VIPExpiretime[ pID ] += interval; - else p_VIPExpiretime[ pID ] += ( g_iTime + interval ); - } - - // expire the players vip if level 0 - else { - p_VIPExpiretime[ pID ] = 0; - } - } -} - stock CensoreString( query[ ], characters = 5 ) { static