From 12bd57276572dd3502e38cb4796452d30720ad49 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Mon, 21 May 2018 19:21:39 +1000 Subject: [PATCH] new tax system --- gamemodes/sf-cnr.pwn | 253 ++++++++++++------ pawno/include/anticheat/hooks.inc | 9 + .../cnr/static/player_objects.inc | 59 ++++ .../cnr/static/removed_buildings.inc | 5 +- .../cnr/static/server_objects.inc | 6 + .../cnr/static/server_vehicles.inc | 3 - scriptfiles/updates.txt | 12 +- 7 files changed, 255 insertions(+), 92 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 4417e39..7a57fb2 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -13,7 +13,7 @@ */ #pragma compat 1 -#pragma option -d3 +// #pragma option -d3 #pragma dynamic 7200000 // #define DEBUG_MODE @@ -115,7 +115,6 @@ native gpci ( playerid, serial[ ], len ); // #define ITER_NONE -1 /* Dynamic Macros */ -//#define GetTaxRate() (GetGVarFloat("taxrate")) #define IsDoubleXP() (GetGVarInt("doublexp")!=0) #define IsProxiesBanned() (GetGVarInt("proxyban")!=0) @@ -2102,7 +2101,7 @@ new g_casinoRewardsItems[ ] [ E_REWARDS_DATA ] = { { "Fireworks", 2500.0 }, { "10 Explosive Bullets", 5000.0 }, - { "No Tax For 1 Hour", 25000.0 }, + // { "No Tax For 1 Hour", 25000.0 }, { "Highroller Access", 200000.0 } }, g_casinoRewardsShopItems[ ] = { @@ -3031,7 +3030,7 @@ new p_AntiEmpSpam [ MAX_PLAYERS ], bool: p_inPaintBall [ MAX_PLAYERS char ], p_Scissors [ MAX_PLAYERS ], - p_TaxTime [ MAX_PLAYERS ], + // p_TaxTime [ MAX_PLAYERS ], bool: p_GPSToggled [ MAX_PLAYERS char ], p_GPSTimer [ MAX_PLAYERS ] = { 0xFF, ... }, p_GPSLocation [ MAX_PLAYERS ], @@ -3270,7 +3269,7 @@ stock Float: distanceFromSafe( iPlayer, iRobbery, &Float: fDistance = Float: 0x7 static Float: fX, Float: fY, Float: fZ; - if ( iRobbery == -1 ) + if ( ! Iter_Contains( RobberyCount, iRobbery ) ) return fDistance; if ( g_robberyData[ iRobbery ] [ E_WORLD ] != -1 && g_robberyData[ iRobbery ] [ E_WORLD ] != GetPlayerVirtualWorld( iPlayer ) ) @@ -3334,7 +3333,10 @@ public OnGameModeInit() } /* ** Server Variables ** */ - AddServerVariable( "taxrate", "5.0", GLOBAL_VARTYPE_FLOAT ); + AddServerVariable( "taxtime", "0", GLOBAL_VARTYPE_INT ); + AddServerVariable( "taxrate", "1.0", GLOBAL_VARTYPE_FLOAT ); + AddServerVariable( "taxprofit", "0.0", GLOBAL_VARTYPE_FLOAT ); + AddServerVariable( "taxprofit_prev", "0.0", GLOBAL_VARTYPE_FLOAT ); AddServerVariable( "doublexp", "0", GLOBAL_VARTYPE_INT ); AddServerVariable( "eventbank", "0", GLOBAL_VARTYPE_INT ); AddServerVariable( "eventhost", "0", GLOBAL_VARTYPE_INT ); @@ -4283,8 +4285,24 @@ public OnGameModeInit() g_apartmentElevatorDoor2[ level ] = CreateDynamicObject( 18757, -1955.05, 1361.64, Z, 0.00, 0.00, -90.00 ); } - // Houses - SetDynamicObjectMaterialText( CreateDynamicObject( 10447, -2550.1719, 54.5625, 14.3906, 0.00, 0.00, 0.00, .streamdistance = 500.0, .priority = 100 ), 40, "The Lost", 7, "Times New Roman", 24, 1, -1, -16777216, 1 ); // The Lost + // The Lost And Damned + tmpVariable = CreateDynamicObject( 10447, -2550.173339, 54.568466, 14.390675, 0.000000, 0.000000, 0.000000, .streamdistance = 500.0, .priority = 100 ); + SetDynamicObjectMaterial( tmpVariable, 8, 10969, "scum_sfse", "ws_apartmentbrown1", 0 ); + SetDynamicObjectMaterial( tmpVariable, 14, 10969, "scum_sfse", "ws_apartmentbrown2", 0 ); + SetDynamicObjectMaterial( tmpVariable, 5, 8399, "vgs_shops", "vegasclubmural_128", 0 ); + SetDynamicObjectMaterial( tmpVariable, 6, 8399, "vgs_shops", "vegasclubmural_128", 0 ); + SetDynamicObjectMaterialText( tmpVariable, 7, "The Lost", 120, "Arial", 80, 1, -1, -11980516, 1 ); + CreateDynamicObject( 1536, -2587.711425, 58.402435, 3.336049, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 1536, -2587.741455, 61.402610, 3.336049, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + tmpVariable = CreateDynamicObject( 3525, -2588.295654, 58.166000, 4.775937, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 2, 8463, "vgseland", "tiadbuddhagold", 0 ); + SetDynamicObjectMaterial( tmpVariable, 1, 17298, "weefarmcuntw", "sjmbigold2", 0 ); + tmpVariable = CreateDynamicObject( 3525, -2588.345703, 61.656021, 4.775937, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 1, 17298, "weefarmcuntw", "sjmbigold2", 0 ); + SetDynamicObjectMaterial( tmpVariable, 2, 8463, "vgseland", "tiadbuddhagold", 0 ); + tmpVariable = CreateDynamicObject( 3524, -2587.017578, 59.971229, 4.842026, 35.399997, 0.000000, -90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 2, 8463, "vgseland", "tiadbuddhagold", 0 ); + SetDynamicObjectMaterialText( tmpVariable, 1, "a", 0, "arial", 0, 0, 0, 0, 0 ); // Lumberjack SetDynamicObjectMaterial( CreateDynamicObject( 12814, -2337.1, -94.00, 34.28, 0.0, 0.0, 270.0, .streamdistance = 500.0, .priority = 100 ), 0, 19381, "all_walls", "desgreengrass" ); @@ -4430,7 +4448,7 @@ public OnGameModeInit() mysql_function_query( dbHandle, "DELETE g FROM `GARAGES` g JOIN `USERS` u ON u.`ID` = g.`OWNER` WHERE UNIX_TIMESTAMP()-u.`LASTLOGGED` > 1209600;", true, "onRemoveInactiveRows", "d", 6 ); // 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", 7 ); + // mysql_function_query( dbHandle, "UPDATE `USERS` SET `CASH`=`CASH`*0.75,`BANKMONEY`=`BANKMONEY`*0.75 WHERE UNIX_TIMESTAMP()-`LASTLOGGED`>1209600", true, "onRemoveInactiveRows", "d", 7 ); #endif /* ** Houses/Bribes/ETC **/ @@ -4876,6 +4894,12 @@ public OnServerUpdate( ) g_randomMessageTick = g_iTime + 30; } + // Time For Tax? + if ( g_iTime >= GetGVarInt( "taxtime" ) ) { + UpdateServerVariable( "taxtime", g_iTime + 86400, 0.0, "", GLOBAL_VARTYPE_INT ); + BeginEconomyTax( ); + } + // Happy Hour new playersOnline = Iter_Count(Player); @@ -5436,6 +5460,11 @@ public OnServerUpdate( ) // Restore and Replenish Stuff if ( g_iTime > g_RestoreRobberiesBribes ) { + #if defined WEAPON_DROP_ENABLED + // Replenish Weapon Drops + ClearInactiveWeaponDrops( g_iTime ); + #endif + // Replenish Bribes foreach(new bribeid : BribeCount) if ( ( GetTickCount( ) - g_bribeData[ bribeid ] [ E_TIMESTAMP ] ) > MAX_BRIBE_WAIT && g_bribeData[ bribeid ] [ E_DISABLED ] == true ) UpdateDynamic3DTextLabelText( g_bribeData[ bribeid ] [ E_LABEL ], COLOR_GOLD, sprintf( "Bribe(%d)", bribeid ) ), g_bribeData[ bribeid ] [ E_DISABLED ] = false; @@ -5456,7 +5485,6 @@ public OnServerUpdate( ) ReplaceObjectModel( g_atmData[ i ] [ E_OBJECT ], 19324 ); } - // Replenish product foreach (new businessid : business) { @@ -5647,11 +5675,11 @@ public ZoneTimer( ) // Money Grub if ( Iter_Contains( gangs, owner_gang ) ) { - if ( g_gangData[ owner_gang ] [ E_BANK ] > 250000 ) - { - new afk_opmembers, online_opmembers = GetOnlineGangMembers( owner_gang, .afk_members = afk_opmembers ); - new zone_money = Turf_GetProfitability( z, online_opmembers - afk_opmembers ); + new afk_opmembers, online_opmembers = GetOnlineGangMembers( owner_gang, .afk_members = afk_opmembers ); + new zone_money = Turf_GetProfitability( z, online_opmembers - afk_opmembers ); + if ( g_gangData[ owner_gang ] [ E_BANK ] > zone_money ) + { // deduct from gang bank and give to op, take 10% as fee g_gangData[ owner_gang ] [ E_BANK ] -= zone_money; SaveGangData( owner_gang ); @@ -7292,7 +7320,72 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b function hidedamagetd_Timer( playerid ) return PlayerTextDrawHide( playerid, p_DamageTD[ playerid ] ); -stock GetPlayerTax( playerid, &Float: tax_percentage_formula = 0.0 ) +stock BeginEconomyTax( starting = 1 ) { + mysql_function_query( dbHandle, "SELECT USER_CASH, BIZ_CASH, GANG_CASH FROM (SELECT (SUM(BANKMONEY)+SUM(CASH)) USER_CASH FROM USERS) A CROSS JOIN (SELECT SUM(BANK) BIZ_CASH FROM BUSINESSES) B CROSS JOIN (SELECT SUM(BANK) GANG_CASH FROM GANGS) C", true, "OnTaxEconomy", "i", starting ); +} + +thread OnTaxEconomy( starting ) +{ + new rows; + cache_get_data( rows, tmpVariable ); + if ( ! rows ) return 1; + + new user_cash = cache_get_field_content_int( 0, "USER_CASH", dbHandle ); + new biz_cash = cache_get_field_content_int( 0, "BIZ_CASH", dbHandle ); + new gang_cash = cache_get_field_content_int( 0, "GANG_CASH", dbHandle ); + + // total_thousands + new Float: total_thousands = float( user_cash + biz_cash + gang_cash ) / 1000000.0; + + // step + if ( starting == 1 ) + { + new Float: tax_rate = GetGVarFloat( "taxrate" ) / 100.0; // 1% + + // players + foreach ( new playerid : Player ) { + new + player_tax = floatround( float( GetPlayerTotalCash( playerid ) ) * tax_rate ); + + if ( player_tax > 0 ) { + ShowPlayerHelpDialog( playerid, 5000, sprintf( "~w~You have paid ~r~%s~w~ in tax", number_format( player_tax ) ) ); + GivePlayerCash( playerid, -player_tax ); + } + } + + // businesses + foreach ( new businessid : business ) { + new business_tax = floatround( float( g_businessData[ businessid ] [ E_BANK ] ) * tax_rate ); + if ( business_tax > 0 ) g_businessData[ businessid ] [ E_BANK ] -= business_tax; + } + + // gangs + foreach ( new gangid : gangs ) { + new gang_tax = floatround( float( g_gangData[ gangid ] [ E_BANK ] ) * tax_rate ); + if ( gang_tax > 0 ) g_gangData[ gangid ] [ E_BANK ] -= gang_tax; + } + + // queries + mysql_single_query( sprintf( "UPDATE `USERS` SET `CASH`=`CASH`*%f,`BANKMONEY`=`BANKMONEY`*%f WHERE `ONLINE`=0 AND (`BANKMONEY`+`CASH`)>0", 1.0 - tax_rate, 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 ) ); + + // set current economy money + SetGVarFloat( "before_tax", total_thousands ); + printf("[SERVER ECONOMY TAX] $%0.3fM before tax.", total_thousands ); + BeginEconomyTax( .starting = 0 ); + } + else + { + new Float: profit = GetGVarFloat( "before_tax" ) - total_thousands; + UpdateServerVariable( "taxprofit_prev", 0, GetGVarFloat( "taxprofit" ), "", GLOBAL_VARTYPE_FLOAT ); + UpdateServerVariable( "taxprofit", 0, GetGVarFloat( "taxprofit" ) + profit, "", GLOBAL_VARTYPE_FLOAT ); + printf( "[SERVER ECONOMY TAX] The server economy has been successfully taxed for a profit of $%0.3fM.", profit ); + } + return 1; +} + +/*stock GetPlayerTax( playerid, &Float: tax_percentage_formula = 0.0 ) { if ( ! GetPlayerTotalCash( playerid ) ) return 0; @@ -7314,7 +7407,7 @@ stock GetPlayerTax( playerid, &Float: tax_percentage_formula = 0.0 ) // return final tax new final_tax = floatround( ( tax_percentage_formula / 100.0 ) * player_money ); return final_tax > 0 ? final_tax : 0; -} +}*/ #if defined AC_INCLUDED public OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart ) @@ -7417,19 +7510,18 @@ public OnPlayerDeath( playerid, killerid, reason ) } /* ** Tax And Medical Fees ** */ - new player_tax = GetPlayerTax( playerid ); - new player_tax_due = p_Uptime[ playerid ] > p_TaxTime[ playerid ] && p_inPaintBall{ playerid } != true; // check if player has any money if ( GetPlayerTotalCash( playerid ) > 0 ) { - new - szTaxable[ 128 ], iMoney = p_inPaintBall{ playerid } == true ? 0 : ( GetPlayerTotalCash( playerid ) > 200000 ? 1500 : 100 ); + new medical_fees = p_inPaintBall{ playerid } ? 0 : 100; - format( szTaxable, sizeof( szTaxable ), "~w~You have paid ~r~%s~w~ in medical fees", number_format( iMoney ) ); - GivePlayerCash( playerid, -( iMoney ) ); + if ( medical_fees ) { + ShowPlayerHelpDialog( playerid, 5000, sprintf( "~w~You have paid ~r~%s~w~ in medical fees", number_format( medical_fees ) ) ); + GivePlayerCash( playerid, -medical_fees ); + } - if ( player_tax_due && player_tax > 0 ) + /*if ( ( p_Uptime[ playerid ] > p_TaxTime[ playerid ] && p_inPaintBall{ playerid } != true ) && player_tax > 0 ) { GivePlayerCash( playerid, -player_tax ); @@ -7443,8 +7535,7 @@ public OnPlayerDeath( playerid, killerid, reason ) // format string if ( strlen( szTaxable ) ) format( szTaxable, sizeof( szTaxable ), "%s and ~r~%s~w~ in tax", szTaxable, number_format( player_tax ) ); else format( szTaxable, sizeof( szTaxable ), "~w~You have paid ~r~%s~w~ in tax", number_format( player_tax ) ); - } - ShowPlayerHelpDialog( playerid, 5000, szTaxable ); + }*/ } /* ** End Of Tax And Medical Fees ** */ @@ -7599,9 +7690,6 @@ public OnPlayerDeath( playerid, killerid, reason ) new iContractAmount = p_ContractedAmount[ playerid ]; - // if player had tax, give him 10 percent of their tax too - if ( player_tax_due ) iContractAmount += floatround( float( player_tax ) * 0.25 ); - if ( iContractAmount >= 50000 && GetPlayerScore( killerid ) < 50 ) { SendServerMessage( playerid, "Your contract is incomplete as you have been killed by a player with lower than 50 score." ); @@ -10431,19 +10519,14 @@ CMD:playerjobs( playerid, params[ ] ) return 1; } - CMD:gettaxrate( playerid, params[ ] ) return cmd_tax( playerid, params ); CMD:getmytax( playerid, params[ ] ) return cmd_tax( playerid, params ); CMD:tax( playerid, params[ ] ) { - new Float: tax_rate = 0.0; - new tax_amount = GetPlayerTax( playerid, tax_rate ); - - if ( p_Uptime[ playerid ] > p_TaxTime[ playerid ] ) { - SendServerMessage( playerid, "Your tax is "COL_GOLD"%s"COL_WHITE" at %0.2f%s when you die.", number_format( tax_amount ), tax_rate, "%%" ); - } else { - SendServerMessage( playerid, "Your tax is "COL_GOLD"%s"COL_WHITE" at %0.2f%s in %s.", number_format( tax_amount ), tax_rate, "%%", secondstotime( p_TaxTime[ playerid ] - p_Uptime[ playerid ] ) ); - } + new Float: tax_rate = GetGVarFloat( "taxrate" ); + new player_tax = floatround( float( GetPlayerTotalCash( playerid ) ) * ( tax_rate / 100.0 ) ); + if ( player_tax < 0 ) player_tax = 0; + SendServerMessage( playerid, "Your tax is "COL_GOLD"%s"COL_WHITE" at %0.2f%s in %s.", number_format( player_tax ), tax_rate, "%%", secondstotime( GetGVarInt( "taxtime" ) - g_iTime ) ); return 1; } @@ -10461,13 +10544,14 @@ thread gettotalcash( playerid ) cache_get_data( rows, tmpVariable ); if ( rows ) { + new tax_profit = floatround( ( GetGVarFloat( "taxprofit" ) - GetGVarFloat( "taxprofit_prev" ) ) * 1000000.0 ); new user_cash = cache_get_field_content_int( 0, "USER_CASH", dbHandle ); new biz_cash = cache_get_field_content_int( 0, "BIZ_CASH", dbHandle ); new gang_cash = cache_get_field_content_int( 0, "GANG_CASH", dbHandle ); new total_cash = user_cash + biz_cash + gang_cash; - format( szLargeString, 512, "Total User Cash\t"COL_GREY"%s\nTotal Gang Cash\t"COL_GREY"%s\nTotal Business Cash\t"COL_GREY"%s\nTotal Server Cash\t"COL_GOLD"%s", - number_format( user_cash ), number_format( gang_cash ), number_format( biz_cash ), number_format( total_cash ) ); + format( szLargeString, 512, "Total User Cash\t"COL_GREY"%s\nTotal Gang Cash\t"COL_GREY"%s\nTotal Business Cash\t"COL_GREY"%s\nTotal Server Cash\t"COL_GOLD"%s\nTotal Tax Profit (Day)\t"COL_GOLD"%s", + number_format( user_cash ), number_format( gang_cash ), number_format( biz_cash ), number_format( total_cash ), number_format( tax_profit ) ); // SendServerMessage( playerid, "Total: "COL_GOLD"%s"COL_WHITE", Tax Rate: "COL_GOLD"%s"COL_WHITE" per 24 mins.", number_format( total_cash ), number_format( tax_rate ) ); ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, "{FFFFFF}SF-CNR Economy", szLargeString, "Close", "" ); @@ -12227,12 +12311,6 @@ CMD:hitlist( playerid, params[ ] ) { g_contractList[ player ] [ 0 ] = player; g_contractList[ player ] [ 1 ] = p_ContractedAmount[ player ]; - - // add hit amount if applicable - if ( p_Uptime[ player ] > p_TaxTime[ player ] && p_inPaintBall{ player } != true ) { - new player_tax = GetPlayerTax( player ); - g_contractList[ player ] [ 1 ] += floatround( float( player_tax ) * 0.25 ); - } } // sort @@ -13506,16 +13584,9 @@ CMD:placehit( playerid, params[ ] ) GivePlayerCash( playerid, -cash ); p_AntiSpammyTS[ playerid ] = g_iTime + 10; - // bounty - new bounty = p_ContractedAmount[ pID ]; - if ( p_Uptime[ pID ] > p_TaxTime[ pID ] && p_inPaintBall{ pID } != true ) { - new player_tax = GetPlayerTax( pID ); - bounty += floatround( float( player_tax ) * 0.25 ); - } - // message printf("[placehit] %s -> %s - %s", ReturnPlayerName( playerid ), ReturnPlayerName( pID ), number_format( cash ) ); // 8hska7082bmahu - SendGlobalMessage( -1, ""COL_ORANGE"[CONTRACT]"COL_WHITE" %s(%d) has put a contract on %s(%d), their bounty is now "COL_GOLD"%s{FFFFFF}.", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID, number_format( bounty ) ); + SendGlobalMessage( -1, ""COL_ORANGE"[CONTRACT]"COL_WHITE" %s(%d) has put a contract on %s(%d), their bounty is now "COL_GOLD"%s{FFFFFF}.", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID, number_format( p_ContractedAmount[ pID ] ) ); } return 1; } @@ -17866,11 +17937,21 @@ CMD:weather( playerid, params[ ] ) /* Level RCON */ CMD:explosiverounds( playerid, params[ ] ) { - if ( ! IsPlayerAdmin( playerid ) ) return 0; - p_ExplosiveBullets[ playerid ] += 100; - ShowPlayerHelpDialog( playerid, 1500, "You have only %d explosive bullets remaining.", p_ExplosiveBullets[ playerid ] ); + if ( ! IsPlayerAdmin( playerid ) ) + return 0; + + new + targetid, rounds; + + if ( sscanf( params, "dd", targetid, rounds ) ) + return SendUsage( playerid, "/explosiverounds [PLAYER_ID] [ROUNDS]" ); + + p_ExplosiveBullets[ targetid ] += rounds; + SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]{FFFFFF} You've given %s(%d) %d explosive rounds.", ReturnPlayerName( targetid ), targetid, rounds ); + ShowPlayerHelpDialog( targetid, 1500, "You have %d explosive bullets remaining.", p_ExplosiveBullets[ targetid ] ); return 1; } + /*CMD:furnishhomes( playerid, params[ ] ) { if ( ! IsPlayerAdmin( playerid ) ) return 0; for ( new i = 0; i < MAX_HOUSES; i ++ ) if ( g_houseData[ i ] [ E_CREATED ] ) { @@ -18209,19 +18290,36 @@ CMD:logdialog( playerid, params[ ] ) return 1; } -/*CMD:settaxrate( playerid, params[ ] ) +CMD:settaxrate( playerid, params[ ] ) { new Float: rate; if ( !IsPlayerAdmin( playerid ) ) return 0; else if ( sscanf( params, "f", rate ) ) return SendUsage( playerid, "/settaxrate [PERCENTAGE]" ); - else if ( rate < 0 || rate > 50.0 ) return SendError( playerid, "The rate must be over 0 and less than 50." ); + else if ( rate < 0 || rate > 10.0 ) return SendError( playerid, "The rate must be over 0 and less than 10." ); else { - SendServerMessage( playerid, "You have changed the tax rate from "COL_GREY"%0.2f"COL_WHITE" to "COL_GREY"%0.2f"COL_WHITE".", GetTaxRate( ), rate ); + SendServerMessage( playerid, "You have changed the tax rate from "COL_GREY"%0.2f"COL_WHITE" to "COL_GREY"%0.2f"COL_WHITE".", GetGVarInt( "taxrate" ), rate ); UpdateServerVariable( "taxrate", 0, rate, "", GLOBAL_VARTYPE_FLOAT ); } return 1; -}*/ +} + +CMD:settaxtime( playerid, params[ ] ) +{ + new time; + if ( !IsPlayerAdmin( playerid ) ) return 0; + else if ( sscanf( params, "d", time ) ) return SendUsage( playerid, "/settaxrate [TIMESTAMP]" ); + else + { + if ( time < g_iTime ) { + SendServerMessage( playerid, "Tax time updated. Players to be taxed A.S.A.P.", secondstotime( time - g_iTime ) ); + } else { + SendServerMessage( playerid, "Tax time updated. %s until tax.", secondstotime( time - g_iTime ) ); + } + UpdateServerVariable( "taxtime", time, 0.0, "", GLOBAL_VARTYPE_INT ); + } + return 1; +} CMD:givewanted( playerid, params[ ] ) { @@ -20210,11 +20308,6 @@ public OnPlayerPickUpDynamicPickup( playerid, pickupid ) new Float: X, Float: Y, Float: Z; -#if defined AC_INCLUDED - if ( GetGVarType( "ac_WeaponPickup", pickupid ) != GLOBAL_VARTYPE_NONE ) - p_PlayerHasWeapon[ playerid ] { GetGVarInt( "ac_WeaponPickup", pickupid ) } = true; -#endif - if ( pickupid != PreviousPickupID[ playerid ] ) { new @@ -21644,7 +21737,7 @@ thread OnPlayerLogin( playerid, password[ ] ) p_Fireworks[ playerid ] = cache_get_field_content_int( 0, "FIREWORKS", dbHandle ); p_ExplosiveBullets[ playerid ] = cache_get_field_content_int( 0, "EXPLOSIVE_BULLETS", dbHandle ); p_AddedEmail{ playerid } = !!cache_get_field_content_int( 0, "USED_EMAIL", dbHandle ); - p_TaxTime[ playerid ] = cache_get_field_content_int( 0, "TAX_TIME", dbHandle ); + // p_TaxTime[ playerid ] = cache_get_field_content_int( 0, "TAX_TIME", dbHandle ); // spawn location new @@ -22045,12 +22138,12 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) format( Query, sizeof( Query ), "{FFFFFF}Enter the amount that you are willing to withdraw from your gang bank account.\n\n"COL_GREY"Current Balance:"COL_WHITE" %s", number_format( g_gangData[ gangid ] [ E_BANK ] ) ); ShowPlayerDialog(playerid, DIALOG_GANG_BANK_WITHDRAW, DIALOG_STYLE_INPUT, "{FFFFFF}Gang Account", Query, "Withdraw", "Back"); } - /*case 4: + case 4: { format( Query, sizeof( Query ), "{FFFFFF}Enter the amount that you are willing to deposit into your gang bank account below.\n\n"COL_GREY"Current Balance:"COL_WHITE" %s", number_format( g_gangData[ gangid ] [ E_BANK ] ) ); ShowPlayerDialog(playerid, DIALOG_GANG_BANK_DEPOSIT, DIALOG_STYLE_INPUT, "{FFFFFF}Gang Account", Query, "Deposit", "Back"); - }*/ - case 4: + } + case 5: { format( Query, sizeof( Query ), ""COL_GREY"Current Balance:"COL_WHITE" %s\n"COL_GREY"Current Money:{FFFFFF} %s", number_format( g_gangData[ gangid ] [ E_BANK ] ), number_format( GetPlayerCash( playerid ) ) ); ShowPlayerDialog(playerid, DIALOG_GANG_BANK_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Gang Account", Query, "Ok", "Back"); @@ -22182,7 +22275,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) } return 1; } - /*if ( dialogid == DIALOG_GANG_BANK_DEPOSIT ) + if ( dialogid == DIALOG_GANG_BANK_DEPOSIT ) { if ( !response ) return ShowPlayerBankMenuDialog( playerid ); @@ -22232,7 +22325,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) ShowPlayerDialog( playerid, DIALOG_GANG_BANK_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Gang Account", Query, "Ok", "Back" ); } return 1; - }*/ + } if ( dialogid == DIALOG_HOUSES ) { if ( ! response ) @@ -22910,12 +23003,12 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) p_ExplosiveBullets[ playerid ] += 10; ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_YES~~w~ to activate explosive bullets." ); } - case 2: // taxes + /*case 2: // taxes { p_TaxTime[ playerid ] = ( p_TaxTime[ playerid ] > p_Uptime[ playerid ] ? p_TaxTime[ playerid ] : p_Uptime[ playerid ] ) + 3600; mysql_single_query( sprintf( "UPDATE `USERS` SET `TAX_TIME`=%d WHERE `ID`=%d", p_TaxTime[ playerid ], p_AccountID[ playerid ] ) ); - } - case 3: // highroller + }*/ + case 2: // highroller { if ( p_IsCasinoHighRoller{ playerid } ) return SendError( playerid, "You are already considered a casino highroller." ); mysql_single_query( sprintf( "UPDATE `USERS` SET `VISAGE_HIGHROLLER`=1 WHERE `ID`=%d", p_AccountID[ playerid ] ) ); @@ -31727,7 +31820,11 @@ stock ShowOwnedFurnitureList( playerid, houseid ) foreach ( new fhandle : housefurniture[ houseid ] ) { new modelid = Streamer_GetIntData( STREAMER_TYPE_OBJECT, g_houseFurnitureData[ houseid ] [ fhandle ], E_STREAMER_MODEL_ID ); new furniture_item = getFurnitureID( modelid ); - format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, g_houseFurniture[ furniture_item ] [ E_NAME ] ); + if ( furniture_item != -1 ) { + format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, g_houseFurniture[ furniture_item ] [ E_NAME ] ); + } else { + strcat( szLargeString, "Unknown\n" ); + } } ShowPlayerDialog( playerid, DIALOG_FURNITURE_MAN_SEL, DIALOG_STYLE_TABLIST_HEADERS, "Furniture", szLargeString, "Select", "Back" ); } @@ -34535,8 +34632,10 @@ stock ShowPlayerBankMenuDialog( playerid ) new gangid = p_GangID[ playerid ]; - if ( gangid != -1 && Iter_Contains( gangs, gangid ) ) - return ShowPlayerDialog( playerid, DIALOG_BANK_MENU, DIALOG_STYLE_LIST, "{FFFFFF}Account", "Withdraw\nDeposit\nAccount Information\n"COL_GREEN"Gang Bank Withdraw\n"COL_GREEN"Gang Bank Balance", "Select", "Cancel" ); + if ( gangid != -1 && Iter_Contains( gangs, gangid ) ) { + format( szBigString, sizeof( szBigString ), "Withdraw\nDeposit\nAccount Information\n{%06x}Gang Bank Withdraw\n{%06x}Gang Bank Deposit\n{%06x}Gang Bank Balance", g_gangData[ gangid ] [ E_COLOR ] >>> 8, g_gangData[ gangid ] [ E_COLOR ] >>> 8, g_gangData[ gangid ] [ E_COLOR ] >>> 8 ); + return ShowPlayerDialog( playerid, DIALOG_BANK_MENU, DIALOG_STYLE_LIST, "{FFFFFF}Account", szBigString, "Select", "Cancel" ); + } return ShowPlayerDialog( playerid, DIALOG_BANK_MENU, DIALOG_STYLE_LIST, "{FFFFFF}Account", "Withdraw\nDeposit\nAccount Information", "Select", "Cancel" ); } diff --git a/pawno/include/anticheat/hooks.inc b/pawno/include/anticheat/hooks.inc index df073e2..296732f 100644 --- a/pawno/include/anticheat/hooks.inc +++ b/pawno/include/anticheat/hooks.inc @@ -203,3 +203,12 @@ hook OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, vCheckForSilentAimbot( playerid, hittype, hitid ); return 1; } + +// Callback Hook (OnPlayerPickupDynamicPickup) + +hook OnPlayerPickUpDynPickup( playerid, pickupid ) +{ + if ( GetGVarType( "ac_WeaponPickup", pickupid ) != GLOBAL_VARTYPE_NONE ) { + p_PlayerHasWeapon[ playerid ] { GetGVarInt( "ac_WeaponPickup", pickupid ) } = true; + } +} diff --git a/pawno/include/irresistible/cnr/static/player_objects.inc b/pawno/include/irresistible/cnr/static/player_objects.inc index ad38c76..6269771 100644 --- a/pawno/include/irresistible/cnr/static/player_objects.inc +++ b/pawno/include/irresistible/cnr/static/player_objects.inc @@ -14916,4 +14916,63 @@ stock initializeObjects( ) CreateDynamicObject( 3852, -2069.428222, 442.150970, 140.281997, 0.000000, 0.000000, 41.200000, -1, -1, -1 ); SetDynamicObjectMaterialText( CreateDynamicObject( 3074, -2016.600097, 482.661224, 31.985614, 0.000000, 0.000000, 0.000000, -1, -1, -1 ), 0, "Silent Squad HQ", 130, "Times New Roman", 32, 1, -1, 0, 1 ); CreateDynamicObject( 1498, -2067.575683, 442.742401, 138.752471, 0.000000, 0.000000, 131.400054, -1, -1, -1 ); + + // [DC] Facility Ammu + tmpVariable = CreateDynamicObject( 16400, -2746.706054, 109.361999, 5.321000, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 0, 8401, "vgshpground", "weewall256", 0 ); + SetDynamicObjectMaterialText( tmpVariable, 1, "0", 130, "arial", 0, 0, 0, 0, 1 ); + CreateDynamicObject( 16644, -2744.177001, 101.309997, 9.725000, 0.000000, -32.500000, 0.000000, -1, -1, -1 ); + tmpVariable = CreateDynamicObject( 3459, -2745.103027, 98.123001, 1.728999, 180.000000, 0.000000, 0.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 0, 10226, "sfeship1", "CJ_WOOD5", 0 ); + SetDynamicObjectMaterial( tmpVariable, 1, 3673, "xrf_refineryla", "Metal1_128", 0 ); + SetDynamicObjectMaterial( tmpVariable, 2, 3673, "xrf_refineryla", "Metal1_128", 0 ); + CreateDynamicObject( 1685, -2717.316894, 146.285995, 15.416999, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 1685, -2719.059082, 146.285995, 15.416999, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 1685, -2717.316894, 144.537002, 15.416999, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 1685, -2717.316894, 146.285995, 16.917999, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 2042, -2718.754882, 145.847000, 16.277999, 0.000000, 0.000000, -149.000000, -1, -1, -1 ); + tmpVariable = CreateDynamicObject( 12839, -2748.608886, 98.128997, 6.600999, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 1, 3673, "xrf_refineryla", "Metal3_128", 0 ); + SetDynamicObjectMaterialText( tmpVariable, 0, "0", 0, "arial", 0, 0, 0, 0, 0 ); + + // [NG] Facility Bank + CreateDynamicObject( 8948, -1671.854003, 1007.315979, 8.581999, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( CreateDynamicObject( 19353, -1665.043945, 1007.270996, 8.652000, 0.000000, 0.000000, 90.000000, -1, -1, -1 ), 0, 11545, "desn_truckstop", "alleydoor3", 0 ); + CreateDynamicObject( 19305, -1667.098999, 1007.301025, 8.612000, 0.000000, 0.000000, 180.000000, -1, -1, -1 ); + CreateDynamicObject( 1415, -1662.339965, 1008.669006, 6.972000, 0.000000, 0.000000, -97.599998, -1, -1, -1 ); + CreateDynamicObject( 1441, -1662.020996, 1011.117004, 7.541999, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 1462, -1675.878051, 1007.843017, 6.892000, 0.000000, 0.000000, 180.000000, -1, -1, -1 ); + SetDynamicObjectMaterialText( CreateDynamicObject( 19880, -1669.401000, 1007.325012, 17.211999, 0.000000, 0.000000, 180.000000, -1, -1, -1 ), 0, "The\nNightingales", 130, "IMPACT", 100, 0, -16711936, 0, 1 ); + CreateDynamicObject( 18260, -1675.340942, 1030.729980, 8.402000, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + CreateDynamicObject( 18257, -1662.521972, 1043.326049, 6.892000, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 3796, -1663.954956, 1027.989990, 6.872000, 0.000000, 0.000000, 110.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( CreateDynamicObject( 3796, -1663.954956, 1027.989990, 8.911999, 180.000000, 0.000000, 110.000000, -1, -1, -1 ), 0, 0, "none", "none", 0 ); + CreateDynamicObject( 944, -1664.711059, 1027.767944, 8.210000, 0.000000, 0.000000, 110.000000, -1, -1, -1 ); + CreateDynamicObject( 944, -1663.234985, 1028.305053, 8.210000, 0.000000, 0.000000, 110.000000, -1, -1, -1 ); + CreateDynamicObject( 16644, -1661.652954, 1019.765014, 1.851999, 0.000000, -45.000000, 110.000000, -1, -1, -1 ); + CreateDynamicObject( 1498, -1677.139038, 1026.962036, 6.881999, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 3852, -1686.958984, 1001.317016, 75.289001, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 1497, -1687.743041, 1003.059020, 73.773002, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 16375, -1664.017944, 1006.052001, 73.799003, 0.600000, -0.300000, 0.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( CreateDynamicObject( 1696, -1670.102050, 1044.081054, 7.912000, 0.000000, 0.000000, 0.000000, -1, -1, -1 ), 2, 16150, "ufo_bar", "cratetop128", 0 ); + CreateDynamicObject( 1225, -1661.128051, 1087.748046, 15.102000, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 1225, -1661.128051, 1093.209960, 15.102000, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 1225, -1661.128051, 1090.489013, 15.102000, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 1225, -1661.128051, 1086.464965, 9.031999, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); + + // [VT] Facility + SetDynamicObjectMaterialText( CreateDynamicObject( 3074, -1702.530761, 883.490783, 26.812227, 0.000000, 0.000000, 180.000000, -1, -1, -1 ), 0, "Virtual Titans", 130, "Impact", 64, 0, -16711681, 0, 1 ); + CreateDynamicObject( 1557, -1697.100952, 882.125549, 23.880605, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + CreateDynamicObject( 1557, -1697.100952, 885.155639, 23.880605, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + CreateDynamicObject( 3525, -1697.265014, 885.652465, 24.960626, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + CreateDynamicObject( 3525, -1697.265014, 881.702941, 24.960626, 0.000000, 0.000000, -90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( CreateDynamicObject( 3524, -1696.398925, 883.604125, 25.015392, 22.700031, 0.000000, -90.000000, -1, -1, -1 ), 1, 0, "none", "none", 0 ); + CreateDynamicObject( 16375, -1631.756347, 873.447692, 135.091476, 0.500000, -0.399999, 0.000000, -1, -1, -1 ); + CreateDynamicObject( 3852, -1641.466918, 880.437622, 136.566055, 0.000000, 0.000000, 180.000000, -1, -1, -1 ); + CreateDynamicObject( 1497, -1643.237060, 879.689331, 135.036148, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + tmpVariable = CreateDynamicObject( 9919, -1667.773681, 884.225769, 71.580688, 0.000000, 0.000000, 0.000000, .priority = 9999, .streamdistance = -1.0 ); + SetDynamicObjectMaterial( tmpVariable, 0, 8395, "pyramid", "marinawindow1_256", 0 ); + SetDynamicObjectMaterial( tmpVariable, 1, 8395, "pyramid", "marinawindow1_256", 0 ); + CreateDynamicObject( 1497, -1697.093627, 867.761169, 23.880601, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + } diff --git a/pawno/include/irresistible/cnr/static/removed_buildings.inc b/pawno/include/irresistible/cnr/static/removed_buildings.inc index 2ff675e..9d22793 100644 --- a/pawno/include/irresistible/cnr/static/removed_buildings.inc +++ b/pawno/include/irresistible/cnr/static/removed_buildings.inc @@ -256,7 +256,10 @@ stock removeExcessiveBuildings( playerid ) RemoveBuildingForPlayer(playerid, 2779, -21.8125, -57.7656, 1002.5859, 0.25); // gas station fix RemoveBuildingForPlayer(playerid, 2872, -20.5234, -57.7734, 1002.5859, 0.25); // gas station fix RemoveBuildingForPlayer( playerid, 792, -2035.648681, 473.131896, 35.172294, 25.000 ); // facility trees (dope casino) - RemoveBuildingForPlayer( playerid, 1227, -2751.422119, 94.378883, 7.031250, 10.000 ); // shini trash facility + // RemoveBuildingForPlayer( playerid, 1227, -2751.422119, 94.378883, 7.031250, 10.000 ); // shini trash facility + RemoveBuildingForPlayer(playerid, 9919, -1667.7734, 884.2266, 71.6250, 0.25); // VT Facility + RemoveBuildingForPlayer(playerid, 9937, -1667.7734, 884.2266, 71.6250, 0.25); // VT Facility LOD ^ + // Wolfganja (Diamond Donor) RemoveBuildingForPlayer(playerid, 1280, -2911.4219, 422.3516, 4.2891, 60.0); diff --git a/pawno/include/irresistible/cnr/static/server_objects.inc b/pawno/include/irresistible/cnr/static/server_objects.inc index 0caeafd..28a719d 100644 --- a/pawno/include/irresistible/cnr/static/server_objects.inc +++ b/pawno/include/irresistible/cnr/static/server_objects.inc @@ -5195,4 +5195,10 @@ stock initializeServerObjects( ) CreateDynamicObject( 19619, -2367.710693, 1554.091674, 1.567188, 0.000000, 0.000000, -60.799999, -1, -1, -1 ); CreateDynamicObject( 2607, -2376.293945, 1553.312988, 1.487188, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); CreateDynamicObject( 1514, -2375.768554, 1553.325317, 2.117187, 0.000000, 0.000000, 22.000122, -1, -1, -1 ); + + // SF Penis Tower + tmpVariable = CreateDynamicObject( 8131, -1980.097290, 884.313598, 54.389820, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); + SetDynamicObjectMaterial( tmpVariable, 0, 8460, "vgseland03_lvs", "ceaserwall06_128", 0 ); + SetDynamicObjectMaterial( tmpVariable, 1, 8839, "vgsecarshow", "lightred2_32", 0 ); + CreateDynamicObject( 19124, -1980.134521, 884.300659, 63.985248, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); } diff --git a/pawno/include/irresistible/cnr/static/server_vehicles.inc b/pawno/include/irresistible/cnr/static/server_vehicles.inc index 7f249e1..48cb703 100644 --- a/pawno/include/irresistible/cnr/static/server_vehicles.inc +++ b/pawno/include/irresistible/cnr/static/server_vehicles.inc @@ -189,11 +189,8 @@ static stock InitializeServerVehicles( ) AddStaticVehicle( 418, -2643.434814, -54.957450, 4.444913, 0.467300, -1, -1 ); AddStaticVehicle( 492, -2656.630859, -55.162696, 4.116600, 359.814422, -1, -1 ); AddStaticVehicle( 576, -2663.465576, -55.123760, 3.924628, 0.440136, -1, -1 ); - AddStaticVehicle( 408, -2754.740722, 103.471878, 7.575748, 355.461547, -1, -1 ); AddStaticVehicle( 466, -2679.893798, -55.417430, 4.077761, 359.692260, -1, -1 ); - AddStaticVehicle( 530, -2740.050292, 106.138755, 4.301768, 89.677894, -1, -1 ); AddStaticVehicle( 545, -2669.714111, -34.945426, 4.147040, 181.353363, -1, -1 ); - AddStaticVehicle( 530, -2740.149169, 120.032249, 4.302357, 88.184959, -1, -1 ); AddStaticVehicle( 579, -2663.511230, -34.891391, 4.266325, 179.788833, -1, -1 ); AddStaticVehicle( 500, -2710.922607, 119.323539, 4.354614, 0.624612, -1, -1 ); AddStaticVehicle( 559, -2749.767333, 200.412994, 6.732692, 24.013103, -1, -1 ); diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index 6af0c6a..b98eb0a 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -1,11 +1 @@ -(+) You can now rob the Militia at the large ship near Jizzy's. -(+) Hitman now take 25% of whatever the player loses in potential tax. Richer the player, the more you make! -(+) If the territory gang owner has more than 250K in their gang bank, capturing their turf will instantly pay you. -(/) Players no longer need to press ENTER to access a house/business. Just walk in. -(/) You will have 60 seconds to rejoin the server before you lose your turfs. -(/) Default take over time is now 60 seconds. -10 seconds for every gang member in your gang. -(/) Business security is now cheaper and based off the type of business. -(*) Fixes a death bug issue after being killed by an explosive. -(*) Damaging a drug house bot will trigger them to all shoot. -(*) Radio stations in /radio have now been updated. -(-) Army limit removed. +(/) New tax system. 1% daily for all users, businesses and gangs.