move more code associated with vip to its own appropriate modules

This commit is contained in:
Lorenc Pekaj 2018-12-23 10:58:03 +11:00
parent f98f25ba8c
commit 4b79a5eba3
10 changed files with 199 additions and 128 deletions

View File

@ -11,9 +11,13 @@
- Called when a player is attempting to be respawned somewhere randomly - Called when a player is attempting to be respawned somewhere randomly
- `public OnServerUpdate( )` - `public OnServerUpdate( )`
- Called every second (or sooner) indefinitely - Called every second (or sooner) indefinitely
- `public OnServerTickSecond( )`
- Called every second (specifically) indefinitely
- `public OnPlayerUpdateEx( playerid )` - `public OnPlayerUpdateEx( playerid )`
- Same interval as OnServerUpdate, but it is called indefinitely for every player in-game - Same interval as OnServerUpdate, but it is called indefinitely for every player in-game
- When you wish to update something frequently, but not use OnPlayerUpdate - When you wish to update something frequently, but not use OnPlayerUpdate
- `public OnPlayerTickSecond( playerid )`
- Called every second (specifically a second) for a player, indefinitely
- `OnServerGameDayEnd( )` - `OnServerGameDayEnd( )`
- Called every 24 minutes in-game (basically when a new day starts) - Called every 24 minutes in-game (basically when a new day starts)
- `OnNpcConnect( npcid )` - `OnNpcConnect( npcid )`

View File

@ -21,7 +21,6 @@
#define MAX_ROULETTE_TABLES 30 #define MAX_ROULETTE_TABLES 30
/* ** Macros ** */ /* ** Macros ** */
#define IsPlayerOnRoulette(%0) (p_RouletteTable[%0]!=-1)
#define IsRedRouletteNumber(%0) (%0 == 1 || %0 == 3 || %0 == 5 || %0 == 7 || %0 == 9 || %0 == 12 || %0 == 14 || %0 == 16 || %0 == 18 || %0 == 19 || %0 == 21 || %0 == 23 || %0 == 25 || %0 == 27 || %0 == 30 || %0 == 32 || %0 == 34 || %0 == 36) #define IsRedRouletteNumber(%0) (%0 == 1 || %0 == 3 || %0 == 5 || %0 == 7 || %0 == 9 || %0 == 12 || %0 == 14 || %0 == 16 || %0 == 18 || %0 == 19 || %0 == 21 || %0 == 23 || %0 == 25 || %0 == 27 || %0 == 30 || %0 == 32 || %0 == 34 || %0 == 36)
/* ** Constants ** */ /* ** Constants ** */
@ -921,3 +920,7 @@ stock ConvertRouletteChipValue( value ) {
} }
return string; return string;
} }
stock IsPlayerOnRoulette( playerid ) {
return p_RouletteTable[ playerid ] != -1;
}

View File

@ -13,9 +13,6 @@
#define MAX_SLOT_POOLS ( 3 ) #define MAX_SLOT_POOLS ( 3 )
#define POOL_ENTITIES ( 5 ) #define POOL_ENTITIES ( 5 )
/* ** Macros ** */
#define IsPlayerOnSlotMachine(%0) ( p_usingSlotMachine[ %0 ] != -1 )
/* ** Constants ** */ /* ** Constants ** */
enum E_SLOT_ODD_DATA enum E_SLOT_ODD_DATA
{ {
@ -756,3 +753,7 @@ stock StopPlayerUsingSlotMachine( playerid )
TogglePlayerControllable( playerid, 1 ); TogglePlayerControllable( playerid, 1 );
return 1; return 1;
} }
stock IsPlayerOnSlotMachine( playerid ) {
return p_usingSlotMachine[ playerid ] != -1;
}

View File

