move vip, ig guard, ammunation to /cnr/ and disable pool temporarily

This commit is contained in:
Lorenc Pekaj 2018-09-23 14:55:13 +10:00
parent 4dc801ac0a
commit ccfbc7ec43
4 changed files with 790 additions and 6 deletions

View File

@ -0,0 +1,116 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module:
* Purpose:
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define MENU_ASSAULT ( 0 )
#define MENU_MELEE ( 1 )
#define MENU_SUB_SMGS ( 2 )
#define MENU_PISTOLS ( 3 )
#define MENU_RIFLES ( 4 )
#define MENU_SHOTGUNS ( 5 )
#define MENU_THROWN ( 6 )
#define MENU_ARMOR ( 7 )
/* ** Variables ** */
enum E_WEAPONS_DATA
{
E_MENU, E_NAME[ 32 ], E_WEPID,
E_AMMO, E_PRICE
};
new
g_AmmunitionCategory[ ] [ ] =
{
{ "Assault" }, { "Melee" }, { "Submachine Guns" }, { "Pistols" },
{ "Rifles" }, { "Shotguns" }, { "Thrown" }, { "Special" }
},
g_AmmunationWeapons[ ][ E_WEAPONS_DATA ] =
{
{ MENU_MELEE, "Flowers", 14, 1, 75 },
{ MENU_MELEE, "Shovel", 6, 1, 100 },
{ MENU_MELEE, "Pool Cue", 7, 1, 125 },
{ MENU_MELEE, "Golf Club", 2, 1, 125 },
{ MENU_MELEE, "Baseball Bat", 5, 1, 180 },
{ MENU_MELEE, "Brass Knuckles", 1, 1, 200 },
{ MENU_MELEE, "Parachute", 46, 1, 200 },
{ MENU_MELEE, "Camera", 43, 1, 250 },
{ MENU_MELEE, "Knife", 4, 1, 300 },
{ MENU_MELEE, "Katana", 8, 1, 600 },
{ MENU_MELEE, "Chainsaw", 9, 1, 750 },
{ MENU_PISTOLS, "9mm Pistol", 22, 180, 200 },
{ MENU_PISTOLS, "Silenced 9mm", 23, 180, 400 },
{ MENU_PISTOLS, "Desert Eagle", 24, 100, 1250 },
{ MENU_SHOTGUNS, "Shotgun", 25, 75, 600 },
{ MENU_SHOTGUNS, "Sawn-off Shotgun", 26, 100, 1200 },
{ MENU_SHOTGUNS, "Combat Shotgun", 27, 100, 1800 },
{ MENU_SUB_SMGS, "MP5", 29, 100, 500 },
{ MENU_SUB_SMGS, "Tec 9", 32, 100, 600 },
{ MENU_SUB_SMGS, "Mac 10", 28, 100, 700 },
{ MENU_ASSAULT, "AK47", 30, 100, 800 },
{ MENU_ASSAULT, "M4", 31, 100, 1000 },
{ MENU_RIFLES, "Rifle", 33, 100, 300 },
{ MENU_RIFLES, "Sniper", 34, 75, 1000 },
{ MENU_THROWN, "Teargas", 17, 5, 500 },
{ MENU_THROWN, "Grenade", 16, 1, 1200 },
{ MENU_THROWN, "Molotov Cocktail", 18, 4, 1400 },
{ MENU_ARMOR, "Armor", 101, 100, 12500 },
{ MENU_ARMOR, "RPG", 35, 1, 10000 }
},
p_AmmunationMenu [ MAX_PLAYERS char ]
;
/* ** Functions ** */
stock RedirectAmmunation( playerid, listitem, custom_title[ ] = "{FFFFFF}Ammu-Nation", custom_dialogid = DIALOG_AMMU_BUY, Float: custom_multplier = 1.0, ammo_multiplier = 1 )
{
new
szString[ 420 ];
if ( listitem == MENU_ARMOR ) szString = ""COL_WHITE"Item\t"COL_WHITE"Price\n";
else szString = ""COL_WHITE"Weapon\t"COL_WHITE"Ammo\t"COL_WHITE"Price\n";
for( new i; i < sizeof( g_AmmunationWeapons ); i++ ) if ( g_AmmunationWeapons[ i ] [ E_MENU ] == listitem )
{
if ( listitem != MENU_ARMOR ) { // Other multipliers will not specify ammo
format( szString, sizeof( szString ), "%s%s\t%d\t", szString, g_AmmunationWeapons[ i ] [ E_NAME ], listitem == MENU_MELEE ? 1 : ( g_AmmunationWeapons[ i ] [ E_AMMO ] * ammo_multiplier ) );
} else {
format( szString, sizeof( szString ), "%s%s\t", szString, g_AmmunationWeapons[ i ] [ E_NAME ] );
}
// check for free or not
if ( custom_multplier > 0.0 ) {
format( szString, sizeof( szString ), "%s"COL_GOLD"%s\n", szString, cash_format( floatround( g_AmmunationWeapons[ i ] [ E_PRICE ] * custom_multplier ) ) );
} else {
strcat( szString, ""COL_GOLD"FREE\n" );
}
}
ShowPlayerDialog( playerid, custom_dialogid, DIALOG_STYLE_TABLIST_HEADERS, custom_title, szString, "Purchase", "Back" );
return 1;
}
stock ShowAmmunationMenu( playerid, custom_title[ ] = "{FFFFFF}Ammu-Nation", custom_dialogid = DIALOG_AMMU )
{
static
szString[ 70 ];
if ( !szString[ 0 ] )
{
for( new i = 0; i < sizeof( g_AmmunitionCategory ); i++ ) {
format( szString, sizeof( szString ), "%s%s\n", szString, g_AmmunitionCategory[ i ] );
}
}
return ShowPlayerDialog( playerid, custom_dialogid, DIALOG_STYLE_LIST, custom_title, szString, "Select", "Cancel" );
}

