add mining stock
This commit is contained in:
parent
1d99d05bcb
commit
68fc7ad263
@ -12,10 +12,10 @@
|
|||||||
#include "irresistible\cnr\features\vehicles\_vehicles.pwn"
|
#include "irresistible\cnr\features\vehicles\_vehicles.pwn"
|
||||||
#include "irresistible\cnr\features\business\_business.pwn"
|
#include "irresistible\cnr\features\business\_business.pwn"
|
||||||
#include "irresistible\cnr\features\gangs\_gangs.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\robbery\_robbery.pwn"
|
||||||
#include "irresistible\cnr\features\visage\_visage.pwn"
|
#include "irresistible\cnr\features\visage\_visage.pwn"
|
||||||
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
|
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
|
||||||
#include "irresistible\cnr\features\stocks\_stocks.pwn"
|
|
||||||
|
|
||||||
// other
|
// other
|
||||||
#include "irresistible\cnr\features\shop.pwn"
|
#include "irresistible\cnr\features\shop.pwn"
|
||||||
|
@ -378,6 +378,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
|
|||||||
DestroyDynamicRaceCP( p_MiningExport[ playerid ] );
|
DestroyDynamicRaceCP( p_MiningExport[ playerid ] );
|
||||||
p_MiningExport[ playerid ] = 0xFFFF;
|
p_MiningExport[ playerid ] = 0xFFFF;
|
||||||
GivePlayerCash( playerid, cashEarned );
|
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
|
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 );
|
//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 ) );
|
SendServerMessage( playerid, "You have exported %d rock ore(s) to an industry, earning you "COL_GOLD"%s"COL_WHITE".", oresExported, cash_format( cashEarned ) );
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
/* ** Definitions ** */
|
/* ** Definitions ** */
|
||||||
#define MAX_STOCKS ( 32 )
|
#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)
|
#define STOCK_REPORTING_PERIODS ( 30 ) // last 30 periods (days)
|
||||||
|
|
||||||
@ -35,6 +35,11 @@ enum E_STOCK_MARKET_PRICE_DATA
|
|||||||
Float: E_EARNINGS
|
Float: E_EARNINGS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
E_STOCK_MINING_COMPANY
|
||||||
|
};
|
||||||
|
|
||||||
static stock
|
static stock
|
||||||
g_stockMarketData [ MAX_STOCKS ] [ E_STOCK_MARKET_DATA ],
|
g_stockMarketData [ MAX_STOCKS ] [ E_STOCK_MARKET_DATA ],
|
||||||
g_stockMarketPriceData [ MAX_STOCKS ] [ STOCK_REPORTING_PERIODS ] [ E_STOCK_MARKET_PRICE_DATA ],
|
g_stockMarketPriceData [ MAX_STOCKS ] [ STOCK_REPORTING_PERIODS ] [ E_STOCK_MARKET_PRICE_DATA ],
|
||||||
@ -378,7 +383,7 @@ stock StockMarket_UpdateEarnings( stockid, amount )
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
printf( "Current Earnings: %f, Prior Earnings: %f", g_stockMarketPriceData[ stockid ] [ 0 ] [ E_EARNINGS ], g_stockMarketPriceData[ stockid ] [ 1 ] [ E_EARNINGS ] );
|
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 ] ) );
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user