@ -31,8 +31,6 @@ new
bool: g_Debugging = false, bool: g_Debugging = false,
bool: g_Driveby = false, bool: g_Driveby = false,
bool: g_VipPrivateMsging = false, bool: g_VipPrivateMsging = false,
bool: g_HappyHour = false,
Float: g_HappyHourRate = 0.0,
g_iTime = 0, g_iTime = 0,
g_VehicleLastAttacker [ MAX_VEHICLES ] = { INVALID_PLAYER_ID, ... }, g_VehicleLastAttacker [ MAX_VEHICLES ] = { INVALID_PLAYER_ID, ... },
g_VehicleLastAttacked [ MAX_VEHICLES ], g_VehicleLastAttacked [ MAX_VEHICLES ],

View File

@ -6,6 +6,7 @@
*/ */
/* ** Includes ** */ /* ** Includes ** */
#include "irresistible\cnr\vip\vip.pwn" #include "irresistible\cnr\vip\coin_market.pwn"
#include "irresistible\cnr\vip\coin_generation.pwn"
#include "irresistible\cnr\vip\redeem_code.pwn" #include "irresistible\cnr\vip\redeem_code.pwn"
#include "irresistible\cnr\vip\player_market.pwn" #include "irresistible\cnr\vip\player_market.pwn"

View File

@ -0,0 +1,94 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc
* Module: cnr\vip\happy_hour.pwn
* Purpose: coin generation ("proof of playing") mechanism
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined __cnr__irresistiblecoins
#endinput
#endif
/* ** Variables ** */
static stock
bool: g_HappyHour = false,
Float: g_HappyHourRate = 0.0
;
/* ** Hooks ** */
hook OnServerUpdate( )
{
new Float: fLastRate;
new playersOnline = Iter_Count(Player);
// Happy Hour
if ( ( g_HappyHour = playersOnline <= 20 ) == true ) {
// Maximum of 25% decrease
g_HappyHourRate = 0.25 - ( playersOnline / 80.0 );
// Only update colors if neccessary
if ( fLastRate != g_HappyHourRate )
{
TextDrawSetString( g_NotManyPlayersTD, sprintf( "Coin generation increased by %0.1f%% as there aren't many players online!", g_HappyHourRate * 100.0 ) );
TextDrawColor( g_NotManyPlayersTD, setAlpha( COLOR_RED, floatround( 200.0 - 10.0 * float( playersOnline ) ) ) );
TextDrawShowForAllSpawned( g_NotManyPlayersTD );
}
// Update last rate
fLastRate = g_HappyHourRate;
} else {
// Disable Color
g_HappyHourRate = 0.0;
TextDrawColor( g_NotManyPlayersTD, 0 );
TextDrawHideForAll( g_NotManyPlayersTD );
}
return 1;
}
hook OnPlayerTickSecond( playerid )
{
static
iKeys, iUpDownKeys, iLeftRightKeys;
// Increase Irresistible Coins (1/20 = cred/min)
if ( ! IsPlayerAFK( playerid ) && GetPlayerKeys( playerid, iKeys, iUpDownKeys, iLeftRightKeys ) && ! IsPlayerOnRoulette( playerid ) && ! IsPlayerOnSlotMachine( playerid ) && GetPlayerVehicleSeat( playerid ) <= 0 )
{
if ( iKeys != 0 || iUpDownKeys != 0 || iLeftRightKeys != 0 ) { // GetPlayerScore( playerid ) > 10 &&
new
Float: iCoinGenRate = 35.0;
// VIP check
if ( p_VIPLevel[ playerid ] >= VIP_DIAMOND )
iCoinGenRate *= 0.75; // Reduce by 25% if Diamond
else if ( p_VIPLevel[ playerid ] == VIP_PLATINUM )
iCoinGenRate *= 0.90; // Reduce by 10% if Diamond
// Happy Hour
if ( g_HappyHour && ( 0.0 <= g_HappyHourRate <= 0.25 ) )
iCoinGenRate *= 1.0 - g_HappyHourRate;
p_IrresistibleCoins[ playerid ] += ( 1.0 / iCoinGenRate ) / 60.0; // Prev 25.92
}
}
return 1;
}
hook OnPlayerLoadTextdraws( playerid ) {
if ( g_HappyHour ) {
TextDrawShowForPlayer( playerid, g_NotManyPlayersTD );
}
return 1;
}
hook OnPlayerUnloadTextdraws( playerid ) {
TextDrawHideForPlayer( playerid, g_NotManyPlayersTD );
return 1;
}
/* ** Functions ** */

