Add government and casino stocks.

This commit is contained in:
Lorenc Pekaj 2018-11-05 10:23:38 +11:00
parent f503224775
commit baed9eb28c
9 changed files with 23 additions and 4 deletions

View File

@ -282,7 +282,7 @@ hook OnVehicleDeath( vehicleid, killerid )
GivePlayerScore( killerid, 2 ); GivePlayerScore( killerid, 2 );
GivePlayerCash( killerid, payout ); GivePlayerCash( killerid, payout );
if ( p_Class[ killerid ] != CLASS_POLICE ) GivePlayerWantedLevel( killerid, 6 ), GivePlayerExperience( killerid, E_ROBBERY ); 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 ) ); 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 ) );
} }
} }

View File

@ -94,6 +94,7 @@ hook OnPlayerUpdateEx( playerid )
GivePlayerScore( playerid, 2 ); GivePlayerScore( playerid, 2 );
//GivePlayerExperience( playerid, E_FIREMAN ); //GivePlayerExperience( playerid, E_FIREMAN );
GivePlayerCash( playerid, FIRE_EXTINGUISH_PAYOUT ); GivePlayerCash( playerid, FIRE_EXTINGUISH_PAYOUT );
StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, FIRE_EXTINGUISH_PAYOUT, 0.01 );
HouseFire_Remove( i ); HouseFire_Remove( i );
} }
return 1; return 1;

View File

@ -54,7 +54,9 @@ enum
E_STOCK_SUPA_SAVE, E_STOCK_SUPA_SAVE,
E_STOCK_TRUCKING_COMPANY, E_STOCK_TRUCKING_COMPANY,
E_STOCK_CLUCKIN_BELL, E_STOCK_CLUCKIN_BELL,
E_STOCK_PAWN_STORE E_STOCK_PAWN_STORE,
E_STOCK_CASINO,
E_STOCK_GOVERNMENT
}; };
static stock 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_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_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_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; return 1;
} }

View File

@ -403,6 +403,7 @@ function BeginBlackJackTurn( tableid )
bet_amount += g_blackjackData[ tableid ] [ E_PAYOUT ]; bet_amount += g_blackjackData[ tableid ] [ E_PAYOUT ];
GivePlayerCash( gamerid, -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 ); DrawPlayerBlackjackCard( tableid, player_index );
if ( cardid < 1 ) { // distribute first two cards to players 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 ); 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 ); GameTextForPlayer( playerid, sprintf( "~n~~n~~y~%s returned!", cash_format( payout ) ), 4000, 3 );
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
GivePlayerCash( playerid, payout ); GivePlayerCash( playerid, payout );
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
} }
else if ( player_score == 21 ) { else if ( player_score == 21 ) {
g_blackjackPlayerState[ tableid ] [ player_index ] = BLACKJACK_STATE_WIN; 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 ); GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 );
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
GivePlayerCash( playerid, payout ); GivePlayerCash( playerid, payout );
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
} }
else if ( dealer_score == 21 ) { else if ( dealer_score == 21 ) {
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); 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 ); GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 );
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
GivePlayerCash( playerid, payout ); GivePlayerCash( playerid, payout );
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
} }
else if ( player_score < dealer_score && dealer_score >= 17 ) { else if ( player_score < dealer_score && dealer_score >= 17 ) {
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); 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 ); GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 );
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 ); GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
GivePlayerCash( playerid, payout ); GivePlayerCash( playerid, payout );
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
} }
// alert world // alert world

View File

@ -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 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); 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 ); 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); GivePlayerCasinoRewardsPoints(high_id, fee_earned, .house_edge = 100.0);
SendTableMessage(handle, "{9FCF30}****************************************************************************************"); SendTableMessage(handle, "{9FCF30}****************************************************************************************");
SendTableMessage(handle, "{9FCF30}Player {FF8000}%s {9FCF30}has won with a {377CC8}%s", ReturnPlayerName(high_id), HAND_RANKS[highest_rank >> 12]); 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 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); 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 ); 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 amount = w_chips / count;
//new excess = TableData[handle][E_TABLE_POT_CHIPS][pot_id] % count //new excess = TableData[handle][E_TABLE_POT_CHIPS][pot_id] % count
foreach(new p: It_SidepotMembers[_IT[handle][pot_id]]) foreach(new p: It_SidepotMembers[_IT[handle][pot_id]])

