add mining stock

This commit is contained in:
Lorenc Pekaj 2018-10-28 22:34:48 +11:00
parent 1d99d05bcb
commit 68fc7ad263
3 changed files with 9 additions and 3 deletions

View File

@ -12,10 +12,10 @@
#include "irresistible\cnr\features\vehicles\_vehicles.pwn"
#include "irresistible\cnr\features\business\_business.pwn"
#include "irresistible\cnr\features\gangs\_gangs.pwn"
#include "irresistible\cnr\features\stocks\_stocks.pwn"
#include "irresistible\cnr\features\robbery\_robbery.pwn"
#include "irresistible\cnr\features\visage\_visage.pwn"
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
#include "irresistible\cnr\features\stocks\_stocks.pwn"
// other
#include "irresistible\cnr\features\shop.pwn"

View File

@ -378,6 +378,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
DestroyDynamicRaceCP( p_MiningExport[ playerid ] );
p_MiningExport[ playerid ] = 0xFFFF;
GivePlayerCash( playerid, cashEarned );
StockMarket_UpdateEarnings( E_STOCK_MINING_COMPANY, cashEarned );
GivePlayerScore( playerid, floatround( oresExported / 2 ) ); // 16 score is a bit too much for ore... so half that = 8
//GivePlayerExperience( playerid, E_MINING, float( oresExported ) * 0.2 );
SendServerMessage( playerid, "You have exported %d rock ore(s) to an industry, earning you "COL_GOLD"%s"COL_WHITE".", oresExported, cash_format( cashEarned ) );

View File

@ -11,7 +11,7 @@
/* ** Definitions ** */
#define MAX_STOCKS ( 32 )
#define STOCK_REPORTING_PERIOD ( 500 ) // 1 day
#define STOCK_REPORTING_PERIOD ( 600 ) // 1 day
#define STOCK_REPORTING_PERIODS ( 30 ) // last 30 periods (days)
@ -35,6 +35,11 @@ enum E_STOCK_MARKET_PRICE_DATA
Float: E_EARNINGS
};
enum
{
E_STOCK_MINING_COMPANY
};
static stock
g_stockMarketData [ MAX_STOCKS ] [ E_STOCK_MARKET_DATA ],
g_stockMarketPriceData [ MAX_STOCKS ] [ STOCK_REPORTING_PERIODS ] [ E_STOCK_MARKET_PRICE_DATA ],
@ -378,7 +383,7 @@ stock StockMarket_UpdateEarnings( stockid, amount )
return 0;
printf( "Current Earnings: %f, Prior Earnings: %f", g_stockMarketPriceData[ stockid ] [ 0 ] [ E_EARNINGS ], g_stockMarketPriceData[ stockid ] [ 1 ] [ E_EARNINGS ] );
g_stockMarketPriceData[ stockid ] [ 0 ] [ E_EARNINGS ] += amount;
g_stockMarketPriceData[ stockid ] [ 0 ] [ E_EARNINGS ] += float( amount );
mysql_single_query( sprintf( "UPDATE `STOCK_REPORTS` SET `CURRENT_EARNINGS` = `CURRENT_EARNINGS` + %d WHERE `ID` = %d", g_stockMarketPriceData[ stockid ] [ 0 ] [ E_EARNINGS ], g_stockMarketPriceData[ stockid ] [ 0 ] [ E_SQL_ID ] ) );
return 1;
}