View File

@ -7,11 +7,6 @@
/* ** Includes ** */
// core (needs to be moved to \cnr)
#include "irresistible\cnr\features\vip.pwn"
#include "irresistible\cnr\features\irresistibleguard.pwn"
#include "irresistible\cnr\features\ammunation.pwn"
// houses
#include "irresistible\cnr\features\houses\_houses.pwn"
#include "irresistible\cnr\features\vehicles\_vehicles.pwn"
@ -38,4 +33,4 @@
// #include "irresistible\cnr\features\eastereggs.pwn"
// pool
#include "irresistible\cnr\features\pool.pwn"
// #include "irresistible\cnr\features\pool.pwn"

View File

@ -0,0 +1,127 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: cnr\irresistibleguard.pwn
* Purpose: provides account protection in the form of email securing
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define SECURITY_MODE_MILD ( 0 )
#define SECURITY_MODE_PARANOID ( 1 )
#define SECURITY_MODE_DISABLED ( 2 )
/* ** Variables ** */
enum E_IRRESISTIBLE_GUARD
{
E_ID, E_EMAIL[ 64 ], E_MODE,
bool: E_VERIFIED, E_LAST_DISABLED
};
new
p_accountSecurityData [ MAX_PLAYERS ] [ E_IRRESISTIBLE_GUARD ]
;
/* ** Hooks ** */
hook OnPlayerDisconnect( playerid, reason )
{
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false;
p_accountSecurityData[ playerid ] [ E_ID ] = 0;
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
return 1;
}
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( ( dialogid == DIALOG_ACC_GUARD ) && response )
{
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 to use this feature." );
switch ( listitem )
{
case 0:
{
if ( p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "Your email is already confirmed!" ), ShowPlayerAccountGuard( playerid ), 1;
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `EMAILS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] );
mysql_function_query( dbHandle, szNormalString, true, "OnEmailConfirm", "d", playerid );
}
case 1: ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_MODE, DIALOG_STYLE_TABLIST, "{FFFFFF}Irresistible Guard - Mode", "Mild\t"COL_GREY"Must verify IP before making transactions\nParanoid\t"COL_GREY"Must verify IP after logging in\nDisable\t"COL_GREY"No form of verification", "Select", "Back" );
case 2:
{
format( szBigString, sizeof( szBigString ), "SELECT * FROM `EMAILS` WHERE `ID`=%d", p_accountSecurityData[ playerid ] [ E_ID ] );
mysql_function_query( dbHandle, szBigString, true, "OnAccountGuardDelete", "d", playerid );
}
case 3:
{
if ( p_AddedEmail{ playerid } )
return SendError( playerid, "You already added an email to your account before." );
if ( GetPlayerScore( playerid ) < 1000 )
return SendServerMessage( playerid, "Get at least 1000 score, then use this feature." );
Beep( playerid );
p_AddedEmail{ playerid } = true;
SetPlayerVipLevel( playerid, VIP_REGULAR, .interval = 259560 ); // 3 days of vip
mysql_single_query( sprintf( "UPDATE `USERS` SET `USED_EMAIL`=1 WHERE `ID`=%d", p_AccountID[ playerid ] ) );
SendGlobalMessage( COLOR_GOLD, "[EMAIL CONFIRMED]"COL_GREY" %s(%d) has confirmed their "COL_GOLD"/email"COL_GREY" and received 3 days of V.I.P!", ReturnPlayerName( playerid ), playerid );
return 1;
}
}
return 1;
}
else if ( dialogid == DIALOG_ACC_GUARD_CONFIRM )
{
if ( ! response )
{
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_PARANOID ) {
return Kick( playerid );
}
// allow other modes
return 1;
}
static
szInput[ 10 ];
format( szInput, sizeof( szInput ), "%s", inputtext );
trimString( szInput ); // gotta take out the whitespace
if ( strlen( szInput ) != 8 )
return SendError( playerid, "The verification code must be 8 characters." ), ShowPlayerAccountVerification( playerid );
mysql_format( dbHandle, szBigString, sizeof( szBigString ), "SELECT * FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d AND `IP`='%e' AND `TOKEN`='%e'", p_AccountID[ playerid ], ReturnPlayerIP( playerid ), szInput );
mysql_function_query( dbHandle, szBigString, true, "OnAccountGuardVerify", "d", playerid );
return 1;
}
else if ( dialogid == DIALOG_ACC_GUARD_DEL_CANCEL )
{
if ( !response )
return ShowPlayerAccountGuard( playerid );
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
mysql_single_query( sprintf( "UPDATE `EMAILS` SET `LAST_CHANGED`=%d,`LAST_DISABLED`=0 WHERE `ID`=%d", g_iTime, p_accountSecurityData[ playerid ] [ E_ID ] ) );
return SendServerMessage( playerid, "You have cancelled the process to removing Irresistible Guard." );
}
else if ( dialogid == DIALOG_ACC_GUARD_MODE )
{
if ( !response )
return ShowPlayerAccountGuard( playerid );
if ( ! p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "You need to assign an email to your account." );
p_accountSecurityData[ playerid ] [ E_MODE ] = listitem;
mysql_single_query( sprintf( "UPDATE `EMAILS` SET `MODE`=%d WHERE `ID`=%d", listitem, p_accountSecurityData[ playerid ] [ E_ID ] ) );
SendServerMessage( playerid, "Your Irresistible Guard mode is now set to "COL_GREY"%s"COL_WHITE".", SecurityModeToString( listitem ) );
return ShowPlayerAccountGuard( playerid );
}
return 1;
}
/* ** Functions ** */

View File

@ -0,0 +1,546 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: vip.inc
* Purpose: vip associated information
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Macros ** */
#define GetPlayerIrresistibleCoins(%0) \
(p_IrresistibleCoins[%0])
#define GivePlayerIrresistibleCoins(%0,%1) \
(p_IrresistibleCoins[%0] += %1)
/* ** Definitions ** */
#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_BRONZE ( 2 )
#define VIP_GOLD ( 3 )
#define VIP_PLATINUM ( 4 )
#define VIP_DIAMOND ( 5 )
#define ICM_COKE_BIZ ( 0 )
#define ICM_METH_BIZ ( 1 )
#define ICM_WEED_BIZ ( 2 )
#define ICM_HOUSE ( 3 )
#define ICM_VEHICLE ( 4 )
#define ICM_GATE ( 5 )
#define ICM_GARAGE ( 6 )
#define ICM_NAME ( 7 )
#define ICM_VEH_SLOT ( 8 )
/* ** Variables ** */
enum E_IC_MARKET_DATA
{
E_ID, E_NAME[ 19 ], Float: E_PRICE,
bool: E_MULTI_BUY,
};
new
g_irresistibleVipItems [ ] [ E_IC_MARKET_DATA ] =
{
{ VIP_GOLD, "Gold V.I.P", 2000.0 },
{ VIP_BRONZE, "Bronze V.I.P", 1000.0 },
{ VIP_REGULAR, "Regular V.I.P", 500.0 }
},
g_irreisistibleCashCards [ ] [ E_IC_MARKET_DATA ] =
{
{ 1250000, "Tiger Shark", 250.0 },
{ 2750000, "Bull Shark", 500.0 },
{ 6000000, "Great White Shark", 1000.0 },
{ 10000000, "Whale Shark", 1500.0 },
{ 20000000, "Megalodon Shark", 2500.0 }
},
g_irresistibleMarketItems [ ] [ E_IC_MARKET_DATA ] =
{
{ ICM_COKE_BIZ, "Gang Facility", 5000.0 },
{ ICM_COKE_BIZ, "Bunker Business", 4500.0 },
{ ICM_COKE_BIZ, "Coke Business", 1500.0 },
{ ICM_METH_BIZ, "Meth Business", 700.0 },
{ ICM_VEHICLE, "Vehicle", 500.0 },
{ ICM_HOUSE, "House", 500.0 },
{ ICM_WEED_BIZ, "Weed Business", 500.0 },
{ ICM_GATE, "Custom Gate", 350.0 },
{ ICM_GARAGE, "Garage", 250.0 },
{ ICM_VEH_SLOT, "Extra Vehicle Slot", 350.0 },
{ ICM_NAME, "Change Your Name", 50.0 }
},
p_CoinMarketPage [ MAX_PLAYERS char ],
p_CoinMarketSelectedItem [ MAX_PLAYERS char ],
Float: p_IrresistibleCoins [ MAX_PLAYERS ],
p_ExtraAssetSlots [ MAX_PLAYERS char ]
;
/* ** Hooks ** */
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( dialogid == DIALOG_IC_MARKET && response )
{
new current_vip = GetPlayerVIPLevel( playerid );
new Float: days_left = float( GetPlayerVIPDuration( playerid ) ) / 86400.0;
if ( listitem == sizeof( g_irresistibleVipItems ) )
{
if ( current_vip >= VIP_REGULAR && current_vip < VIP_GOLD && days_left >= 3.0 )
{
new
iCoinRequirement = floatround( g_irresistibleVipItems[ sizeof( g_irresistibleVipItems ) - current_vip ] [ E_PRICE ] * GetGVarFloat( "vip_discount" ) * ( days_left / 30.0 ), floatround_ceil );
p_CoinMarketPage{ playerid } = ICM_PAGE_UPGRADE;
return ShowPlayerDialog( playerid, DIALOG_YOU_SURE_VIP, DIALOG_STYLE_MSGBOX, ""COL_GOLD"Irresistible Coin -{FFFFFF} Confirmation", sprintf( ""COL_WHITE"Are you sure that you want to spend %s IC?", number_format( iCoinRequirement, .prefix = '\0', .decimals = 2 ) ), "Yes", "No" );
}
else
{
SendError( playerid, "Upgrading your V.I.P is currently unavailable." );
return ShowPlayerCoinMarketDialog( playerid );
}
}
else if ( listitem == sizeof( g_irresistibleVipItems ) + 1 ) {
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_CASHCARD );
}
else if ( listitem > sizeof( g_irresistibleVipItems ) + 1 ) {
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
}
else {
new Float: iCoinRequirement = g_irresistibleVipItems[ listitem ] [ E_PRICE ] * GetGVarFloat( "vip_discount" );
new selected_vip = g_irresistibleVipItems[ listitem ] [ E_ID ];
if ( current_vip > VIP_GOLD ) {
current_vip = VIP_GOLD;
}
if ( current_vip != 0 && current_vip != selected_vip ) {
if ( current_vip > selected_vip ) {
SendError( playerid, "You must wait until your V.I.P is expired in order to downgrade it." );
} else {
SendError( playerid, "You must upgrade your current V.I.P level first." );
}
return ShowPlayerCoinMarketDialog( playerid );
}
p_CoinMarketPage{ playerid } = ICM_PAGE_DEFAULT;
p_CoinMarketSelectedItem{ playerid } = listitem;
return ShowPlayerDialog( playerid, DIALOG_YOU_SURE_VIP, DIALOG_STYLE_MSGBOX, ""COL_GOLD"Irresistible Coin -{FFFFFF} Confirmation", sprintf( ""COL_WHITE"Are you sure that you want to spend %s IC?", number_format( iCoinRequirement, .prefix = '\0', .decimals = 2 ) ), "Yes", "No" );
}
}
else if ( dialogid == DIALOG_IC_MARKET_2 || dialogid == DIALOG_IC_MARKET_3 )
{
if ( ! response )
return ShowPlayerCoinMarketDialog( playerid );
new Float: iCoinRequirement = GetGVarFloat( "vip_discount" );
// assets
if ( dialogid == DIALOG_IC_MARKET_2 ) {
iCoinRequirement *= g_irresistibleMarketItems[ listitem ] [ E_PRICE ];
}
// cash cards
else if ( dialogid == DIALOG_IC_MARKET_3 ) {
iCoinRequirement *= g_irreisistibleCashCards[ listitem ] [ E_PRICE ];
}
p_CoinMarketPage{ playerid } = ( dialogid == DIALOG_IC_MARKET_3 ) ? ICM_PAGE_CASHCARD : ICM_PAGE_ASSETS;
p_CoinMarketSelectedItem{ playerid } = listitem;
return ShowPlayerDialog( playerid, DIALOG_YOU_SURE_VIP, DIALOG_STYLE_MSGBOX, ""COL_GOLD"Irresistible Coin -{FFFFFF} Confirmation", sprintf( ""COL_WHITE"Are you sure that you want to spend %s IC?", number_format( iCoinRequirement, .prefix = '\0', .decimals = 2 ) ), "Yes", "No" );
}
else if ( dialogid == DIALOG_YOU_SURE_VIP )
{
if ( !response )
return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } );
new current_vip = GetPlayerVIPLevel( playerid );
new Float: player_coins = GetPlayerIrresistibleCoins( playerid );
new Float: days_left = float( GetPlayerVIPDuration( playerid ) ) / 86400.0;
// restore listitem of whatever player selected
listitem = p_CoinMarketSelectedItem{ playerid };
// upgrade player vip
if ( p_CoinMarketPage{ playerid } == ICM_PAGE_UPGRADE )
{
if ( current_vip >= VIP_REGULAR && current_vip < VIP_GOLD && days_left >= 3.0 )
{
new new_vip_item = sizeof( g_irresistibleVipItems ) - current_vip;
new Float: iCoinRequirement = floatround( g_irresistibleVipItems[ new_vip_item ] [ E_PRICE ] * GetGVarFloat( "vip_discount" ) * ( days_left / 30.0 ), floatround_ceil );
if ( player_coins < iCoinRequirement ) {
SendError( playerid, "You need around %s coins before you can upgrade your V.I.P!", number_format( iCoinRequirement - player_coins, .prefix = '\0', .decimals = 2 ) );
return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } );
}
// lower = higher the rank from the array
new_vip_item --;
if ( 0 <= new_vip_item < sizeof( g_irresistibleVipItems ) )
{
// set level no interval, deduct and notify
SetPlayerVipLevel( playerid, g_irresistibleVipItems[ new_vip_item ] [ E_ID ], .interval = 0 );
GivePlayerIrresistibleCoins( playerid, -iCoinRequirement );
SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[VIP PACKAGE]"COL_WHITE" You have upgraded to %s for %s Irresistible Coins!", g_irresistibleVipItems[ new_vip_item ] [ E_NAME ], number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
}
else
{
SendError( playerid, "There seemed to be an error while upgrading your V.I.P, please contact Lorenc." );
}
return 1;
}
else
{
SendError( playerid, "Upgrading your V.I.P is currently unavailable." );
return ShowPlayerCoinMarketDialog( playerid );
}
}
// default page
else if ( p_CoinMarketPage{ playerid } == ICM_PAGE_DEFAULT )
{
new Float: iCoinRequirement = g_irresistibleVipItems[ listitem ] [ E_PRICE ] * GetGVarFloat( "vip_discount" );
new selected_vip = g_irresistibleVipItems[ listitem ] [ E_ID ];
if ( current_vip > VIP_GOLD ) {
current_vip = VIP_GOLD;
}
if ( current_vip != 0 && current_vip != selected_vip ) {
if ( current_vip > selected_vip ) {
SendError( playerid, "You must wait until your V.I.P is expired in order to downgrade it." );
} else {
SendError( playerid, "You must upgrade your current V.I.P level first." );
}
return ShowPlayerCoinMarketDialog( playerid );
}
if ( player_coins < iCoinRequirement ) {
SendError( playerid, "You need around %s coins before you can get this V.I.P!", number_format( iCoinRequirement - player_coins, .prefix = '\0', .decimals = 2 ) );
return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } );
}
// Deduct IC
GivePlayerIrresistibleCoins( playerid, -iCoinRequirement );
// Set VIP Level
SetPlayerVipLevel( playerid, selected_vip );
// Send message
SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[VIP PACKAGE]"COL_WHITE" You have redeemed %s V.I.P for %s Irresistible Coins! Congratulations! :D", VIPToString( selected_vip ), number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
// Redirect player
ShowPlayerVipRedeemedDialog( playerid );
return 1;
}
// buy cash cards
else if ( p_CoinMarketPage{ playerid } == ICM_PAGE_CASHCARD )
{
new Float: iCoinRequirement = g_irreisistibleCashCards[ listitem ] [ E_PRICE ] * GetGVarFloat( "vip_discount" );
if ( player_coins < iCoinRequirement ) {
SendError( playerid, "You need around %s coins before you can get this!", number_format( iCoinRequirement - player_coins, .prefix = '\0', .decimals = 2 ) );
return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } );
}
new cash_amount = g_irreisistibleCashCards[ listitem ] [ E_ID ];
GivePlayerCash( playerid, cash_amount );
GivePlayerIrresistibleCoins( playerid, -iCoinRequirement );
SendServerMessage( playerid, "You have ordered a "COL_GREEN"%s Cash Card (%s)"COL_WHITE" for %s Irresistible Coins!", g_irreisistibleCashCards[ listitem ] [ E_NAME ], number_format( cash_amount ), number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
ShowPlayerHelpDialog( playerid, 10000, "You have bought a ~g~%s~w~ %s Cash Card!", number_format( cash_amount ), g_irreisistibleCashCards[ listitem ] [ E_NAME ] );
}
// all other market items
else
{
new Float: iCoinRequirement = g_irresistibleMarketItems[ listitem ] [ E_PRICE ] * GetGVarFloat( "vip_discount" );
if ( player_coins < iCoinRequirement ) {
SendError( playerid, "You need around %s coins before you can get this!", number_format( iCoinRequirement - player_coins, .prefix = '\0', .decimals = 2 ) );
return ShowPlayerCoinMarketDialog( playerid, p_CoinMarketPage{ playerid } );
}
new selectedItemID = g_irresistibleMarketItems[ listitem ] [ E_ID ];
// show new name dialog before charging
if ( selectedItemID == ICM_NAME ) {
ShowPlayerDialog( playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Change your name", ""COL_WHITE"What would you like your new name to be? And also, double check!", "Change", "Back" );
}
else if ( selectedItemID == ICM_VEH_SLOT ) {
if ( p_ExtraAssetSlots{ playerid } >= VIP_MAX_EXTRA_SLOTS ) {
SendError( playerid, "You have reached the limit of additional slots (limit " #VIP_MAX_EXTRA_SLOTS ")." );
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
}
p_ExtraAssetSlots{ playerid } ++;
GivePlayerIrresistibleCoins( playerid, -iCoinRequirement );
SendServerMessage( playerid, "You have redeemed an "COL_GOLD"vehicle slot"COL_WHITE" for %s Irresistible Coins!", number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
AddPlayerNote( playerid, -1, sprintf( "Bought veh extra slot, has %d extra", p_ExtraAssetSlots{ playerid } ) );
}
else
{
GivePlayerIrresistibleCoins( playerid, -iCoinRequirement );
AddPlayerNote( playerid, -1, sprintf( ""COL_GOLD"%s" #COL_WHITE, g_irresistibleMarketItems[ listitem ] [ E_NAME ] ) );
SendClientMessageToAdmins( -1, ""COL_PINK"[DONOR NEEDS HELP]"COL_GREY" %s(%d) needs a %s. (/viewnotes)", ReturnPlayerName( playerid ), playerid, g_irresistibleMarketItems[ listitem ] [ E_NAME ] );
SendServerMessage( playerid, "You have ordered a "COL_GOLD"%s"COL_WHITE" for %s Irresistible Coins!", g_irresistibleMarketItems[ listitem ] [ E_NAME ], number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
SendServerMessage( playerid, "Online admins have been notified of your purchase. Use "COL_GREY"/notes"COL_WHITE" to track your orders and to remind online admins." );
ShowPlayerHelpDialog( playerid, 10000, "You can use ~y~/notes~w~ to track your orders.~n~~n~Also, admins can be called using this command." );
}
/*case 8:
{
if ( ( iCoinRequirement = 100.0 * GetGVarFloat( "vip_discount" ) ) <= p_IrresistibleCoins[ playerid ] )
{
new
ownerid = INVALID_PLAYER_ID,
vehicleid = GetPlayerVehicleID( playerid ),
buyableid = getVehicleSlotFromID( vehicleid, ownerid ),
modelid = GetVehicleModel( vehicleid )
;
if ( !vehicleid ) SendError( playerid, "You need to be in a vehicle to use this command." );
else if ( buyableid == -1 ) SendError( playerid, "This vehicle isn't a buyable vehicle." );
else if ( playerid != ownerid ) SendError( playerid, "You are not the owner of this vehicle." );
else if ( IsBoatVehicle( modelid ) || IsAirVehicle( modelid ) ) SendError( playerid, "You cannot apply gold rims to this type of vehicle." );
else
{
if ( AddVehicleComponent( vehicleid, 1080 ) )
{
if ( UpdateBuyableVehicleMods( playerid, buyableid ) )
{
new
szMods[ MAX_CAR_MODS * 10 ];
for( new i; i < MAX_CAR_MODS; i++ )
format( szMods, sizeof( szMods ), "%s%d.", szMods, g_vehicleModifications[ playerid ] [ buyableid ] [ i ] );
format( szBigString, sizeof( szBigString ), "UPDATE `VEHICLES` SET `MODS`='%s' WHERE `ID`=%d", szMods, g_vehicleData[ playerid ] [ buyableid ] [ E_SQL_ID ] );
mysql_single_query( szBigString );
}
p_IrresistibleCoins[ playerid ] -= iCoinRequirement;
SendServerMessage( playerid, "You have redeemed "COL_GOLD"Gold Rims"COL_WHITE" on your vehicle for %s Irresistible Coins!", number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
// Receipt
AddPlayerNote( playerid, -1, sprintf( "Bought gold rims on vehicle #%d", g_vehicleData[ playerid ] [ buyableid ] [ E_SQL_ID ] ) );
}
else SendError( playerid, "We were unable to place gold rims on this vehicle (0xF92D)." );
}
return ShowPlayerCoinMarketDialog( playerid, true );
}
else
{
SendError( playerid, "You need around %s coins before you can get this!", number_format( iCoinRequirement - p_IrresistibleCoins[ playerid ], .prefix = '\0', .decimals = 2 ) );
return ShowPlayerCoinMarketDialog( playerid, true );
}
}*/
}
}
else if ( dialogid == DIALOG_CHANGENAME )
{
if ( !response )
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
new selected_item = p_CoinMarketSelectedItem{ playerid };
if ( ! ( 0 <= selected_item < sizeof( g_irresistibleMarketItems ) && g_irresistibleMarketItems[ selected_item ] [ E_ID ] == ICM_NAME ) ) {
return SendError( playerid, "Invalid option selected, please try again." );
}
new Float: iCoinRequirement = g_irresistibleMarketItems[ selected_item ] [ E_PRICE ] * GetGVarFloat( "vip_discount" );
new Float: player_coins = GetPlayerIrresistibleCoins( playerid );
if ( player_coins < iCoinRequirement ) {
SendError( playerid, "You need around %s coins before you can get this!", number_format( iCoinRequirement - player_coins, .prefix = '\0', .decimals = 2 ) );
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
}
new szName[ 20 ];
if ( sscanf( inputtext, "s[20]", szName ) ) SendError( playerid, "The name you have input is considered invalid." );
else if ( !isValidPlayerName( szName ) ) SendError( playerid, "This name consists of invalid characters." );
else {
return mysql_function_query( dbHandle, sprintf( "SELECT `NAME` FROM `BANS` WHERE `NAME`='%s'", mysql_escape( szName ) ), true, "OnNewNameCheckBanned", "dfs", playerid, iCoinRequirement, szName );
}
return ShowPlayerDialog( playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Change your name", ""COL_WHITE"What would you like your new name to be? And also, double check!", "Change", "Back" );
}
else if ( dialogid == DIALOG_BUY_VIP && response )
{
return ShowPlayerCoinMarketDialog( playerid );
}
return 1;
}
/* ** Commands ** */
CMD:donate( playerid, params[ ] ) return cmd_vip( playerid, params );
CMD:vip( playerid, params[ ] )
{
static
vip_description[ 1100 ];
if ( vip_description[ 0 ] == '\0' ) {
vip_description = " \t"COL_WHITE"Regular VIP\t"COL_BRONZE"Bronze VIP\t"COL_GOLD"Gold V.I.P\n";
strcat( vip_description, ""COL_GREEN"Price (USD)\t"COL_WHITE"$5.00 /mo\t"COL_BRONZE"$10.00 /mo\t"COL_GOLD"$20.00 /mo\n" );
strcat( vip_description, "Total house slots\t5\t10\tunlimited\n" );
strcat( vip_description, "Total garage slots*\t5\t10\tunlimited\n" );
strcat( vip_description, "Total business slots\t5\t10\tunlimited\n" );
strcat( vip_description, "Total vehicle slots\t5\t10\t20\n" );
strcat( vip_description, "Weapons on spawn\t1\t2\t3\n" );
strcat( vip_description, "Armour on spawn\t0%\t100%\t100%\n" );
strcat( vip_description, "Coin generation increase\t0%\t10%\t25%\n" );
strcat( vip_description, "Ability to transfer coins P2P\tN\tY\tY\n" );
strcat( vip_description, "Ability to use two jobs (/vipjob)\tN\tN\tY\n" );
strcat( vip_description, "Tax reduction\t0%\t0%\t50%\n" );
strcat( vip_description, "Inactive asset protection\t14\t14\t30\n" );
strcat( vip_description, "Total Vehicle component editing slots\t4\t6\t10\n" );
strcat( vip_description, "Furniture slots available\t30\t40\t50\n" );
strcat( vip_description, "V.I.P Lounge Weapon Redeeming Cooldown\t5 min\t1 min\tnone\n" );
strcat( vip_description, "V.I.P Tag On Forum\tY\tY\tY\n" );
strcat( vip_description, "Access to V.I.P chat\tY\tY\tY\n" );
strcat( vip_description, "Access to V.I.P lounge\tY\tY\tY\n" );
strcat( vip_description, "Can spawn with a specific skin\tY\tY\tY\n" );
strcat( vip_description, "Access to V.I.P toys\tY\tY\tY\n" );
strcat( vip_description, "Access to custom gang colors (/gangcolor)\tY\tY\tY\n" );
strcat( vip_description, "Access to extra house weapon storage slots\tY\tY\tY\n" );
strcat( vip_description, "Can play custom radio URLs (/radio)\tY\tY\tY\n" );
strcat( vip_description, "Ability to adjust your label's color (/labelcolor)\tY\tY\tY\n" );
strcat( vip_description, "Can show a message to people you kill (/deathmsg)\tY\tY\tY\n" );
strcat( vip_description, "Can adjust the sound of your hitmarker (/hitmarker)\tY\tY\tY" );
}
ShowPlayerDialog( playerid, DIALOG_BUY_VIP, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Donate for V.I.P", vip_description, "Buy Now", "Close" );
return 1;
}
/* ** Functions ** */
stock ShowPlayerCoinMarketDialog( playerid, page = ICM_PAGE_DEFAULT )
{
// 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)" );
new Float: discount = GetGVarFloat( "vip_discount" );
new szMarket[ 512 ] = ""COL_GREY"Item Name\t"COL_GREY"Coins Needed\n";
if ( page == ICM_PAGE_DEFAULT )
{
new current_vip = GetPlayerVIPLevel( playerid );
new Float: days_left = float( GetPlayerVIPDuration( playerid ) ) / 86400.0;
if ( current_vip > VIP_GOLD ) {
current_vip = VIP_GOLD;
}
for( new i = 0; i < sizeof( g_irresistibleVipItems ); i++ )
{
new Float: iCoinRequirement = g_irresistibleVipItems[ i ] [ E_PRICE ] * discount;
if ( current_vip != 0 && current_vip != g_irresistibleVipItems[ i ] [ E_ID ] ) {
format( szMarket, sizeof( szMarket ), "%s{333333}%s\t{333333}%s\n", szMarket, g_irresistibleVipItems[ i ] [ E_NAME ], number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
} else {
format( szMarket, sizeof( szMarket ), "%s%s\t"COL_GOLD"%s\n", szMarket, g_irresistibleVipItems[ i ] [ E_NAME ], number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
}
}
// upgrade vip
if ( current_vip >= VIP_REGULAR && current_vip < VIP_GOLD && days_left >= 3.0 )
{
new iCoinRequirement = floatround( g_irresistibleVipItems[ sizeof( g_irresistibleVipItems ) - current_vip ] [ E_PRICE ] * discount * ( days_left / 30.0 ), floatround_ceil );
format( szMarket, sizeof( szMarket ), "%sUpgrade V.I.P\t"COL_GOLD"%s\n", szMarket, number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
}
else strcat( szMarket, "{333333}Upgrade V.I.P\t{333333}Unavailable\n" );
// thats it
strcat( szMarket, ""COL_GREEN"Buy shark cards...\t"COL_GREEN">>>\n" );
strcat( szMarket, ""COL_GREY"See other items...\t"COL_GREY">>>" );
return ShowPlayerDialog( playerid, DIALOG_IC_MARKET, DIALOG_STYLE_TABLIST_HEADERS, ""COL_GOLD"Irresistible Coin -{FFFFFF} Market", szMarket, "Select", "" );
}
else if ( page == ICM_PAGE_CASHCARD )
{
szMarket = ""COL_GREY"Cash Card\t"COL_GREY"Amount ($)\t"COL_GREY"Coins Needed\n";
for( new i = 0; i < sizeof( g_irreisistibleCashCards ); i++ )
{
new iCoinRequirement = floatround( g_irreisistibleCashCards[ i ] [ E_PRICE ] * discount );
format( szMarket, sizeof( szMarket ), "%s%s\t"COL_GREEN"%s\t"COL_GOLD"%s\n", szMarket, g_irreisistibleCashCards[ i ] [ E_NAME ], number_format( g_irreisistibleCashCards[ i ] [ E_ID ] ), number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
}
return ShowPlayerDialog( playerid, DIALOG_IC_MARKET_3, DIALOG_STYLE_TABLIST_HEADERS, ""COL_GOLD"Irresistible Coin -{FFFFFF} Cash Cards", szMarket, "Select", "Back" );
}
else
{
for( new i = 0; i < sizeof( g_irresistibleMarketItems ); i++ )
{
new
iCoinRequirement = floatround( g_irresistibleMarketItems[ i ] [ E_PRICE ] * discount );
format( szMarket, sizeof( szMarket ), "%s%s\t"COL_GOLD"%s\n", szMarket, g_irresistibleMarketItems[ i ] [ E_NAME ], number_format( iCoinRequirement, .prefix = '\0', .decimals = 0 ) );
}
return ShowPlayerDialog( playerid, DIALOG_IC_MARKET_2, DIALOG_STYLE_TABLIST_HEADERS, ""COL_GOLD"Irresistible Coin -{FFFFFF} Asset Market", szMarket, "Select", "Back" );
}
}
stock GetPlayerHouseSlots( playerid )
{
new vip_level = GetPlayerVIPLevel( playerid );
new slots = 3;
switch( vip_level )
{
case VIP_GOLD, VIP_PLATINUM, VIP_DIAMOND:
slots = 255; // 99 infinite
case VIP_BRONZE:
slots = 10;
case VIP_REGULAR:
slots = 5;
}
return slots; // + p_ExtraAssetSlots{ playerid };
}
stock GetPlayerBusinessSlots( playerid ) return GetPlayerHouseSlots( playerid );
stock GetPlayerGarageSlots( playerid ) return GetPlayerHouseSlots( playerid );
stock GetPlayerVehicleSlots( playerid )
{
static const
slots[ 4 ] = { 3, 5, 10, 20 };
new vip_level = GetPlayerVIPLevel( playerid );
return slots[ ( vip_level > VIP_GOLD ? VIP_GOLD : vip_level ) ] + p_ExtraAssetSlots{ playerid };
}
stock GetPlayerPimpVehicleSlots( playerid )
{
static const
slots[ 4 ] = { 3, 4, 6, 10 };
new vip_level = GetPlayerVIPLevel( playerid );
return slots[ ( vip_level > VIP_GOLD ? VIP_GOLD : vip_level ) ];
}
stock VIPToString( viplvl )
{
static
string[ 16 ];
switch( viplvl )
{
case VIP_DIAMOND: string = "Legacy Diamond";
case VIP_PLATINUM: string = "Legacy Platinum";
case VIP_GOLD: string = "Gold";
case VIP_BRONZE: string = "Bronze";
case VIP_REGULAR: string = "Regular";
default: string = "N/A";
}
return string;
}