move player market cmds to /ic
This commit is contained in:
parent
f81d656161
commit
556a008573
@ -30,10 +30,10 @@
|
||||
#define DIALOG_VEHICLE_SPAWN 1018
|
||||
#define DIALOG_ARENAS 1019
|
||||
#define DIALOG_BOUGHT_VEH 1020
|
||||
#define DIALOG_PERKS 1021
|
||||
#define DIALOG_PERKS_P 1022
|
||||
//#define DIALOG_PERKS 1021
|
||||
//#define DIALOG_PERKS_P 1022
|
||||
#define DIALOG_VIP 1023
|
||||
#define DIALOG_PERKS_V 1024
|
||||
//#define DIALOG_PERKS_V 1024
|
||||
#define DIALOG_DONATED 1025
|
||||
#define DIALOG_VEHICLE_LOCATE 1026
|
||||
#define DIALOG_GANG_COLOR 1027
|
||||
|
@ -120,14 +120,6 @@ CMD:level( playerid, params[ ] )
|
||||
return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST_HEADERS, sprintf( "{FFFFFF}Player Level - Total Level %d", player_total_lvl ), szLargeString, "Close", "" );
|
||||
}
|
||||
|
||||
|
||||
CMD:givelevel( playerid, params[ ] ) {
|
||||
new rank, Float: xp;
|
||||
sscanf( params, "df", rank, xp );
|
||||
GivePlayerExperience( playerid, E_LEVELS: rank, xp );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ** SQL Threads ** */
|
||||
thread Experience_OnLoad( playerid )
|
||||
{
|
||||
@ -164,7 +156,7 @@ stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0,
|
||||
new Float: next_rank_xp = ( g_levelData[ _: level ] [ E_MAX_UNITS ] * g_levelData[ _: level ] [ E_XP_DILATION ] ) / ( EXP_MAX_PLAYER_LEVEL * EXP_MAX_PLAYER_LEVEL ) * float( next_rank * next_rank );
|
||||
|
||||
if ( g_playerExperience[ playerid ] [ level ] + xp_earned >= next_rank_xp ) {
|
||||
ShowPlayerHelpDialog( playerid, 10000, "~g~~h~Congratulations!~n~~n~~w~Your %s Level is now ~y~%d.", g_levelData[ _: level ] [ E_NAME ], next_rank );
|
||||
ShowPlayerHelpDialog( playerid, 10000, "~y~~h~Congratulations!~n~~n~~w~Your %s Level is now ~y~%d.", g_levelData[ _: level ] [ E_NAME ], next_rank );
|
||||
if ( !IsPlayerUsingRadio( playerid ) ) PlayAudioStreamForPlayer( playerid, "http://files.sfcnr.com/game_sounds/levelup.mp3" );
|
||||
}
|
||||
|
||||
@ -179,11 +171,12 @@ stock GivePlayerExperience( playerid, E_LEVELS: level, Float: default_xp = 1.0,
|
||||
SetTimerEx( "Experience_HideIncrementTD", 3500, false, "d", playerid );
|
||||
|
||||
// save to database
|
||||
mysql_format(
|
||||
dbHandle, szBigString, sizeof( szBigString ),
|
||||
format(
|
||||
szBigString, sizeof( szBigString ),
|
||||
"INSERT INTO `USER_LEVELS` (`USER_ID`,`LEVEL_ID`,`EXPERIENCE`) VALUES(%d,%d,%d) ON DUPLICATE KEY UPDATE `EXPERIENCE`=%d",
|
||||
GetPlayerAccountID( playerid ), _: level, g_playerExperience[ playerid ] [ level ], g_playerExperience[ playerid ] [ level ]
|
||||
);
|
||||
mysql_single_query( szBigString );
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -191,12 +184,12 @@ function Experience_HideIncrementTD( playerid ) {
|
||||
return PlayerTextDrawHide( playerid, p_ExperienceAwardTD[ playerid ] );
|
||||
}
|
||||
|
||||
stock GetPlayerTotalLevel( playerid, &level = 0 ) {
|
||||
/*stock GetPlayerTotalLevel( playerid, &level = 0 ) {
|
||||
for ( new l = 0; l < sizeof ( g_levelData ); l ++ ) {
|
||||
level += floatround( GetPlayerLevel( playerid, E_LEVELS: l ), floatround_floor );
|
||||
}
|
||||
return level;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* ** Migrations ** */
|
||||
/*
|
||||
|
@ -70,6 +70,7 @@ static stock
|
||||
{ "{8ADE47}Stephanie:"COL_WHITE" Contribute to our feature "COL_GREY"/crowdfunds"COL_WHITE"! Early supporters get benefits!" },
|
||||
{ "{8ADE47}Stephanie:"COL_WHITE" Don't want to be interrupted as an innocent player? Enter passive mode with "COL_GREY"/passive"COL_WHITE"!" },
|
||||
{ "{8ADE47}Stephanie:"COL_WHITE" You can buy premium player homes using "COL_GREY"/estate"COL_WHITE"!" }
|
||||
{ "{8ADE47}Stephanie:"COL_WHITE" You can buy Irresistible Coins from players using "COL_GREY"/ic buy"COL_WHITE"!" }
|
||||
},
|
||||
g_randomMessageTick = 0
|
||||
;
|
||||
|
@ -59,19 +59,22 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
}
|
||||
|
||||
/* ** Commands ** */
|
||||
CMD:sellcoins( playerid, params[ ] )
|
||||
hook cmd_ic( playerid, params[ ] )
|
||||
{
|
||||
if ( ! IsPlayerSecurityVerified( playerid ) )
|
||||
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
|
||||
if ( ! IsPlayerSecurityVerified( playerid ) ) {
|
||||
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" ), Y_HOOKS_BREAK_RETURN_1;
|
||||
}
|
||||
|
||||
if ( !strcmp( params, "sell", true, 4 ) )
|
||||
{
|
||||
new
|
||||
Float: quantity, price;
|
||||
|
||||
if ( GetPlayerVIPLevel( playerid ) < VIP_BRONZE ) return SendError( playerid, "You are not a Bronze V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
|
||||
else if ( sscanf( params, "df", price, quantity ) ) return SendUsage( playerid, "/sellcoins [PRICE_PER_COIN] [COINS]" );
|
||||
else if ( quantity < 10.0 ) return SendError( playerid, "The minimum amount you can sell is 10.0 Irresistible Coins." );
|
||||
else if ( quantity > GetPlayerIrresistibleCoins( playerid ) ) return SendError( playerid, "You do not have this many Irresistible Coins." );
|
||||
else if ( ! ( 1000 <= price <= 125000 )) return SendError( playerid, "Selling price must be between $1,000 and $125,000 per coin." );
|
||||
if ( GetPlayerVIPLevel( playerid ) < VIP_BRONZE ) SendError( playerid, "You are not a Bronze V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
|
||||
else if ( sscanf( params[ 5 ], "fd", quantity, price ) ) SendUsage( playerid, "/ic sell [COINS] [PRICE_PER_COIN]" );
|
||||
else if ( quantity < 1.0 ) SendError( playerid, "The minimum amount you can sell is 1.0 Irresistible Coins." );
|
||||
else if ( quantity > GetPlayerIrresistibleCoins( playerid ) ) SendError( playerid, "You do not have this many Irresistible Coins." );
|
||||
else if ( ! ( 1000 <= price <= 125000 )) SendError( playerid, "Selling price must be between $1,000 and $125,000 per coin." );
|
||||
else
|
||||
{
|
||||
new
|
||||
@ -86,27 +89,21 @@ CMD:sellcoins( playerid, params[ ] )
|
||||
mysql_single_query( szBigString );
|
||||
|
||||
// deduct the coins
|
||||
SendServerMessage( playerid, "Sell order for %s Irresistible Coins (at %s/IC) has been placed. Cancel via /cancelorders.", number_format( quantity, .decimals = 3 ), cash_format( price ) );
|
||||
SendServerMessage( playerid, "Sell order for %s Irresistible Coins (at %s/IC) has been placed. Cancel via "COL_GREY"/ic cancel"COL_WHITE".", number_format( quantity, .decimals = 3 ), cash_format( price ) );
|
||||
GivePlayerIrresistibleCoins( playerid, -quantity );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMD:buycoins( playerid, params[ ] )
|
||||
{
|
||||
if ( ! IsPlayerSecurityVerified( playerid ) )
|
||||
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
|
||||
|
||||
return Y_HOOKS_BREAK_RETURN_1;
|
||||
}
|
||||
else if ( strmatch( params, "buy" ) )
|
||||
{
|
||||
ShowPlayerCoinSellOrders( playerid );
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMD:cancelorders( playerid, params[ ] )
|
||||
{
|
||||
if ( ! IsPlayerSecurityVerified( playerid ) )
|
||||
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
|
||||
|
||||
return Y_HOOKS_BREAK_RETURN_1;
|
||||
}
|
||||
else if ( strmatch( params, "cancel" ) )
|
||||
{
|
||||
mysql_tquery( dbHandle, sprintf( "SELECT * FROM `IC_SELL_ORDERS` WHERE `USER_ID` = %d", GetPlayerAccountID( playerid ) ), "PlayerMarket_OnCancelOrders", "d", playerid );
|
||||
return Y_HOOKS_BREAK_RETURN_1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -122,7 +119,7 @@ thread PlayerMarket_OnShowSellOrders( playerid )
|
||||
seller[ 24 ];
|
||||
|
||||
// set headers
|
||||
szHugeString = ""COL_GREY"Player\t"COL_GREY"Quantity Available\t"COL_GREY"Price Per Coin\n";
|
||||
szHugeString = ""COL_GREY"Player\t"COL_GREY"Quantity Available (IC)\t"COL_GREY"Price Per Coin ($)\n";
|
||||
|
||||
for ( new row = 0; row < sizeof ( p_PlayerMarket_SellOrders[ ] ); row ++ )
|
||||
{
|
||||
|
@ -6561,7 +6561,7 @@ CMD:irresistiblecoins( playerid, params[ ] )
|
||||
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED )
|
||||
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
|
||||
|
||||
if ( isnull( params ) )
|
||||
if ( strmatch( params, "balance" ) )
|
||||
{
|
||||
return SendServerMessage( playerid, "You currently have precisely "COL_GOLD"%s"COL_WHITE" Irresistible Coins!", number_format( p_IrresistibleCoins[ playerid ] ) );
|
||||
}
|
||||
@ -6598,7 +6598,7 @@ CMD:irresistiblecoins( playerid, params[ ] )
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return SendUsage( playerid, "/irresistiblecoins [MARKET/SEND] "COL_GREY"(type /irresistiblecoins to see your coins)" );
|
||||
return SendUsage( playerid, "/irresistiblecoins [BALANCE/BUY/SELL/MARKET/SEND/CANCEL]" );
|
||||
}
|
||||
|
||||
CMD:top( playerid, params[ ] ) return cmd_highscores( playerid, params );
|
||||
@ -7797,7 +7797,7 @@ CMD:mech( playerid, params[ ] )
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
RepairVehicle( iVehicle );
|
||||
SendServerMessage( playerid, "You have repaired this vehicle." );
|
||||
p_AntiMechFixSpam[ playerid ] = g_itime + 5;
|
||||
p_AntiMechFixSpam[ playerid ] = g_iTime + 5;
|
||||
GivePlayerCash( playerid, -cost );
|
||||
}
|
||||
else if ( strmatch( params, "nos" ) )
|
||||
@ -8235,7 +8235,7 @@ thread OnPlayerWeeklyTime( playerid, irc, player[ ] )
|
||||
|
||||
CMD:xpmarket( playerid, params[ ] )
|
||||
{
|
||||
ShowPlayerDialog( playerid, DIALOG_XPMARKET, DIALOG_STYLE_INPUT, "{FFFFFF}XP Market", sprintf( ""COL_WHITE"You have %d legacy XP. Current exchange rate is $10 per XP.\n\nHow many would you like to exchange?", p_XP[ playerid ] ), "Select", "Cancel");
|
||||
ShowPlayerDialog( playerid, DIALOG_XPMARKET, DIALOG_STYLE_INPUT, "{FFFFFF}XP Market", sprintf( ""COL_WHITE"You have %s legacy XP. Current exchange rate is $10 per XP.\n\nHow many would you like to exchange?", number_format( p_XP[ playerid ] ) ), "Select", "Cancel");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -8381,7 +8381,7 @@ CMD:label( playerid, params[ ] )
|
||||
szLabel[ 32 ]
|
||||
;
|
||||
|
||||
if ( p_XP[ playerid ] < 3500 ) return SendError( playerid, "You need 3,500 XP to use this command." );
|
||||
if ( GetPlayerScore( playerid ) < 500 ) return SendError( playerid, "You need 500 score to use this command." );
|
||||
else if ( sscanf( params, "s[32]", szLabel ) ) return SendUsage( playerid, "/label [MESSAGE]" );
|
||||
else
|
||||
{
|
||||
@ -12043,21 +12043,24 @@ stock approveClassSpawned( playerid ) {
|
||||
if ( p_WantedLevel[ playerid ] > 0 && ( IsPlayerPolice( playerid ) || IsPlayerFBI( playerid ) || IsPlayerCIA( playerid ) || GetPlayerSkin( playerid ) == 287 ) )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You must not have a wanted level to use this class." ), 0;
|
||||
|
||||
// get player total experience
|
||||
new Float: total_experience = GetPlayerTotalExperience( playerid );
|
||||
|
||||
// bought xp
|
||||
if ( IsPlayerFBI( playerid ) && p_XP[ playerid ] < 10000 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 10,000 XP to use this class." ), 0;
|
||||
if ( IsPlayerFBI( playerid ) && total_experience < 10000.0 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 10,000 Total XP to use this class." ), 0;
|
||||
|
||||
if ( IsPlayerArmy( playerid ) && p_XP[ playerid ] < 20000 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 20,000 XP to use this class." ), 0;
|
||||
if ( IsPlayerArmy( playerid ) && total_experience < 20000.0 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 20,000 Total XP to use this class." ), 0;
|
||||
|
||||
if ( IsPlayerCIA( playerid ) && p_XP[ playerid ] < 15000 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 15,000 XP to use this class." ), 0;
|
||||
if ( IsPlayerCIA( playerid ) && total_experience < 15000.0 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 15,000 Total XP to use this class." ), 0;
|
||||
|
||||
if ( IsPlayerFireman( playerid ) && p_XP[ playerid ] < 1000 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 1,000 XP to use this class." ), 0;
|
||||
if ( IsPlayerFireman( playerid ) && total_experience < 1000.0 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 1,000 Total XP to use this class." ), 0;
|
||||
|
||||
if ( IsPlayerMedic( playerid ) && p_XP[ playerid ] < 2000 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 2,000 XP to use this class." ), 0;
|
||||
if ( IsPlayerMedic( playerid ) && total_experience < 2000.0 )
|
||||
return SendClientMessage( playerid, -1, ""COL_RED"[ERROR]"COL_WHITE" You need 2,000 Total XP to use this class." ), 0;
|
||||
|
||||
// job not set
|
||||
if ( !p_JobSet{ playerid } ) // || !p_CitySet{ playerid } )
|
||||
@ -14197,7 +14200,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if ( ( dialogid == DIALOG_PERKS ) && response )
|
||||
/*if ( ( dialogid == DIALOG_PERKS ) && response )
|
||||
{
|
||||
switch( listitem )
|
||||
{
|
||||
@ -14293,7 +14296,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
else return SendError( playerid, "You don't have enough XP for this." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if ( dialogid == DIALOG_CASINO_REWARDS && response )
|
||||
{
|
||||
if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." );
|
||||
|
Loading…
Reference in New Issue
Block a user