View File

@ -1,13 +1,23 @@
/* /*
* Irresistible Gaming (c) 2018 * Irresistible Gaming (c) 2018
* Developed by Lorenc * Developed by Lorenc
* Module: vip.inc * Module: cnr\vip\coin_market.pwn
* Purpose: vip associated information * Purpose: coin market associated information
*/ */
/* ** Includes ** */ /* ** Includes ** */
#include < YSI\y_hooks > #include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined __cnr__irresistiblecoins
#define __cnr__irresistiblecoins
#endif
/* ** Settings ** */
#define VIP_ALLOW_OVER_LIMIT ( true ) // allow player from using house/vehicle/garage cmds if over the limit
#define VIP_MAX_EXTRA_SLOTS ( 5 ) // max extra slots a person can buy
/* ** Macros ** */ /* ** Macros ** */
#define GetPlayerIrresistibleCoins(%0) \ #define GetPlayerIrresistibleCoins(%0) \
(p_IrresistibleCoins[%0]) (p_IrresistibleCoins[%0])
@ -15,20 +25,20 @@
#define GivePlayerIrresistibleCoins(%0,%1) \ #define GivePlayerIrresistibleCoins(%0,%1) \
(p_IrresistibleCoins[%0] += %1) (p_IrresistibleCoins[%0] += %1)
/* ** Definitions ** */ /* ** Coin Market VIP Levels ** */
#define VIP_MAX_EXTRA_SLOTS 5
#define ICM_PAGE_DEFAULT ( 0 )
#define ICM_PAGE_CASHCARD ( 1 )
#define ICM_PAGE_ASSETS ( 2 )
//#define ICM_PAGE_UPGRADE ( 3 )
#define VIP_REGULAR ( 1 ) #define VIP_REGULAR ( 1 )
#define VIP_BRONZE ( 2 ) #define VIP_BRONZE ( 2 )
#define VIP_GOLD ( 3 ) #define VIP_GOLD ( 3 )
#define VIP_PLATINUM ( 4 ) #define VIP_PLATINUM ( 4 )
#define VIP_DIAMOND ( 5 ) #define VIP_DIAMOND ( 5 )
/* ** Coin Market Pages ** */
#define ICM_PAGE_DEFAULT ( 0 )
#define ICM_PAGE_CASHCARD ( 1 )
#define ICM_PAGE_ASSETS ( 2 )
//#define ICM_PAGE_UPGRADE ( 3 )
/* ** Coin Market Items ** */
#define ICM_COKE_BIZ ( 0 ) #define ICM_COKE_BIZ ( 0 )
#define ICM_METH_BIZ ( 1 ) #define ICM_METH_BIZ ( 1 )
#define ICM_WEED_BIZ ( 2 ) #define ICM_WEED_BIZ ( 2 )
@ -39,8 +49,6 @@
#define ICM_NAME ( 7 ) #define ICM_NAME ( 7 )
#define ICM_VEH_SLOT ( 8 ) #define ICM_VEH_SLOT ( 8 )
#define VIP_ALLOW_OVER_LIMIT ( true )
/* ** Variables ** */ /* ** Variables ** */
enum E_IC_MARKET_DATA enum E_IC_MARKET_DATA
{ {
@ -48,7 +56,7 @@ enum E_IC_MARKET_DATA
bool: E_MULTI_BUY, bool: E_MULTI_BUY,
}; };
new static stock
g_irresistibleVipItems [ ] [ E_IC_MARKET_DATA ] = g_irresistibleVipItems [ ] [ E_IC_MARKET_DATA ] =
{ {
{ VIP_DIAMOND, "Diamond V.I.P", 10000.0 }, { VIP_DIAMOND, "Diamond V.I.P", 10000.0 },
@ -57,6 +65,7 @@ new
{ VIP_BRONZE, "Bronze V.I.P", 1500.0 }, { VIP_BRONZE, "Bronze V.I.P", 1500.0 },
{ VIP_REGULAR, "Regular V.I.P", 500.0 } { VIP_REGULAR, "Regular V.I.P", 500.0 }
}, },
g_irresistibleCashCards [ ] [ E_IC_MARKET_DATA ] = g_irresistibleCashCards [ ] [ E_IC_MARKET_DATA ] =
{ {
{ 1250000, "Tiger Shark", 225.0 }, { 1250000, "Tiger Shark", 225.0 },
@ -65,6 +74,7 @@ new
{ 10000000, "Whale Shark", 1350.0 }, { 10000000, "Whale Shark", 1350.0 },
{ 20000000, "Megalodon Shark", 2250.0 } { 20000000, "Megalodon Shark", 2250.0 }
}, },
g_irresistibleMarketItems [ ] [ E_IC_MARKET_DATA ] = g_irresistibleMarketItems [ ] [ E_IC_MARKET_DATA ] =
{ {
{ ICM_COKE_BIZ, "Gang Facility", 4500.0 }, { ICM_COKE_BIZ, "Gang Facility", 4500.0 },
@ -79,12 +89,15 @@ new
{ ICM_GARAGE, "Select Garage", 250.0 }, { ICM_GARAGE, "Select Garage", 250.0 },
{ ICM_NAME, "Change Your Name", 50.0 } { ICM_NAME, "Change Your Name", 50.0 }
}, },
p_CoinMarketPage [ MAX_PLAYERS char ], p_CoinMarketPage [ MAX_PLAYERS char ],
p_CoinMarketSelectedItem [ MAX_PLAYERS char ], p_CoinMarketSelectedItem [ MAX_PLAYERS char ]
;
Float: p_IrresistibleCoins [ MAX_PLAYERS ],
p_ExtraAssetSlots [ MAX_PLAYERS char ]
/* ** Global Variables ** */
new
p_ExtraAssetSlots [ MAX_PLAYERS char ],
Float: p_IrresistibleCoins [ MAX_PLAYERS ]
; ;
/* ** Hooks ** */ /* ** Hooks ** */
@ -226,7 +239,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
} }
else if ( selectedItemID == ICM_VEH_SLOT ) { else if ( selectedItemID == ICM_VEH_SLOT ) {
if ( p_ExtraAssetSlots{ playerid } >= VIP_MAX_EXTRA_SLOTS ) { if ( p_ExtraAssetSlots{ playerid } >= VIP_MAX_EXTRA_SLOTS ) {
SendError( playerid, "You have reached the limit of additional slots (limit " #VIP_MAX_EXTRA_SLOTS ")." ); SendError( playerid, "You have reached the limit of additional slots (limit %d).", VIP_MAX_EXTRA_SLOTS );
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS ); return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
} }
@ -438,6 +451,52 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
} }
/* ** Commands ** */ /* ** Commands ** */
CMD:ic( playerid, params[ ] ) return cmd_irresistiblecoins( playerid, params );
CMD:irresistiblecoins( playerid, params[ ] )
{
if ( ! IsPlayerSecurityVerified( playerid ) )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
if ( strmatch( params, "balance" ) )
{
return SendServerMessage( playerid, "You currently have precisely "COL_GOLD"%s"COL_WHITE" Irresistible Coins!", number_format( p_IrresistibleCoins[ playerid ] ) );
}
else if ( strmatch( params, "market" ) )
{
return ShowPlayerCoinMarketDialog( playerid );
}
else if ( !strcmp( params, "send", false, 4 ) )
{
new
senttoid, Float: coins;
if ( sscanf( params[ 5 ],"uf", senttoid, coins ) ) return SendUsage( playerid, "/irresistiblecoins send [PLAYER_ID] [COINS]" );
else if ( !IsPlayerConnected( senttoid ) || IsPlayerNPC( senttoid ) ) return SendError( playerid, "Invalid Player ID." );
else if ( p_VIPLevel[ 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 ( coins < 0.1 || coins > 5000.0 ) return SendError( playerid, "You can only send between 0.1 and 5,000.0 coins at a single time." );
else if ( coins > 99999999 || coins < 0 ) return SendError( playerid, "You can only send between 0.1 and 5,000.0 coins at a single time." ); // Making cash go over billions...
else if ( p_IrresistibleCoins[ playerid ] < coins ) return SendError( playerid, "You do not have this number of coins to send." );
else if ( GetPlayerScore( playerid ) < 1000 ) return SendError( playerid, "You need at least 1,000 score to send coins to other players." );
else if ( senttoid == playerid ) return SendError( playerid, "You cannot send yourself coins." );
else
{
if ( GetDistanceBetweenPlayers( playerid, senttoid ) > 8.0 )
return SendError( playerid, "Please make sure you are close to the player before sending coins to them." );
format( szNormalString, sizeof( szNormalString ), "INSERT INTO `TRANSACTIONS_IC` (`TO_ID`, `FROM_ID`, `IC`) VALUES (%d, %d, %f)", p_AccountID[ senttoid ], p_AccountID[ playerid ], coins );
mysql_single_query( szNormalString );
p_IrresistibleCoins[ senttoid ] += coins;
p_IrresistibleCoins[ playerid ] -= coins;
SendServerMessage( playerid, "You have sent "COL_GOLD"%s"COL_WHITE" Irresistible Coins to %s(%d)!", number_format( coins, .decimals = 2 ), ReturnPlayerName( senttoid ), senttoid );
SendServerMessage( senttoid, "You have received "COL_GOLD"%s"COL_WHITE" Irresistible Coins from %s(%d)!", number_format( coins, .decimals = 2 ), ReturnPlayerName( playerid ), playerid );
}
return 1;
}
return SendUsage( playerid, "/irresistiblecoins [BALANCE/BUY/SELL/MARKET/SEND/CANCEL]" );
}
CMD:donate( playerid, params[ ] ) return cmd_vip( playerid, params ); CMD:donate( playerid, params[ ] ) return cmd_vip( playerid, params );
CMD:vip( playerid, params[ ] ) CMD:vip( playerid, params[ ] )
{ {

View File

@ -8,6 +8,11 @@
/* ** Includes ** */ /* ** Includes ** */
#include < YSI\y_hooks > #include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined __cnr__irresistiblecoins
#endinput
#endif
/* ** Definitions ** */ /* ** Definitions ** */
// #define DIALOG_IC_SELLORDERS ( 5921 ) // #define DIALOG_IC_SELLORDERS ( 5921 )
// #define DIALOG_IC_BUY ( 5922 ) // #define DIALOG_IC_BUY ( 5922 )

View File

@ -8,6 +8,11 @@
/* ** Includes ** */ /* ** Includes ** */
#include < YSI\y_hooks > #include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined __cnr__irresistiblecoins
#endinput
#endif
/* ** Definitions ** */ /* ** Definitions ** */
#define szRedemptionSalt "7resta#ecacakumedeM=yespawr!d@et" #define szRedemptionSalt "7resta#ecacakumedeM=yespawr!d@et"

View File

@ -266,8 +266,7 @@ public OnGameModeExit( )
public OnServerUpdateTimer( ) public OnServerUpdateTimer( )
{ {
static static
iWeapon, iAmmo, iWeapon, iAmmo
Float: fLastRate
; ;
// for hooks // for hooks
@ -282,31 +281,6 @@ public OnServerUpdateTimer( )
BeginEconomyTax( ); BeginEconomyTax( );
} }
// Happy Hour
new
playersOnline = Iter_Count(Player);
if ( ( g_HappyHour = playersOnline <= 20 ) == true ) {
// Maximum of 25% decrease
g_HappyHourRate = 0.25 - ( playersOnline / 80.0 );
// Only update colors if neccessary
if ( fLastRate != g_HappyHourRate )
{
TextDrawSetString( g_NotManyPlayersTD, sprintf( "Coin generation increased by %0.1f%% as there aren't many players online!", g_HappyHourRate * 100.0 ) );
TextDrawColor( g_NotManyPlayersTD, setAlpha( COLOR_RED, floatround( 200.0 - 10.0 * float( playersOnline ) ) ) );
TextDrawShowForAllSpawned( g_NotManyPlayersTD );
}
// Update last rate
fLastRate = g_HappyHourRate;
} else {
// Disable Color
g_HappyHourRate = 0.0;
TextDrawColor( g_NotManyPlayersTD, 0 );
TextDrawHideForAll( g_NotManyPlayersTD );
}
// Begin iterating all players // Begin iterating all players
foreach ( new playerid : Player ) foreach ( new playerid : Player )
{ {
@ -468,9 +442,6 @@ public OnServerUpdateTimer( )
public OnServerSecondTick( ) public OnServerSecondTick( )
{ {
new
iKeys, iUpDownKeys, iLeftRightKeys;
SendRconCommand( sprintf( "worldtime %s, %s", GetDayToString( g_WorldDayCount ), TimeConvert( g_WorldClockSeconds++ ) ) ); SendRconCommand( sprintf( "worldtime %s, %s", GetDayToString( g_WorldDayCount ), TimeConvert( g_WorldClockSeconds++ ) ) );
if ( g_WorldClockSeconds >= 1440 ) if ( g_WorldClockSeconds >= 1440 )
@ -502,6 +473,9 @@ public OnServerSecondTick( )
SetPlayerWeather( playerid, ( GetPlayerInterior( playerid ) || GetPlayerVirtualWorld( playerid ) ) ? 1 : g_WorldWeather ); SetPlayerWeather( playerid, ( GetPlayerInterior( playerid ) || GetPlayerVirtualWorld( playerid ) ) ? 1 : g_WorldWeather );
UpdatePlayerTime( playerid ); UpdatePlayerTime( playerid );
// Callback
CallLocalFunction( "OnPlayerTickSecond", "d", playerid );
// Increment Variables Whilst Not AFK // Increment Variables Whilst Not AFK
if ( !IsPlayerAFK( playerid ) ) // New addition if ( !IsPlayerAFK( playerid ) ) // New addition
{ {
@ -518,28 +492,6 @@ public OnServerSecondTick( )
case 86400: ShowAchievement( playerid, "You have been online for ~r~1~w~~h~ day!", 15 ); case 86400: ShowAchievement( playerid, "You have been online for ~r~1~w~~h~ day!", 15 );
} }
// Increase Irresistible Coins (1/20 = cred/min)
if ( GetPlayerKeys( playerid, iKeys, iUpDownKeys, iLeftRightKeys ) && ! IsPlayerOnRoulette( playerid ) && ! IsPlayerOnSlotMachine( playerid ) && GetPlayerVehicleSeat( playerid ) <= 0 )
{
if ( iKeys != 0 || iUpDownKeys != 0 || iLeftRightKeys != 0 ) { // GetPlayerScore( playerid ) > 10 &&
new
Float: iCoinGenRate = 35.0;
// VIP check
if ( p_VIPLevel[ playerid ] >= VIP_DIAMOND )
iCoinGenRate *= 0.75; // Reduce by 25% if Diamond
else if ( p_VIPLevel[ playerid ] == VIP_PLATINUM )
iCoinGenRate *= 0.90; // Reduce by 10% if Diamond
// Happy Hour
if ( g_HappyHour && ( 0.0 <= g_HappyHourRate <= 0.25 ) )
iCoinGenRate *= 1.0 - g_HappyHourRate;
p_IrresistibleCoins[ playerid ] += ( 1.0 / iCoinGenRate ) / 60.0; // Prev 25.92
}
}
} }
// CIA Visible On Radar after firing a shot // CIA Visible On Radar after firing a shot
@ -558,7 +510,6 @@ public OnPlayerRequestClass( playerid, classid )
PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] ); PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_MotdTD ); TextDrawHideForPlayer( playerid, g_MotdTD );
PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] ); PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_NotManyPlayersTD );
TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] ); TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_AdminOnDutyTD ); TextDrawHideForPlayer( playerid, g_AdminOnDutyTD );
TextDrawHideForPlayer( playerid, g_WorldDayTD ); TextDrawHideForPlayer( playerid, g_WorldDayTD );
@ -1050,7 +1001,6 @@ public OnPlayerSpawn( playerid )
TextDrawShowForPlayer( playerid, g_WebsiteTD ); TextDrawShowForPlayer( playerid, g_WebsiteTD );
TextDrawShowForPlayer( playerid, g_MotdTD ); TextDrawShowForPlayer( playerid, g_MotdTD );
PlayerTextDrawShow( playerid, g_ZoneOwnerTD[ playerid ] ); PlayerTextDrawShow( playerid, g_ZoneOwnerTD[ playerid ] );
if ( g_HappyHour ) TextDrawShowForPlayer( playerid, g_NotManyPlayersTD );
TextDrawShowForPlayer( playerid, g_WorldDayTD ); TextDrawShowForPlayer( playerid, g_WorldDayTD );
if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD ); if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD );
if ( p_AdminLog{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminLogTD ); if ( p_AdminLog{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminLogTD );
@ -1685,7 +1635,6 @@ public OnPlayerDeath( playerid, killerid, reason )
PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] ); PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_MotdTD ); TextDrawHideForPlayer( playerid, g_MotdTD );
PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] ); PlayerTextDrawHide( playerid, g_ZoneOwnerTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_NotManyPlayersTD );
TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] ); TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_AdminOnDutyTD ); TextDrawHideForPlayer( playerid, g_AdminOnDutyTD );
TextDrawHideForPlayer( playerid, g_WorldDayTD ); TextDrawHideForPlayer( playerid, g_WorldDayTD );
@ -2256,52 +2205,6 @@ thread readplayervipnotes( playerid )
return SendError( playerid, "You do not have any V.I.P notes." ); return SendError( playerid, "You do not have any V.I.P notes." );
} }
CMD:ic( playerid, params[ ] ) return cmd_irresistiblecoins( playerid, params );
CMD:irresistiblecoins( playerid, params[ ] )
{
if ( ! IsPlayerSecurityVerified( playerid ) )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
if ( strmatch( params, "balance" ) )
{
return SendServerMessage( playerid, "You currently have precisely "COL_GOLD"%s"COL_WHITE" Irresistible Coins!", number_format( p_IrresistibleCoins[ playerid ] ) );
}
else if ( strmatch( params, "market" ) )
{
return ShowPlayerCoinMarketDialog( playerid );
}
else if ( !strcmp( params, "send", false, 4 ) )
{
new
senttoid, Float: coins;
if ( sscanf( params[ 5 ],"uf", senttoid, coins ) ) return SendUsage( playerid, "/irresistiblecoins send [PLAYER_ID] [COINS]" );
else if ( !IsPlayerConnected( senttoid ) || IsPlayerNPC( senttoid ) ) return SendError( playerid, "Invalid Player ID." );
else if ( p_VIPLevel[ 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 ( coins < 0.1 || coins > 5000.0 ) return SendError( playerid, "You can only send between 0.1 and 5,000.0 coins at a single time." );
else if ( coins > 99999999 || coins < 0 ) return SendError( playerid, "You can only send between 0.1 and 5,000.0 coins at a single time." ); // Making cash go over billions...
else if ( p_IrresistibleCoins[ playerid ] < coins ) return SendError( playerid, "You do not have this number of coins to send." );
else if ( GetPlayerScore( playerid ) < 1000 ) return SendError( playerid, "You need at least 1,000 score to send coins to other players." );
else if ( senttoid == playerid ) return SendError( playerid, "You cannot send yourself coins." );
else
{
if ( GetDistanceBetweenPlayers( playerid, senttoid ) > 8.0 )
return SendError( playerid, "Please make sure you are close to the player before sending coins to them." );
format( szNormalString, sizeof( szNormalString ), "INSERT INTO `TRANSACTIONS_IC` (`TO_ID`, `FROM_ID`, `IC`) VALUES (%d, %d, %f)", p_AccountID[ senttoid ], p_AccountID[ playerid ], coins );
mysql_single_query( szNormalString );
p_IrresistibleCoins[ senttoid ] += coins;
p_IrresistibleCoins[ playerid ] -= coins;
SendServerMessage( playerid, "You have sent "COL_GOLD"%s"COL_WHITE" Irresistible Coins to %s(%d)!", number_format( coins, .decimals = 2 ), ReturnPlayerName( senttoid ), senttoid );
SendServerMessage( senttoid, "You have received "COL_GOLD"%s"COL_WHITE" Irresistible Coins from %s(%d)!", number_format( coins, .decimals = 2 ), ReturnPlayerName( playerid ), playerid );
}
return 1;
}
return SendUsage( playerid, "/irresistiblecoins [BALANCE/BUY/SELL/MARKET/SEND/CANCEL]" );
}
CMD:top( playerid, params[ ] ) return cmd_highscores( playerid, params ); CMD:top( playerid, params[ ] ) return cmd_highscores( playerid, params );
CMD:highscores( playerid, params[ ] ) CMD:highscores( playerid, params[ ] )
{ {
@ -3350,7 +3253,6 @@ CMD:moviemode( playerid, params[ ] )
TextDrawShowForPlayer( playerid, g_WebsiteTD ); TextDrawShowForPlayer( playerid, g_WebsiteTD );
if ( p_WantedLevel[ playerid ] ) PlayerTextDrawShow( playerid, p_WantedLevelTD[ playerid ] ); if ( p_WantedLevel[ playerid ] ) PlayerTextDrawShow( playerid, p_WantedLevelTD[ playerid ] );
TextDrawShowForPlayer( playerid, g_MotdTD ); TextDrawShowForPlayer( playerid, g_MotdTD );
if ( g_HappyHour ) TextDrawShowForPlayer( playerid, g_NotManyPlayersTD );
if ( p_FPSCounter{ playerid } ) TextDrawShowForPlayer( playerid, p_FPSCounterTD[ playerid ] ); if ( p_FPSCounter{ playerid } ) TextDrawShowForPlayer( playerid, p_FPSCounterTD[ playerid ] );
if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD ); if ( p_AdminOnDuty{ playerid } ) TextDrawShowForPlayer( playerid, g_AdminOnDutyTD );
TextDrawShowForPlayer( playerid, g_WorldDayTD ); TextDrawShowForPlayer( playerid, g_WorldDayTD );
@ -3370,7 +3272,6 @@ CMD:moviemode( playerid, params[ ] )
TextDrawHideForPlayer( playerid, g_AdminOnDutyTD ); TextDrawHideForPlayer( playerid, g_AdminOnDutyTD );
TextDrawHideForPlayer( playerid, g_DoubleXPTD ); TextDrawHideForPlayer( playerid, g_DoubleXPTD );
TextDrawHideForPlayer( playerid, g_MotdTD ); TextDrawHideForPlayer( playerid, g_MotdTD );
TextDrawHideForPlayer( playerid, g_NotManyPlayersTD );
TextDrawHideForPlayer( playerid, g_WorldDayTD ); TextDrawHideForPlayer( playerid, g_WorldDayTD );
TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] ); TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] );
for( new i; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawShowForPlayer( playerid, g_MovieModeTD[ i ] ); for( new i; i < sizeof( g_MovieModeTD ); i ++ ) TextDrawShowForPlayer( playerid, g_MovieModeTD[ i ] );