From baed9eb28ce1fffe382a4b7e4e1ef3deaa6e9205 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Mon, 5 Nov 2018 10:23:38 +1100 Subject: [PATCH] Add government and casino stocks. --- gamemodes/irresistible/cnr/features/business/business.pwn | 2 +- gamemodes/irresistible/cnr/features/fires.pwn | 1 + gamemodes/irresistible/cnr/features/stocks/stocks.pwn | 6 +++++- gamemodes/irresistible/cnr/features/visage/blackjack.pwn | 5 +++++ gamemodes/irresistible/cnr/features/visage/poker.pwn | 2 ++ gamemodes/irresistible/cnr/features/visage/roulette.pwn | 2 ++ .../irresistible/cnr/features/visage/slot_machines.pwn | 2 ++ gamemodes/irresistible/cnr/static/player_objects.pwn | 2 +- gamemodes/sf-cnr.pwn | 5 ++++- 9 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/business/business.pwn b/gamemodes/irresistible/cnr/features/business/business.pwn index 8dcf971..e0343bc 100644 --- a/gamemodes/irresistible/cnr/features/business/business.pwn +++ b/gamemodes/irresistible/cnr/features/business/business.pwn @@ -282,7 +282,7 @@ hook OnVehicleDeath( vehicleid, killerid ) GivePlayerScore( killerid, 2 ); GivePlayerCash( killerid, payout ); if ( p_Class[ killerid ] != CLASS_POLICE ) GivePlayerWantedLevel( killerid, 6 ), GivePlayerExperience( killerid, E_ROBBERY ); - else GivePlayerExperience( killerid, E_POLICE ); + else GivePlayerExperience( killerid, E_POLICE ), StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, payout, 0.05 ); SendGlobalMessage( -1, ""COL_GREY"[BUSINESS]"COL_WHITE" %s(%d) has destroyed a business vehicle and earned "COL_GOLD"%s"COL_WHITE"!", ReturnPlayerName( killerid ), killerid, cash_format( payout ) ); } } diff --git a/gamemodes/irresistible/cnr/features/fires.pwn b/gamemodes/irresistible/cnr/features/fires.pwn index 9505756..5496838 100644 --- a/gamemodes/irresistible/cnr/features/fires.pwn +++ b/gamemodes/irresistible/cnr/features/fires.pwn @@ -94,6 +94,7 @@ hook OnPlayerUpdateEx( playerid ) GivePlayerScore( playerid, 2 ); //GivePlayerExperience( playerid, E_FIREMAN ); GivePlayerCash( playerid, FIRE_EXTINGUISH_PAYOUT ); + StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, FIRE_EXTINGUISH_PAYOUT, 0.01 ); HouseFire_Remove( i ); } return 1; diff --git a/gamemodes/irresistible/cnr/features/stocks/stocks.pwn b/gamemodes/irresistible/cnr/features/stocks/stocks.pwn index 0c77c1a..75dea62 100644 --- a/gamemodes/irresistible/cnr/features/stocks/stocks.pwn +++ b/gamemodes/irresistible/cnr/features/stocks/stocks.pwn @@ -54,7 +54,9 @@ enum E_STOCK_SUPA_SAVE, E_STOCK_TRUCKING_COMPANY, E_STOCK_CLUCKIN_BELL, - E_STOCK_PAWN_STORE + E_STOCK_PAWN_STORE, + E_STOCK_CASINO, + E_STOCK_GOVERNMENT }; static stock @@ -80,6 +82,8 @@ hook OnScriptInit( ) CreateStockMarket( E_STOCK_TRUCKING_COMPANY, "The Trucking Company", "TC", 100000.0, 50.0, 250.0 ); // 25m mcap max CreateStockMarket( E_STOCK_CLUCKIN_BELL, "Cluckin' Bell", "CB", 100000.0, 50.0, 250.0 ); // 25m mcap max CreateStockMarket( E_STOCK_PAWN_STORE, "Pawn Store", "PS", 100000.0, 50.0, 250.0 ); // 25m mcap max + CreateStockMarket( E_STOCK_CASINO, "Casino", "CAS", 100000.0, 990.0, 5000.0 ); // 500m mcap max + CreateStockMarket( E_STOCK_GOVERNMENT, "Government", "GOV", 100000.0, 750.0, 5000.0 ); // 500m mcap max return 1; } diff --git a/gamemodes/irresistible/cnr/features/visage/blackjack.pwn b/gamemodes/irresistible/cnr/features/visage/blackjack.pwn index e0e6bd7..832af46 100644 --- a/gamemodes/irresistible/cnr/features/visage/blackjack.pwn +++ b/gamemodes/irresistible/cnr/features/visage/blackjack.pwn @@ -403,6 +403,7 @@ function BeginBlackJackTurn( tableid ) bet_amount += g_blackjackData[ tableid ] [ E_PAYOUT ]; GivePlayerCash( gamerid, -g_blackjackData[ tableid ] [ E_PAYOUT ] ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, g_blackjackData[ tableid ] [ E_PAYOUT ], 0.005 ); DrawPlayerBlackjackCard( tableid, player_index ); if ( cardid < 1 ) { // distribute first two cards to players g_blackjackData[ tableid ] [ E_DRAW_CARD_TIMER ] = SetTimerEx( "DrawPlayerBlackjackCard", BLACKJACK_DEALER_WAIT, false, "dd", tableid, player_index ); @@ -573,6 +574,7 @@ stock CheckForBlackjack( tableid ) GameTextForPlayer( playerid, sprintf( "~n~~n~~y~%s returned!", cash_format( payout ) ), 4000, 3 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCash( playerid, payout ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 ); } else if ( player_score == 21 ) { g_blackjackPlayerState[ tableid ] [ player_index ] = BLACKJACK_STATE_WIN; @@ -585,6 +587,7 @@ stock CheckForBlackjack( tableid ) GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCash( playerid, payout ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 ); } else if ( dealer_score == 21 ) { GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); @@ -604,6 +607,7 @@ stock CheckForBlackjack( tableid ) GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCash( playerid, payout ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 ); } else if ( player_score < dealer_score && dealer_score >= 17 ) { GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); @@ -617,6 +621,7 @@ stock CheckForBlackjack( tableid ) GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCash( playerid, payout ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 ); } // alert world diff --git a/gamemodes/irresistible/cnr/features/visage/poker.pwn b/gamemodes/irresistible/cnr/features/visage/poker.pwn index 7c01325..e7ecd21 100644 --- a/gamemodes/irresistible/cnr/features/visage/poker.pwn +++ b/gamemodes/irresistible/cnr/features/visage/poker.pwn @@ -1980,6 +1980,7 @@ stock CheckShowdown(handle) new w_chips = floatround(float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) * (1.0 - T_POT_FEE_RATE)); new fee_earned = floatround((float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) / 1000.0) * T_POT_FEE_RATE); UpdateServerVariable( "poker_fees", 0, GetGVarFloat( "poker_fees" ) + fee_earned, "", GLOBAL_VARTYPE_FLOAT ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, fee_earned, 0.005 ); GivePlayerCasinoRewardsPoints(high_id, fee_earned, .house_edge = 100.0); SendTableMessage(handle, "{9FCF30}****************************************************************************************"); SendTableMessage(handle, "{9FCF30}Player {FF8000}%s {9FCF30}has won with a {377CC8}%s", ReturnPlayerName(high_id), HAND_RANKS[highest_rank >> 12]); @@ -1995,6 +1996,7 @@ stock CheckShowdown(handle) new w_chips = floatround(float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) * (1.0 - T_POT_FEE_RATE)); new fee_earned = floatround((float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) / 1000.0) * T_POT_FEE_RATE); UpdateServerVariable( "poker_fees", 0, GetGVarFloat( "poker_fees" ) + fee_earned, "", GLOBAL_VARTYPE_FLOAT ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, fee_earned, 0.005 ); new amount = w_chips / count; //new excess = TableData[handle][E_TABLE_POT_CHIPS][pot_id] % count foreach(new p: It_SidepotMembers[_IT[handle][pot_id]]) diff --git a/gamemodes/irresistible/cnr/features/visage/roulette.pwn b/gamemodes/irresistible/cnr/features/visage/roulette.pwn index 879e929..29e670e 100644 --- a/gamemodes/irresistible/cnr/features/visage/roulette.pwn +++ b/gamemodes/irresistible/cnr/features/visage/roulette.pwn @@ -238,6 +238,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) // deduct money GivePlayerCash( playerid, -totalBet ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, totalBet, 0.005 ); // lock the player in p_rouletteBetLocked{ playerid } = true; @@ -678,6 +679,7 @@ public OnRouletteWheelStop( rouletteid, winner ) // bet unlocked and paid GivePlayerCash( playerid, won ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, -won, 0.005 ); p_rouletteBetLocked{ playerid } = false; new diff --git a/gamemodes/irresistible/cnr/features/visage/slot_machines.pwn b/gamemodes/irresistible/cnr/features/visage/slot_machines.pwn index 17b7ced..62bb5f5 100644 --- a/gamemodes/irresistible/cnr/features/visage/slot_machines.pwn +++ b/gamemodes/irresistible/cnr/features/visage/slot_machines.pwn @@ -297,6 +297,7 @@ public OnPlayerUseSlotMachine( playerid, slotid, first_combo, second_combo, thir // give the cash GivePlayerCash( playerid, iNetWin ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, -iNetWin, 0.005 ); PlayerPlaySound( playerid, 4201, 0.0, 0.0, 0.0 ); // Coin fall GameTextForPlayer( playerid, "~w~~h~winner!", 5000, 6 ); return 1; @@ -511,6 +512,7 @@ stock TriggerPlayerSlotMachine( playerid, machineid ) PlayerPlaySound( playerid, 4202, 0.0, 0.0, 0.0 ); ApplyAnimation( playerid, "CASINO", "slot_plyr", 2.0, 0, 1, 1, 0, 0 ); GivePlayerCash( playerid, -entryFee ); + StockMarket_UpdateEarnings( E_STOCK_CASINO, entryFee, 0.005 ); return 1; } return 1; diff --git a/gamemodes/irresistible/cnr/static/player_objects.pwn b/gamemodes/irresistible/cnr/static/player_objects.pwn index 41e63ad..0fc0af9 100644 --- a/gamemodes/irresistible/cnr/static/player_objects.pwn +++ b/gamemodes/irresistible/cnr/static/player_objects.pwn @@ -14526,7 +14526,7 @@ hook OnScriptInit( ) SetDynamicObjectMaterial( tmpVariable, 3, 0, "none", "none", 0 ); tmpVariable = CreateDynamicObject( 8292, -1571.861938, 784.846069, 8.309066, 0.000000, 0.000000, -34.899982, -1, -1, -1 ); SetDynamicObjectMaterial( tmpVariable, 1, 0, "none", "none", 0 ); - SetDynamicObjectMaterialText( tmpVariable, 0, "Fioren & Rose", 120, "Impact", 50, 0, -8003, 0, 1 ); + SetDynamicObjectMaterialText( tmpVariable, 0, "Silent Squad", 120, "Impact", 50, 0, -8003, 0, 1 ); CreateDynamicObject( 3267, -1580.901977, 815.234985, 21.360000, 0.000000, 0.000000, -48.000000, -1, -1, -1 ); CreateDynamicObject( 3069, -1623.957153, 814.621276, 5.559740, 18.200000, 0.000000, 0.000000, -1, -1, -1 ); SetDynamicObjectMaterial( CreateDynamicObject( 18762, -1572.207031, 746.304016, 7.000000, 0.000000, 0.000000, 0.000000, -1, -1, -1 ), 0, 5722, "sunrise01_lawn", "fakestone1_LA", 0 ); diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 72c4a1a..8fdbbf3 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -2542,6 +2542,7 @@ public OnPlayerDeath( playerid, killerid, reason ) GivePlayerCash( killerid, cashEarned ); GivePlayerScore( killerid, 2 ); GivePlayerExperience( killerid, E_POLICE, 0.5 ); + StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, cashEarned, 0.01 ); if ( cashEarned > 20000 ) printf("[police kill] %s -> %s - %s", ReturnPlayerName( killerid ), ReturnPlayerName( playerid ), cash_format( cashEarned ) ); // 8hska7082bmahu if ( p_WantedLevel[ playerid ] > 64 ) SendGlobalMessage( -1, ""COL_GOLD"[POLICE KILL]{FFFFFF} %s(%d) has %s %s(%d) who had a wanted level of %d!", ReturnPlayerName( killerid ), killerid, killedWords[ random( sizeof( killedWords ) ) ], ReturnPlayerName( playerid ), playerid, p_WantedLevel[ playerid ] ); SendClientMessageFormatted( killerid, -1, ""COL_GOLD"[ACHIEVE]{FFFFFF} You have killed %s(%d) with a wanted level of %d; earning you "COL_GOLD"%s{FFFFFF} and 2 score!", ReturnPlayerName( playerid ), playerid, p_WantedLevel[ playerid ], cash_format( cashEarned ) ); @@ -5122,10 +5123,11 @@ CMD:acceptbail( playerid, params[ ] ) else { new - cashEarned = floatround( equa * 0.75 ); + cashEarned = floatround( equa * 0.70 ); GivePlayerCash( playerid, -equa ); GivePlayerCash( p_BailOfferer[ playerid ], cashEarned ); + StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, cashEarned, 0.01 ); SendClientMessageFormatted( p_BailOfferer[ playerid ], -1, ""COL_GREEN"[BAIL]"COL_WHITE" %s(%d) has paid bail. You have earned "COL_GOLD"%s"COL_WHITE" from his bail.", ReturnPlayerName( playerid ), playerid, cash_format( cashEarned ) ); p_BailOfferer[ playerid ] = INVALID_PLAYER_ID; SendServerMessage( playerid, "You have paid for your bail. You are now free!" ); @@ -13380,6 +13382,7 @@ stock ArrestPlayer( victimid, playerid ) GivePlayerScore( playerid, 2 ); GivePlayerExperience( playerid, E_POLICE ); GivePlayerCash( playerid, totalCash ); + StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, totalCash, 0.01 ); if ( totalCash > 20000 ) printf("[police arrest] %s -> %s - %s", ReturnPlayerName( playerid ), ReturnPlayerName( victimid ), cash_format( totalCash ) ); // 8hska7082bmahu SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[ACHIEVE]{FFFFFF} You have earned "COL_GOLD"%s{FFFFFF} dollars and 2 score for arresting %s(%d)!", cash_format( totalCash ), ReturnPlayerName( victimid ), victimid ); GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 );