View File

@ -238,6 +238,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
// deduct money // deduct money
GivePlayerCash( playerid, -totalBet ); GivePlayerCash( playerid, -totalBet );
StockMarket_UpdateEarnings( E_STOCK_CASINO, totalBet, 0.005 );
// lock the player in // lock the player in
p_rouletteBetLocked{ playerid } = true; p_rouletteBetLocked{ playerid } = true;
@ -678,6 +679,7 @@ public OnRouletteWheelStop( rouletteid, winner )
// bet unlocked and paid // bet unlocked and paid
GivePlayerCash( playerid, won ); GivePlayerCash( playerid, won );
StockMarket_UpdateEarnings( E_STOCK_CASINO, -won, 0.005 );
p_rouletteBetLocked{ playerid } = false; p_rouletteBetLocked{ playerid } = false;
new new

View File

@ -297,6 +297,7 @@ public OnPlayerUseSlotMachine( playerid, slotid, first_combo, second_combo, thir
// give the cash // give the cash
GivePlayerCash( playerid, iNetWin ); GivePlayerCash( playerid, iNetWin );
StockMarket_UpdateEarnings( E_STOCK_CASINO, -iNetWin, 0.005 );
PlayerPlaySound( playerid, 4201, 0.0, 0.0, 0.0 ); // Coin fall PlayerPlaySound( playerid, 4201, 0.0, 0.0, 0.0 ); // Coin fall
GameTextForPlayer( playerid, "~w~~h~winner!", 5000, 6 ); GameTextForPlayer( playerid, "~w~~h~winner!", 5000, 6 );
return 1; return 1;
@ -511,6 +512,7 @@ stock TriggerPlayerSlotMachine( playerid, machineid )
PlayerPlaySound( playerid, 4202, 0.0, 0.0, 0.0 ); PlayerPlaySound( playerid, 4202, 0.0, 0.0, 0.0 );
ApplyAnimation( playerid, "CASINO", "slot_plyr", 2.0, 0, 1, 1, 0, 0 ); ApplyAnimation( playerid, "CASINO", "slot_plyr", 2.0, 0, 1, 1, 0, 0 );
GivePlayerCash( playerid, -entryFee ); GivePlayerCash( playerid, -entryFee );
StockMarket_UpdateEarnings( E_STOCK_CASINO, entryFee, 0.005 );
return 1; return 1;
} }
return 1; return 1;

View File

@ -14526,7 +14526,7 @@ hook OnScriptInit( )
SetDynamicObjectMaterial( tmpVariable, 3, 0, "none", "none", 0 ); 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 ); 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 ); 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( 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 ); 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 ); 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 );

View File

@ -2542,6 +2542,7 @@ public OnPlayerDeath( playerid, killerid, reason )
GivePlayerCash( killerid, cashEarned ); GivePlayerCash( killerid, cashEarned );
GivePlayerScore( killerid, 2 ); GivePlayerScore( killerid, 2 );
GivePlayerExperience( killerid, E_POLICE, 0.5 ); 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 ( 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 ] ); 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 ) ); 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 else
{ {
new new
cashEarned = floatround( equa * 0.75 ); cashEarned = floatround( equa * 0.70 );
GivePlayerCash( playerid, -equa ); GivePlayerCash( playerid, -equa );
GivePlayerCash( p_BailOfferer[ playerid ], cashEarned ); 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 ) ); 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; p_BailOfferer[ playerid ] = INVALID_PLAYER_ID;
SendServerMessage( playerid, "You have paid for your bail. You are now free!" ); SendServerMessage( playerid, "You have paid for your bail. You are now free!" );
@ -13380,6 +13382,7 @@ stock ArrestPlayer( victimid, playerid )
GivePlayerScore( playerid, 2 ); GivePlayerScore( playerid, 2 );
GivePlayerExperience( playerid, E_POLICE ); GivePlayerExperience( playerid, E_POLICE );
GivePlayerCash( playerid, totalCash ); 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 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 ); 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 ); GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 );