diff --git a/gamemodes/irresistible/cnr/_cnr.pwn b/gamemodes/irresistible/cnr/_cnr.pwn index 2d6606c..176f977 100644 --- a/gamemodes/irresistible/cnr/_cnr.pwn +++ b/gamemodes/irresistible/cnr/_cnr.pwn @@ -12,9 +12,8 @@ #include "irresistible\cnr\global.pwn" #include "irresistible\cnr\classes.pwn" #include "irresistible\cnr\textdraws.pwn" -#include "irresistible\cnr\cities.pwn" +#include "irresistible\cnr\spawn.pwn" #include "irresistible\cnr\dialog_ids.pwn" -#include "irresistible\cnr\vip.pwn" // static cnr features #include "irresistible\cnr\static\_cnr_static.pwn" diff --git a/gamemodes/irresistible/cnr/features/_features.pwn b/gamemodes/irresistible/cnr/features/_features.pwn index 5d7d65d..7d45cc0 100644 --- a/gamemodes/irresistible/cnr/features/_features.pwn +++ b/gamemodes/irresistible/cnr/features/_features.pwn @@ -8,10 +8,13 @@ /* ** Includes ** */ // core +#include "irresistible\cnr\features\vip.pwn" +#include "irresistible\cnr\features\irresistibleguard.pwn" + +// other #include "irresistible\cnr\features\fps.pwn" #include "irresistible\cnr\features\radio.pwn" #include "irresistible\cnr\features\cash_cards.pwn" -#include "irresistible\cnr\features\furniture.pwn" #include "irresistible\cnr\features\weapon_drop.pwn" #include "irresistible\cnr\features\ammunation.pwn" #include "irresistible\cnr\features\duel.pwn" diff --git a/gamemodes/irresistible/cnr/features/irresistibleguard.pwn b/gamemodes/irresistible/cnr/features/irresistibleguard.pwn new file mode 100644 index 0000000..bad7fcb --- /dev/null +++ b/gamemodes/irresistible/cnr/features/irresistibleguard.pwn @@ -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 ** */ diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index da3f9f4..bf87eb9 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -87,7 +87,6 @@ new bool: False = false; #define IsPlayerInPlayerGang(%0,%1) (p_Class[%0] == p_Class[%1] && p_Class[%0] == CLASS_CIVILIAN && p_GangID[%0] == p_GangID[%1] && p_GangID[%0] != INVALID_GANG_ID) #define IsPlayerNpcEx(%0) (IsPlayerNPC(%0) || strmatch(p_PlayerIP[%0], "127.0.0.1")) #define GetBusinessSecurity(%0) (g_businessSecurityData[%0][E_LEVEL]) -#define ResetSpawnLocation(%0) SetPlayerSpawnLocation(%0, "") // #define ITER_NONE -1 @@ -159,7 +158,6 @@ enum E_DONATION_DATA /* ** Progress Bars ** */ #define PROGRESS_CRACKING 0 -#define PROGRESS_BRUTEFORCE 1 #define PROGRESS_ROBTRUCK 2 #define PROGRESS_MINING 3 #define PROGRESS_ROBBING 4 @@ -332,367 +330,6 @@ stock const } ; -/* ** Player Spawns ** */ -enum E_RANDOM_SPAWNS -{ - Float:RANDOM_SPAWN_X, - Float:RANDOM_SPAWN_Y, - Float:RANDOM_SPAWN_Z, - Float:RANDOM_SPAWN_A, - RANDOM_SPAWN_INTERIOR, - RANDOM_SPAWN_WORLD -}; - -stock const - g_SanFierroSpawns[ ] [ E_RANDOM_SPAWNS ] = - { - { -2097.5737, 715.2664, 69.5625, 277.9042, 0, 0 }, - { -1757.4670, 961.8670, 24.8828, 181.7833, 0, 0 }, - { -1953.8724, 300.1801, 41.0471, 133.1765, 0, 0 }, - { -2020.3107, -96.6103, 35.1641, 331.9525, 0, 0 }, - { -2343.3860, -138.315, 35.3203, 3.2265, 0, 0 }, - { -2519.0496, -30.7666, 25.6172, 319.5007, 0, 0 }, - { -2759.6978, 375.4238, 4.5230, 270.5632, 0, 0 }, - { -2474.5874, 1264.014, 28.7647, 275.3246, 0, 0 }, - { -1501.3506, 914.5378, 7.1875, 90.5807, 0, 0 }, - { -2238.6428, 113.4054, 35.3203, 243.0862, 0, 0 }, - { -1983.5684, 129.8655, 27.6875, 74.4550, 0, 0 }, - { -2626.2156, 1398.626, 7.1016, 204.5252, 0, 0 }, - { -2626.2156, 1398.626, 7.1016, 204.5252, 0, 0 }, - { -2587.4861, 212.0579, 9.0733, 9.073300, 0, 0 } - }, - - g_LasVenturasSpawns[ ] [ E_RANDOM_SPAWNS ] = - { - { 2170.4834, 1714.3723, 11.0469, 137.5881, 0, 0 }, - { 2000.1403, 1564.7941, 15.3672, 236.5212, 0, 0 }, - { 2417.5991, 1136.6140, 10.8125, 225.6512, 0, 0 }, - { 2484.6160, 1528.7273, 10.8954, 323.0129, 0, 0 }, - { 2464.4070, 2033.2441, 11.0625, 47.88940, 0, 0 }, - { 2451.2332, 2347.0044, 12.1635, 112.7286, 0, 0 }, - { 1480.3296, 2250.1125, 11.0291, 279.2149, 0, 0 }, - { 2143.3252, 2840.4441, 10.8203, 139.9116, 0, 0 } - }, - - g_LosSantosSpawns[ ] [ E_RANDOM_SPAWNS ] = - { - { 810.63520, -1340.0682, 13.5386, 37.33070, 0, 0 }, - { 1124.6071, -1427.5155, 15.7969, 350.9336, 0, 0 }, - { 585.81520, -1247.9160, 17.9521, 335.6035, 0, 0 }, - { 2025.2626, -1423.2682, 16.9922, 135.4516, 0, 0 }, - { 2509.2468, -1679.2029, 13.5469, 50.24740, 0, 0 }, - { 1457.1467, -1011.7307, 26.8438, 51.79910, 0, 0 }, - { 2017.8206, -1279.4851, 23.9820, 47.38920, 0, 0 }, - { 1935.7644, -1794.6068, 13.5469, 295.5515, 0, 0 }, - { 1371.4569, -1090.6387, 24.5459, 92.84640, 0, 0 }, - { 2298.4055, -1500.3264, 25.3047, 199.6940, 0, 0 } - }, - - g_FiremanSpawns[ MAX_CITIES ] [ E_RANDOM_SPAWNS ] = - { - { -2026.3287, 67.1439, 28.6916, 270.0000, 0, 0 }, - { 1744.56240, 2079.43, 10.8203, 172.1325, 0, 0 }, - { 1757.44350, -1456.7, 13.5469, 282.4133, 0, 0 } - }, - - g_MedicSpawns[ MAX_CITIES ] [ E_RANDOM_SPAWNS ] = - { - { -2658.0764, 634.333, 14.4531, 180.0000, 0, 0 }, - { 1615.62490, 1840.19, 10.9696, 0.000000, 0, 0 }, - { 1178.04170, -1323.6, 14.1005, 285.5701, 0, 0 } - }, - - g_ArmySpawns[ MAX_CITIES ] [ E_RANDOM_SPAWNS ] = - { - { -1401.8173, 493.496, 18.2294, 0.000000, 0, 0 }, - { 199.572200, 1920.97, 17.6406, 180.0000, 0, 0 }, - { 1229.35670, -2611.4, 19.7344, 264.2092, 0, 0 } - }, - - g_CIASpawns[ MAX_CITIES ] [ E_RANDOM_SPAWNS ] = - { - { -2455.4487, 503.92360, 30.078, 270.000, 0, 0 }, - { 940.813400, 1733.6327, 8.8516, 270.000, 0, 0 }, - { 1518.82930, -1452.430, 14.203, 0.00000, 0, 0 } - }, - - g_PoliceSpawns[ MAX_CITIES ] [ E_RANDOM_SPAWNS ] = - { - { -1606.3693, 674.1749, -5.2422, 0.0000, 0, 0 }, - { 2295.62960, 2468.796, 10.8203, 90.000, 0, 0 }, - { 1528.58340, -1677.49, 5.89060, 270.00, 0, 0 } - } -; - -/* ** House System ** */ -#define MAX_HOUSES ( 2000 ) -#define MAX_FURNITURE ( 50 ) -#define MAX_HOUSE_WEAPONS ( 7 ) // Don't change... -#define HOUSE_MAPICON_RADIUS ( 25.0 ) - -// Furniture Categories -#define FC_DOORS 0 -#define FC_TABLECHAIR 1 -#define FC_FITNESS 2 -#define FC_KITCHENBATH 3 -#define FC_ELECTRONIC 4 -#define FC_BEDROOM 5 -#define FC_LOUNGE 6 -#define FC_FLOWERS 7 -#define FC_MISC 8 -#define FC_WEAPONS 9 -#define FC_HOLIDAYS 10 -#define FC_FOODRINK 11 - -enum E_HOUSE_DATA -{ - E_OWNER[ 24 ], E_HOUSE_NAME[ 30 ], - - Float: E_EX, Float: E_EY, Float: E_EZ, - Float: E_TX, Float: E_TY, Float: E_TZ, - - E_COST, E_INTERIOR_ID, E_CHECKPOINT[ 2 ], - E_WORLD, Text3D: E_LABEL [ 2 ], E_PASSWORD[ 5 ], - - bool: E_CRACKED, bool: E_BEING_CRACKED, E_CRACKED_TS, - E_CRACKED_WAIT, E_MAP_ICON -}; - -enum E_HINTERIOR_DATA -{ - E_NAME[ 19 ], Float: E_EX, Float: E_EY, - Float: E_EZ, E_INTERIOR_ID, E_COST, - bool: E_VIP, Float: E_PREVIEW_POS[ 3 ], Float: E_PREVIEW_LOOKAT[ 3 ] -}; - -enum E_FURINTURE_DATA -{ - E_CATEGORY, E_NAME[ 21 ], E_MODEL, - E_COST -}; - -#define H_DEFAULT_X 266.4996 -#define H_DEFAULT_Y 304.9577 -#define H_DEFAULT_Z 999.1484 - -new - g_houseInteriors[ ] [ E_HINTERIOR_DATA ] = - { - { "Cattus Interior", H_DEFAULT_X, H_DEFAULT_Y, H_DEFAULT_Z, 2, 0, false, { 266.60010, 302.42820, 999.14840 }, { 271.44260, 306.64240, 999.15580 } }, - { "Assum Interior", 243.71980, 304.963500, 999.14840, 1, 10000, false, { 249.61870, 300.89080, 999.14840 }, { 244.85410, 305.49680, 999.14840 } }, - { "Fossor Interior", 2218.4036, -1076.2621, 1050.4844, 1, 15000, false, { 2202.6704, -1078.198, 1050.4844 }, { 2211.8030, -1074.362, 1050.4844 } }, - //{ "Angusto Interior", 260.98790, 1284.29470, 1080.2578, 4, 20000, false, { 253.80180, 1294.2167, 1080.2578 }, { 258.55260, 1288.3639, 1080.2578 } }, - { "Organum Interior", 309.37170, 311.674700, 1003.3047, 4, 25000, false, { 310.13720, 310.80550, 1003.3047 }, { 300.02930, 300.86170, 1003.5391 } }, - //{ "Bulbus Interior", -68.84510, 1351.19570, 1080.2109, 6, 25000, false, { -71.41990, 1366.0359, 1080.2185 }, { -64.59070, 1360.7052, 1080.2185 } }, - //{ "Vindemia Interior", 295.08510, 1472.25520, 1080.2578, 15, 25000, false, { 290.14430, 1488.8372, 1080.2578 }, { 294.96960, 1483.6603, 1080.2578 } }, - { "Aurora Interior", -2170.344, 639.502500, 1052.3750, 1, 30000, false, { -2168.073, 646.40000, 1057.5938 }, { -2158.598, 638.13010, 1057.5861 } }, - { "Fragor Interior", 318.58580, 1114.47920, 1083.8828, 5, 35000, false, { 326.31450, 1117.5468, 1083.8828 }, { 317.28550, 1122.6113, 1083.8828 } }, - //{ "Mundus Interior", 24.012500, 1340.15890, 1084.3750, 10, 40000, false, { 19.801100, 1340.7814, 1084.3750 }, { 34.253800, 1342.9272, 1084.3750 } }, - { "Artus Interior", 2237.5259, -1081.6458, 1049.0234, 2, 40000, false, { 2236.2290, -1081.065, 1049.0234 }, { 2244.2285, -1069.357, 1049.0234 } }, - { "Caelum Interior", 2233.6931, -1115.2620, 1050.8828, 5, 40000, false, { 2235.1128, -1114.911, 1050.8828 }, { 2229.8982, -1105.175, 1050.8903 } }, - { "Rotta Interior", 2495.9663, -1692.0857, 1014.7422, 3, 50000, false, { 2491.1794, -1694.953, 1014.7461 }, { 2497.4587, -1704.258, 1014.7422 } }, - { "Ascensor Interior", 2317.8369, -1026.7662, 1050.2178, 9, 50000, false, { 2320.9111, -1025.776, 1050.2109 }, { 2319.0242, -1014.091, 1050.2109 } }, - { "Colonel Interior", 2807.5693, -1174.7520, 1025.5703, 8, 60000, false, { 2812.0911, -1173.043, 1025.5703 }, { 2806.0210, -1165.486, 1025.5703 } }, - //{ "Godfather Interior", 140.28170, 1365.92150, 1083.8594, 5, 65000, false, { 135.53440, 1366.6400, 1083.8615 }, { 143.49590, 1375.7461, 1083.8668 } }, - { "Recens Interior", 2270.4192, -1210.5172, 1047.5625, 10, 70000, false, { 2248.2854, -1207.207, 1049.0234 }, { 2261.0574, -1213.011, 1049.0234 } }, - { "Novus Interior", 2365.2341, -1135.5957, 1050.8826, 8, 72000, false, { 2375.3567, -1121.340, 1050.8750 }, { 2367.7095, -1130.863, 1050.8826 } }, - { "Securuse Interior", 2324.3826, -1149.5442, 1050.7101, 12, 80000, false, { 2317.5684, -1136.016, 1054.3047 }, { 2333.1262, -1147.694, 1050.7031 } }, - //{ "Lorem Interior", 234.13900, 1063.72110, 1084.2123, 6, 82500, false, { 235.83530, 1070.2394, 1084.1903 }, { 226.63560, 1073.0388, 1086.2266 } }, - //{ "Domus Interior", 225.73480, 1021.44500, 1084.0177, 7, 120000, false, { 224.76680, 1022.3558, 1084.0150 }, { 241.65380, 1037.2081, 1084.0118 } }, - { "Madd Doggs Mansion", 1260.6455, -785.46530, 1091.9063, 5, 1337, true , { 1262.1033, -772.6712, 1091.9063 }, { 1282.7361, -783.5193, 1089.9375 } }, - { "Butcher Interior", 964.93310, 2160.13210, 1011.0303, 1, 1337, true , { 933.67050, 2118.9556, 1012.8329 }, { 947.38930, 2163.8730, 1011.0234 } }, - { "Bar Interior", 501.93780, -67.563000, 998.75780, 11, 1337, true , { 511.80380, -68.01930, 999.25000 }, { 490.78870, -78.92080, 998.75780 } }, - { "Casino Interior", 1133.1831, -15.833100, 1000.6797, 12, 1337, true , { 1114.8433, -12.31790, 1003.0643 }, { 1136.3059, 2.6477000, 1000.6797 } } - }, - g_furnitureCategory[ ] [ ] = - { - { "Doors" }, { "Tables and Chairs" }, { "Fitness" }, { "Kitchen and Bathroom" }, { "Electronics" }, { "Bedroom" }, - { "Lounge" }, { "Flowers and Plants" }, { "Miscellaneous" }, { "Weapons" }, { "Holiday" }, { "Food/Drink" } - }, - g_houseFurniture[ ] [ E_FURINTURE_DATA ] = - { - // Doors - { FC_DOORS, "Red Door", 1504, 175 }, - { FC_DOORS, "Blue Door", 1505, 175 }, - { FC_DOORS, "White Door", 1506, 175 }, - { FC_DOORS, "Yellow Door", 1507, 175 }, - // Tables and Chairs - { FC_TABLECHAIR, "Wooden Open Table", 1817, 50 }, - { FC_TABLECHAIR, "Dining Chair", 2079, 60 }, - { FC_TABLECHAIR, "Office Chair", 1806, 62 }, - { FC_TABLECHAIR, "Wooden Circle Table", 1815, 75 }, - { FC_TABLECHAIR, "Cluckin' Table Sml", 2763, 80 }, - { FC_TABLECHAIR, "Cluckin' Table", 2762, 125 }, - { FC_TABLECHAIR, "Dining Table", 2115, 135 }, - { FC_TABLECHAIR, "Circle Dining Chair", 2125, 135 }, - { FC_TABLECHAIR, "Circle Dining Table", 2030, 150 }, - { FC_TABLECHAIR, "Swivel Chair", 1663, 180 }, - { FC_TABLECHAIR, "Rocking Chair", 11734, 200 }, - { FC_TABLECHAIR, "Gamer Chair", 19999, 320 }, - { FC_TABLECHAIR, "Poker Table", 19474, 500 }, - { FC_TABLECHAIR, "Lab Table", 3383, 900 }, - // Fitness - { FC_FITNESS, "Mattress #1", 2815, 50 }, - { FC_FITNESS, "Mattress #2", 2817, 50 }, - { FC_FITNESS, "Mattress #3", 2833, 50 }, - { FC_FITNESS, "Mattress #4", 2836, 50 }, - { FC_FITNESS, "Mattress #5", 2847, 50 }, - { FC_FITNESS, "Cycle", 2630, 950 }, - { FC_FITNESS, "Treadmill", 2627, 1250 }, - { FC_FITNESS, "Weight Lifting", 2628, 1550 }, - // Kitchen and Bathroom - { FC_KITCHENBATH, "Soap", 19874, 15 }, - { FC_KITCHENBATH, "Toilet Paper", 19873, 20 }, - { FC_KITCHENBATH, "Towel holder", 11707, 300 }, - { FC_KITCHENBATH, "Double Metal Cabin", 2007, 400 }, - { FC_KITCHENBATH, "Metal Shelf x4", 2063, 400 }, - { FC_KITCHENBATH, "Metal Table", 941, 500 }, - { FC_KITCHENBATH, "Metal Counter", 937, 600 }, - { FC_KITCHENBATH, "Metal Bench-top", 936, 685 }, - { FC_KITCHENBATH, "Toilet", 2514, 700 }, - { FC_KITCHENBATH, "Bathroom Sink", 2523, 900 }, - { FC_KITCHENBATH, "Wooden Double Draw", 2139, 910 }, - { FC_KITCHENBATH, "Wooden Low-unit", 2138, 925 }, - { FC_KITCHENBATH, "Washing Machine", 1208, 925 }, - { FC_KITCHENBATH, "Laundry Unit", 2303, 980 }, - { FC_KITCHENBATH, "White Bath Tub", 2519, 1000 }, - { FC_KITCHENBATH, "Corner Wooden Bench", 2305, 1100 }, - { FC_KITCHENBATH, "Wooden Bench w/ Sink", 2136, 1185 }, - { FC_KITCHENBATH, "Stable Counter", 2339, 1200 }, - { FC_KITCHENBATH, "Bath Tub", 2526, 1200 }, - { FC_KITCHENBATH, "Shower System", 14481, 1290 }, - { FC_KITCHENBATH, "Stable Shelf", 2141, 1300 }, - { FC_KITCHENBATH, "Stable Sink", 2132, 1500 }, - { FC_KITCHENBATH, "Love Spa", 11732, 2000 }, - { FC_KITCHENBATH, "Cooker and Oven", 2135, 2200 }, - { FC_KITCHENBATH, "Deep Fryer", 2413, 2300 }, - // Electronics - { FC_ELECTRONIC, "Blender", 19830, 120 }, - { FC_ELECTRONIC, "Mini Stereo Speaker", 2233, 450 }, - { FC_ELECTRONIC, "Coffee Machine", 11743, 500 }, - { FC_ELECTRONIC, "Red Guitar", 19317, 650 }, - { FC_ELECTRONIC, "White Guitar", 19318, 675 }, - { FC_ELECTRONIC, "Bass speaker", 2229, 675 }, - { FC_ELECTRONIC, "Black Guitar", 19319, 700 }, - { FC_ELECTRONIC, "8 Bit TV", 1748, 700 }, - { FC_ELECTRONIC, "VCR Player", 1719, 900 }, - { FC_ELECTRONIC, "Gaming Console", 2028, 1000 }, - { FC_ELECTRONIC, "Small TV with VCR", 2595, 1100 }, - { FC_ELECTRONIC, "Laptop", 19893, 1250 }, - { FC_ELECTRONIC, "TV Small", 1518, 1575 }, - { FC_ELECTRONIC, "Swank TV", 1792, 1600 }, - { FC_ELECTRONIC, "TV with Wall Hook", 2596, 1790 }, - { FC_ELECTRONIC, "TV With Stance", 1717, 2000 }, - { FC_ELECTRONIC, "Doozy TV with Stance", 2224, 2050 }, - { FC_ELECTRONIC, "Stereo System", 2100, 2175 }, - { FC_ELECTRONIC, "Wide-screen TV", 1786, 2500 }, - { FC_ELECTRONIC, "Huge LCD", 19786, 3000 }, - { FC_ELECTRONIC, "Small TV Unit", 2297, 3700 }, - { FC_ELECTRONIC, "TV Unit", 2296, 4000 }, - { FC_ELECTRONIC, "PC with Desk", 2181, 4200 }, - // Bedroom - { FC_BEDROOM, "Wooden Stance", 1743, 650 }, - { FC_BEDROOM, "Wooden Counter", 1416, 750 }, - { FC_BEDROOM, "Wooden Drawer", 1417, 800 }, - { FC_BEDROOM, "Hobo bed", 1745, 800 }, - { FC_BEDROOM, "Luxurious bed", 2298, 1300 }, - { FC_BEDROOM, "Super Luxurious bed", 2563, 1750 }, - { FC_BEDROOM, "Lavish Red Bed", 11720, 2000 }, - { FC_BEDROOM, "Love Bed", 11731, 4200 }, - // Lounge - { FC_LOUNGE, "Wooden Couch", 1755, 275 }, - { FC_LOUNGE, "Couch", 1754, 350 }, - { FC_LOUNGE, "Leather Couch", 1702, 500 }, - { FC_LOUNGE, "Single Couch", 1704, 850 }, - { FC_LOUNGE, "Luxury Mattress", 1828, 900 }, - { FC_LOUNGE, "Bookshelf", 1742, 1000 }, - { FC_LOUNGE, "Leather Couch", 1723, 1650 }, - { FC_LOUNGE, "TV Stand", 2313, 1700 }, - { FC_LOUNGE, "Fireplace", 11724, 4800 }, - { FC_LOUNGE, "Chandelier", 19806, 5200 }, - // Flowers and plants - { FC_FLOWERS, "Flower Plant 3", 2001, 30 }, - { FC_FLOWERS, "Flower Plant 4", 2253, 35 }, - { FC_FLOWERS, "Clear Flower Vase", 2247, 35 }, - { FC_FLOWERS, "Painted Flower Vase", 2251, 40 }, - { FC_FLOWERS, "Plant Vase", 2245, 50 }, - { FC_FLOWERS, "Flower Wall-Mount", 3810, 120 }, - { FC_FLOWERS, "Weed Plant", 19473, 2250 }, - // Miscellaneous - { FC_MISC, "Chainsaw Dildo", 19086, 69 }, - { FC_MISC, "Massive Die", 1851, 80 }, - { FC_MISC, "Deer Head Mount", 1736, 120 }, - { FC_MISC, "Striped Surfboard", 2404, 140 }, - { FC_MISC, "Beach Surfboard", 2406, 150 }, - { FC_MISC, "Flamed Torch", 3461, 175 }, - { FC_MISC, "Rocking Unicorn", 11733, 180 }, - { FC_MISC, "Do Not Cross Tape", 19834, 250 }, - { FC_MISC, "Grill", 19831, 300 }, - { FC_MISC, "Boxing Bag", 1985, 300 }, - { FC_MISC, "Car Engine", 19917, 500 }, - { FC_MISC, "Drum Kit", 19609, 800 }, - { FC_MISC, "Mechanic Computer", 19903, 1000 }, - { FC_MISC, "Pool Table", 2964, 1250 }, - { FC_MISC, "Cow", 19833, 1337 }, - { FC_MISC, "Deer", 19315, 1337 }, - { FC_MISC, "Money Safe", 2332, 2000 }, - { FC_MISC, "Mechanic Shelves", 19899, 2000 }, - { FC_MISC, "Dance Floor", 19128, 3250 }, - { FC_MISC, "Craps Table", 1824, 4000 }, - { FC_MISC, "Boxing Arena", 14781, 15000 }, - // Weapons - { FC_WEAPONS, "Brass Knuckles", 331, 25 }, - { FC_WEAPONS, "Pool Cue", 338, 40 }, - { FC_WEAPONS, "Parachute", 371, 60 }, - { FC_WEAPONS, "Purple Dildo", 321, 69 }, - { FC_WEAPONS, "Sledge Hammer", 19631, 90 }, - { FC_WEAPONS, "Landmine", 19602, 100 }, - { FC_WEAPONS, "Ammo Box", 19832, 120 }, - { FC_WEAPONS, "Antique Sword", 19590, 250 }, - { FC_WEAPONS, "Mac 10", 352, 250 }, - { FC_WEAPONS, "Tec 9", 372, 290 }, - { FC_WEAPONS, "Rifle", 357, 300 }, - { FC_WEAPONS, "Desert Eagle", 348, 500 }, - { FC_WEAPONS, "Shotgun", 349, 600 }, - { FC_WEAPONS, "Sawn-off Shotgun", 350, 800 }, - { FC_WEAPONS, "Sniper", 358, 800 }, - { FC_WEAPONS, "Spas 12", 351, 900 }, - { FC_WEAPONS, "M4", 356, 900 }, - { FC_WEAPONS, "Minigun", 362, 1337 }, - { FC_WEAPONS, "Heatseeker", 360, 1337 }, - { FC_WEAPONS, "RPG", 359, 1337 }, - // Holiday - { FC_HOLIDAYS, "Xmas Box 1", 19054, 100 }, - { FC_HOLIDAYS, "Xmas Box 2", 19055, 100 }, - { FC_HOLIDAYS, "Xmas Box 3", 19056, 100 }, - { FC_HOLIDAYS, "Xmas Box 4", 19057, 100 }, - { FC_HOLIDAYS, "Xmas Box 5", 19058, 100 }, - { FC_HOLIDAYS, "Witch Pot", 19527, 200 }, - { FC_HOLIDAYS, "Devil Face", 11704, 666 }, - { FC_HOLIDAYS, "Xmas Tree", 19076, 777 }, - // Food/Drink - { FC_FOODRINK, "Pizza Box", 19571, 10 }, - { FC_FOODRINK, "Coffee Mug", 19835, 15 }, - { FC_FOODRINK, "Pizza", 19580, 30 }, - { FC_FOODRINK, "Ordinary Brandy", 19821, 45 }, - { FC_FOODRINK, "Fine Scotch", 19823, 90 }, - { FC_FOODRINK, "Beer Keg", 19812, 150 }, - { FC_FOODRINK, "Vintage Whiskey", 19824, 155 }, - { FC_FOODRINK, "Premium Brandy", 19820, 190 }, - { FC_FOODRINK, "Premium Wine", 19822, 220 } - }, - g_houseData [ MAX_HOUSES ] [ E_HOUSE_DATA ], - Iterator: houses < MAX_HOUSES >, - - szg_houseInteriors [ 24 * sizeof( g_houseInteriors ) ], - g_HouseWeapons [ MAX_HOUSES ] [ MAX_HOUSE_WEAPONS ], - g_HouseWeaponAmmo [ MAX_HOUSES ] [ MAX_HOUSE_WEAPONS ], - - // furniture v2 - g_houseFurnitureData [ MAX_HOUSES ] [ MAX_FURNITURE ], - Iterator: housefurniture [ MAX_HOUSES ] < MAX_FURNITURE > -; - /* ** Bribe Data ** */ #define MAX_BRIBES ( 200 ) #define MAX_BRIBE_WAIT ( 300000 ) @@ -2513,21 +2150,6 @@ new Iterator:WeaponLockers< MAX_WEAPON_LOCKERS > ; -/* ** Security System ** */ -#define SECURITY_MODE_MILD ( 0 ) -#define SECURITY_MODE_PARANOID ( 1 ) -#define SECURITY_MODE_DISABLED ( 2 ) - -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 ] -; - /* ** Race System ** */ #define MAX_RACES ( 32 ) @@ -2822,10 +2444,6 @@ public OnGameModeInit() initializeActors( ); /* ** Loading default string values - Makes it efficient. ** */ - for( new i = 0; i < sizeof( g_houseInteriors ); i++ ) { - format( szg_houseInteriors, sizeof( szg_houseInteriors ), "%s%s%s\n", szg_houseInteriors, g_houseInteriors[ i ] [ E_VIP ] ? ( COL_GOLD ) : "", g_houseInteriors[ i ] [ E_NAME ] ); - } - for( new i = 0; i < sizeof( g_garageInteriorData ); i++ ) format( szg_garageInteriors, sizeof( szg_garageInteriors ), "%s"COL_GREY"%d Vehicle Slots"COL_WHITE"\t%s\n", szg_garageInteriors, g_garageInteriorData[ i ] [ E_VEHICLE_CAPACITY ], g_garageInteriorData[ i ] [ E_NAME ] ); @@ -3888,7 +3506,7 @@ public OnGameModeInit() printf( "[ROBBERIES]: %d robberies have been successfully loaded.", Iter_Count(RobberyCount) ); printf( "[ROBBERIES]: %d robbery NPCs have been successfully loaded.", Iter_Count(RobberyNpc) ); - mysql_function_query( dbHandle, "SELECT * FROM `HOUSES`", true, "OnHouseLoad", "" ); + // mysql_function_query( dbHandle, "SELECT * FROM `HOUSES`", true, "OnHouseLoad", "" ); mysql_function_query( dbHandle, "SELECT * FROM `BRIBES`", true, "OnBribeLoad", "" ); mysql_function_query( dbHandle, "SELECT * FROM `APARTMENTS`", true, "OnApartmentLoad", "" ); mysql_function_query( dbHandle, "SELECT * FROM `FURNITURE`", true, "OnFurnitureLoad", "" ); @@ -4053,7 +3671,7 @@ public OnPlayerSelectDynamicObject( playerid, objectid, modelid, Float:x, Float: if ( houseid == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( ! IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); if ( isFurnitureObject( modelid ) ) @@ -4119,7 +3737,6 @@ public OnPlayerEditDynamicObject( playerid, objectid, response, Float:x, Float:y return 1; } - #if ENABLE_COMPONENTS_SYSTEM == true if ( GetPVarType( playerid, "components_editing" ) != 0 ) { @@ -4224,7 +3841,7 @@ public OnPlayerEditDynamicObject( playerid, objectid, response, Float:x, Float:y if ( houseid != editing_house ) return SendError( playerid, "There was an issue editing the furniture of this home, try again." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( ! IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); static Float: lastX, Float: lastY, Float: lastZ; @@ -5964,9 +5581,6 @@ public OnPlayerDisconnect( playerid, reason ) resetPlayerToys( playerid, 0 ); resetPlayerToys( playerid, 1 ); resetPlayerToys( playerid, 2 ); - p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false; - p_accountSecurityData[ playerid ] [ E_ID ] = 0; - p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0; DestroyDynamicObject( p_HighrollersBarrier[ playerid ] [ 0 ] ), p_HighrollersBarrier[ playerid ] [ 0 ] = -1; DestroyDynamicObject( p_HighrollersBarrier[ playerid ] [ 1 ] ), p_HighrollersBarrier[ playerid ] [ 1 ] = -1; @@ -9585,43 +9199,6 @@ CMD:robitems( playerid, params[ ] ) return 1; } -CMD:bruteforce( playerid, params[ ] ) -{ - /* ** ANTI SPAM ** */ - if ( GetPVarInt( playerid, "last_bruteforce" ) > g_iTime ) return SendError( playerid, "You must wait 30 seconds before using this command again." ); - /* ** END OF ANTI SPAM ** */ - - if ( p_Class[ playerid ] != CLASS_POLICE ) return SendError( playerid, "This command is restricted for F.B.I agents." ); - if ( !( p_inFBI{ playerid } == true && p_inArmy{ playerid } == false && p_inCIA{ playerid } == false ) ) return SendError( playerid, "This command is restricted for F.B.I agents." ); - - foreach ( new i : houses ) - { - if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) && !strmatch( g_houseData[ i ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) - { - if ( g_iTime > g_houseData[ i ] [ E_CRACKED_TS ] && g_houseData[ i ] [ E_CRACKED ] ) g_houseData[ i ] [ E_CRACKED ] = false; // The Virus Is Disabled. - - if ( g_houseData[ i ] [ E_CRACKED_WAIT ] > g_iTime ) - return SendError( playerid, "This house had its password recently had a cracker run through. Come back later." ); - - if ( strmatch( g_houseData[ i ] [ E_PASSWORD ], "N/A" ) ) - return SendError( playerid, "This house does not require cracking as it doesn't have a password." ); - - if ( g_houseData[ i ] [ E_CRACKED ] || g_houseData[ i ] [ E_BEING_CRACKED ] ) - return SendError( playerid, "This house is currently being cracked or is already cracked." ); - - if ( IsHouseOnFire( i ) ) - return SendError( playerid, "This house is on fire, you cannot bruteforce it!" ), 1; - - g_houseData[ i ] [ E_BEING_CRACKED ] = true; - p_HouseCrackingPW[ playerid ] = i; - SetPVarInt( playerid, "last_bruteforce", g_iTime + 30 ); - ShowProgressBar( playerid, "Brute Forcing Password", PROGRESS_BRUTEFORCE, 5000, COLOR_BLUE ); - return 1; - } - } - SendError( playerid, "You are not standing in any house checkpoint." ); - return 1; -} CMD:pdjail( playerid, params[ ] ) { @@ -9737,7 +9314,7 @@ CMD:burglar( playerid, params[ ] ) if ( houseid == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You can't steal a piece of furniture from your house!" ); new Float: distance = 99999.99, furniture_slot = ITER_NONE; @@ -11884,218 +11461,6 @@ CMD:setspike( playerid, params[ ] ) return 1; } -CMD:h( 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 ( ! p_VIPLevel[ playerid ] && p_OwnedHouses[ playerid ] > GetPlayerHouseSlots( playerid ) && ! strmatch( params, "sell" ) ) { - ResetSpawnLocation( playerid ); - return SendError( playerid, "Please renew your V.I.P or sell this home to match your house allocated limit (/h sell)." ); - } - - new - ID = p_InHouse[ playerid ], - query[ 140 ] - ; - if ( strmatch( params, "spawn" ) ) - { - SendServerMessage( playerid, "We have changed the command to simply "COL_GREY"/spawn"COL_WHITE"." ); - return ShowPlayerSpawnMenu( playerid ); - } - else if ( strmatch( params, "config" ) ) - { - if ( ID == -1 ) return SendError( playerid, "You're not in any house." ); - else if ( !strmatch( g_houseData[ ID ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - else - { - ShowPlayerDialog( playerid, DIALOG_HOUSE_CONFIG, DIALOG_STYLE_LIST, "{FFFFFF}House Configuration", "Set House Title\nUpgrade Interior\nSet House Password\nWeapon Storage\nFurniture", "Select", "Cancel" ); - } - return 1; - } - else if ( strmatch( params, "buy" ) ) - { - if ( p_OwnedHouses[ playerid ] >= GetPlayerHouseSlots( playerid ) ) return SendError( playerid, "You cannot purchase any more houses, you've reached the limit." ); - if ( GetPlayerScore( playerid ) < 200 ) return SendError( playerid, "You need at least 200 score to buy a house." ); - - foreach ( new i : houses ) - { - if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) || ( ID != -1 && ID == i ) ) - { - if ( strmatch( g_houseData[ i ] [ E_OWNER ], "No-one" ) ) - { - if ( GetPlayerCash( playerid ) < g_houseData[ i ] [ E_COST ] ) - return SendError( playerid, "You don't have enough money to purchase this house." ); - - if ( g_houseData[ i ] [ E_COST ] == 1337 && !p_VIPLevel[ playerid ] ) - return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); - - GivePlayerCash( playerid, -( g_houseData[ i ] [ E_COST ] ), .force_save = true ); - SendServerMessage( playerid, "You have bought this home for "COL_GOLD"%s"COL_WHITE"!", number_format( g_houseData[ i ] [ E_COST ] ) ); - SetHouseOwner( i, ReturnPlayerName( playerid ) ); - - p_OwnedHouses[ playerid ] ++; - return 1; - } - else return SendError( playerid, "This house isn't for sale." ); - } - } - return SendError( playerid, "You are not around any house entrances." ); - } - else if ( strmatch( params, "sell" ) ) - { - if ( ID == -1 ) return SendError( playerid, "You're not in any house." ); - else if ( !strmatch( g_houseData[ ID ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - else - { - format( szBigString, sizeof( szBigString ), "[SELL] [%s] %s | %s | %d\r\n", getCurrentDate( ), ReturnPlayerName( playerid ), g_houseData[ ID ][ E_OWNER ], ID ); - AddFileLogLine( "log_houses.txt", szBigString ); - p_OwnedHouses[ playerid ] --; - format( g_houseData[ ID ] [ E_PASSWORD ], 4, "N/A" ); - format( g_houseData[ ID ] [ E_OWNER ], 7, "No-one" ); - format( g_houseData[ ID ] [ E_HOUSE_NAME ], 5, "Home" ); - for( new i; i < MAX_HOUSE_WEAPONS; i++ ) { g_HouseWeapons[ ID ] [ i ] = 0, g_HouseWeaponAmmo[ ID ] [ i ] = -1; } - SaveHouseWeaponStorage( ID ); - GivePlayerCash( playerid, ( g_houseData[ ID ] [ E_COST ] / 2 ) ); - destroyAllFurniture( ID ); - FillHomeWithFurniture( ID, 0 ); - g_houseData[ ID ] [ E_TX ] = g_houseInteriors[ 0 ] [ E_EX ]; - g_houseData[ ID ] [ E_TY ] = g_houseInteriors[ 0 ] [ E_EY ]; - g_houseData[ ID ] [ E_TZ ] = g_houseInteriors[ 0 ] [ E_EZ ]; - g_houseData[ ID ] [ E_INTERIOR_ID ] = 2; - format( query, sizeof( query ), "UPDATE HOUSES SET OWNER='No-one',PASSWORD='N/A',NAME='Home',TX=%f,TY=%f,TZ=%f,INTERIOR=%d WHERE ID=%d", g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], g_houseData[ ID ] [ E_INTERIOR_ID ], ID ); - mysql_single_query( query ); - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", ID, number_format( g_houseData[ ID ] [ E_COST ] ) ); - UpdateDynamic3DTextLabelText( g_houseData[ ID ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString ); - DestroyDynamic3DTextLabel( g_houseData[ ID ] [ E_LABEL ] [ 1 ] ); - g_houseData[ ID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ ID ] [ E_WORLD ] ); - DestroyDynamicCP( g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] ); - g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 1.0, g_houseData[ ID ] [ E_WORLD ], g_houseData[ ID ] [ E_INTERIOR_ID ], -1, 50.0 ); - SetPlayerPos( playerid, g_houseData[ ID ] [ E_EX ], g_houseData[ ID ] [ E_EY ], g_houseData[ ID ] [ E_EZ ] ); - DestroyDynamicMapIcon( g_houseData[ ID ] [ E_MAP_ICON ] ); - SetPlayerInterior( playerid, 0 ); - SetPlayerVirtualWorld( playerid, 0 ); - SendServerMessage( playerid, "You have successfully sold your house for "COL_GOLD"%s", number_format( ( g_houseData[ ID ] [ E_COST ] / 2 ) ) ); - } - return 1; - } - else if ( strmatch( params, "offer cancel" ) ) - { - new - bool: bResults = false; - - foreach(new i : Player) - { - if ( p_HouseOfferer[ i ] == playerid ) - { - bResults = true; - p_HouseOfferer [ i ] = INVALID_PLAYER_ID; - p_HouseOfferTicks [ i ] = 0; - p_HouseSellingID [ i ] = 0; - p_HouseSellingPrice [ i ] = 0; - } - } - - if ( bResults ) - return SendServerMessage( playerid, "You have successfully canceled all house offers you have made to players." ); - - return SendError( playerid, "You have not made any house offers to anybody." ); - } - else if ( strmatch( params, "offer take" ) ) - { - new - houseid = p_HouseSellingID[ playerid ], - sellerid = p_HouseOfferer[ playerid ], - sellingprice = p_HouseSellingPrice[ playerid ] - ; - - if ( !IsPlayerConnected( sellerid ) ) SendError( playerid, "The person who offered you a house is no longer online." ); - else if ( p_HouseOfferTicks[ playerid ] < g_iTime ) SendError( playerid, "This house offer has expired %d seconds ago.", g_iTime - p_HouseOfferTicks[ playerid ] ); - else if ( GetPlayerCash( playerid ) < p_HouseSellingPrice[ playerid ] ) SendError( playerid, "You do not have enough money to accept this offer (%s).", number_format( p_HouseSellingPrice[ playerid ] ) ); - else if ( g_houseData[ houseid ] [ E_COST ] <= 1337 && !p_VIPLevel[ playerid ] ) SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); - else if ( p_OwnedHouses[ playerid ] >= GetPlayerHouseSlots( playerid ) ) SendError( playerid, "You cannot purchase any more houses, you've reached the limit." ); - else - { - format( szBigString, sizeof( szBigString ), "[SELL TO] [%s] %s | %s | %s | %d\r\n", getCurrentDate( ), ReturnPlayerName( playerid ), ReturnPlayerName( sellerid ), number_format( sellingprice ), houseid ); - AddFileLogLine( "log_houses.txt", szBigString ); - - p_OwnedHouses[ sellerid ] --; - p_OwnedHouses[ playerid ] ++; - - // destroyAllFurniture( houseid ); - mysql_single_query( sprintf( "UPDATE `FURNITURE` SET `OWNER`=%d WHERE `HOUSE_ID`=%d", p_AccountID[ playerid ], houseid ) ); - SetHouseOwner( houseid, ReturnPlayerName( playerid ) ); - - GivePlayerCash( playerid, -sellingprice ); - GivePlayerCash( sellerid, sellingprice ); - - SendServerMessage( sellerid, "You have successfully sold your house for "COL_GOLD"%s"COL_WHITE" to %s(%d)!", number_format( p_HouseSellingPrice[ playerid ] ), ReturnPlayerName( playerid ), playerid ); - SendServerMessage( playerid, "You have successfully bought %s(%d)'s home for "COL_GOLD"%s"COL_WHITE"!", ReturnPlayerName( sellerid ), sellerid, number_format( p_HouseSellingPrice[ playerid ] ) ); - } - return ( p_HouseOfferer[ playerid ] = INVALID_PLAYER_ID ), ( p_HouseOfferTicks[ playerid ] = 0 ), 1; - } - else if ( !strcmp( params, "offer", false, 5 ) ) - { - new offerid, price; - - if ( ID == -1 ) return SendError( playerid, "You're not in any house." ); - else if ( !strmatch( g_houseData[ ID ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - else if ( sscanf( params[ 6 ],""#sscanf_u"d", offerid, price ) ) return SendUsage( playerid, "/h offer [PLAYER_ID] [PRICE]" ); - else if ( !IsPlayerConnected( offerid ) ) return SendError( playerid, "This player is not connected." ); - else if ( offerid == playerid ) return SendError( playerid, "You cannot make a house offer to yourself." ); - else if ( price > 30000000 ) return SendError( playerid, "The maximum amount you can sell a house for is $30,000,000." ); - else if ( price < g_houseData[ ID ] [ E_COST ] / 2 ) return SendError( playerid, "You cannot sell your house to somebody for less than half its cost." ); - else if ( GetDistanceBetweenPlayers( playerid, offerid ) > 4.0 ) return SendError( playerid, "You cannot send offers to players who are not near you." ); - else if ( p_HouseOfferTicks[ offerid ] > g_iTime ) return SendError( playerid, "Please wait %d seconds to make an house price offer to this player again.", p_HouseOfferTicks[ offerid ] - g_iTime ); - else if ( g_houseData[ ID ] [ E_COST ] <= 1337 && !p_VIPLevel[ offerid ] ) return SendError( playerid, "You cannot offer V.I.P homes to sell to regular players." ); - else if ( p_OwnedHouses[ offerid ] >= GetPlayerHouseSlots( offerid ) ) return SendError( playerid, "This player cannot purchase any more houses, they have reached the limit." ); - else - { - // Cannot sell to non vip vip homes k - p_HouseOfferer[ offerid ] = playerid; - p_HouseOfferTicks[ offerid ] = g_iTime + 15; - p_HouseSellingID[ offerid ] = ID; - p_HouseSellingPrice[ offerid ] = price; - SendServerMessage( offerid, "%s(%d) wishes to offer his house (id %d) for %s to you. Use "COL_GREY"/h offer take"COL_WHITE" to take the offer.", ReturnPlayerName( playerid ), playerid, ID, number_format( price ) ); - SendServerMessage( playerid, "You have offered %s(%d) %s for your house (id %d), cancel the offer with "COL_GREY"/h offer cancel"COL_WHITE".", ReturnPlayerName( offerid ), offerid, number_format( price ), ID ); - } - return 1; - } - return SendUsage( playerid, "/h [CONFIG/BUY/SELL/OFFER/OFFER TAKE/OFFER CANCEL]" ); -} - -stock SwitchHouseOwners( ID, playerid, buyerid ) -{ - if ( IsPlayerConnected( playerid ) ) - { - p_OwnedHouses[ playerid ] --; - SetPlayerInterior( playerid, 0 ); - SetPlayerVirtualWorld( playerid, 0 ); - SendServerMessage( playerid, "You have successfully sold your house for "COL_GOLD"%s", number_format( ( g_houseData[ ID ] [ E_COST ] / 2 ) ) ); - SetPlayerPos( playerid, g_houseData[ ID ] [ E_EX ], g_houseData[ ID ] [ E_EY ], g_houseData[ ID ] [ E_EZ ] ); - } - - // format( g_houseData[ ID ] [ E_PASSWORD ], 4, "N/A" ); - // format( g_houseData[ ID ] [ E_HOUSE_NAME ], 5, "Home" ); - strcpy( g_houseData[ ID ] [ E_PASSWORD ], "N/A" ); - strcpy( g_houseData[ ID ] [ E_HOUSE_NAME ], "Home" ); - format( g_houseData[ ID ] [ E_OWNER ], 7, "%s", ReturnPlayerName( buyerid ) ); - - format( szBigString, sizeof( szBigString ), "UPDATE HOUSES SET OWNER='%s',PASSWORD='N/A',NAME='Home' WHERE ID=%d", mysql_escape( ReturnPlayerName( buyerid ) ) , ID ); - mysql_single_query( szBigString ); - - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", ID, number_format( g_houseData[ ID ] [ E_COST ] ) ); - UpdateDynamic3DTextLabelText( g_houseData[ ID ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString ); - - DestroyDynamic3DTextLabel( g_houseData[ ID ] [ E_LABEL ] [ 1 ] ); - g_houseData[ ID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ ID ] [ E_WORLD ] ); - - DestroyDynamicCP( g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] ); - g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 1.0, g_houseData[ ID ] [ E_WORLD ], g_houseData[ ID ] [ E_INTERIOR_ID ], -1, 50.0 ); - - DestroyDynamicMapIcon( g_houseData[ ID ] [ E_MAP_ICON ] ); -} - CMD:drball( playerid, params[ ] ) { new removed = 0; @@ -18026,7 +17391,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) new x = 0; - foreach ( new i : houses ) if ( strmatch( g_houseData[ i ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + foreach ( new i : houses ) if ( IsPlayerHomeOwner( playerid, i ) ) { if ( x == listitem ) { @@ -18135,232 +17500,6 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) } } } - if ( ( dialogid == DIALOG_HOUSE_CONFIG ) && response ) - { - if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - DeletePVar( playerid, "gate_edititem" ); // Definitely not in the gate dialog lol - switch( listitem ) - { - case 0: ShowPlayerDialog( playerid, DIALOG_HOUSE_TITLE, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Title", ""COL_WHITE"Input the house title you want to change with:", "Confirm", "Back" ); - case 1: ShowPlayerDialog( playerid, DIALOG_HOUSE_INTERIORS, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", szg_houseInteriors, "Select", "Back" ); - case 2: ShowPlayerDialog( playerid, DIALOG_HOUSE_SET_PW, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Password", ""COL_WHITE"Enter your desired house password below.\n\n"COL_GREY"Note:"COL_WHITE" You can disable it by typing \"N/A\" (without the quotation marks).", "Confirm", "Back" ); - case 3: ShowHouseWeaponStorage( playerid ); - case 4: ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" ); - } - } - if ( dialogid == DIALOG_HOUSE_WEAPONS ) - { - if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." ); - if ( response ) - { - if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - if ( g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] != 0 ) - { - GivePlayerWeapon( playerid, g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ], g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] ); - SendServerMessage( playerid, "You have withdrawn your "COL_GREY"%s"COL_WHITE" with %d ammo.", ReturnWeaponName( g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] ), g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] ); - g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] = 0; - g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] = -1; - SaveHouseWeaponStorage( p_InHouse[ playerid ] ); - ShowHouseWeaponStorage( playerid ); - } - else - { - if ( listitem > 2 && p_VIPLevel[ playerid ] < VIP_REGULAR ) return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); - p_HouseWeaponAddSlot{ playerid } = listitem; - ShowPlayerDialog( playerid, DIALOG_HOUSE_WEAPONS_ADD, DIALOG_STYLE_MSGBOX, "{FFFFFF}House Weapon Storage", "{FFFFFF}Would you like to insert your current weapon into this slot?", "Insert", "Back" ); - } - } - else cmd_h( playerid, "config" ); - } - if ( dialogid == DIALOG_HOUSE_WEAPONS_ADD ) - { - if ( response ) - { - if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." ); - if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - if ( IsMeleeWeapon( GetPlayerWeapon( playerid ) ) ) - { - SendError( playerid, "You cannot insert melee weapons." ); - cmd_h( playerid, "config" ); - return 1; - } - new current_weapon = GetPlayerWeapon( playerid ); - new current_ammo = GetPlayerAmmo( playerid ); - if ( ( 16 <= current_weapon <= 18 ) || current_weapon == 35 ) { - SendError( playerid, "You cannot store this weapon." ); - cmd_h( playerid, "config" ); - return 1; - } - if ( current_ammo > 0x7FFF || current_ammo <= 0 ) current_ammo = 0x7FFF; - listitem = p_HouseWeaponAddSlot{ playerid }; - g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] = current_weapon; - g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] = current_ammo; - SendServerMessage( playerid, "You have inserted your "COL_GREY"%s"COL_WHITE" into your weapon storage.", ReturnWeaponName( current_weapon ) ); - RemovePlayerWeapon( playerid, current_weapon ); - SaveHouseWeaponStorage( p_InHouse[ playerid ] ); - ShowHouseWeaponStorage( playerid ); - } - else ShowHouseWeaponStorage( playerid ); - } - if ( dialogid == DIALOG_HOUSE_SET_PW ) - { - if ( response ) - { - if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." ); - else if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - else if ( !strlen( inputtext ) || strlen( inputtext ) > 4 ) - { - SendError( playerid, "Your password must vary between 0 and 4 characters." ); - ShowPlayerDialog( playerid, DIALOG_HOUSE_SET_PW, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Password", ""COL_WHITE"Enter your desired house password below.\n\n"COL_GREY"Note:"COL_WHITE" You can disable it by typing \"N/A\" or \"NULL\" (without the quotation marks).", "Confirm", "Back" ); - } - else if ( strmatch( inputtext, "N/A" ) || strmatch( inputtext, "NULL" ) ) - { - format( g_houseData[ p_InHouse[ playerid ] ] [ E_PASSWORD ], 4, "N/A" ); - SendServerMessage( playerid, "You have successfully disabled your house's password." ); - format( szNormalString, 60, "UPDATE `HOUSES` SET `PASSWORD`='N/A' WHERE `ID`=%d", p_InHouse[ playerid ] ); - mysql_single_query( szNormalString ); - cmd_h( playerid, "config" ); - } - else - { - SendServerMessage( playerid, "You have changed your house password to "COL_GREY"%s"COL_WHITE".", inputtext ); - format( g_houseData[ p_InHouse[ playerid ] ] [ E_PASSWORD ], 5, "%s", inputtext ); - format( szNormalString, 60, "UPDATE `HOUSES` SET `PASSWORD`='%s' WHERE `ID`=%d", mysql_escape( inputtext ), p_InHouse[ playerid ] ); - mysql_single_query( szNormalString ); - cmd_h( playerid, "config" ); - } - } - else cmd_h( playerid, "config" ); - } - if ( dialogid == DIALOG_HOUSE_INTERIORS ) - { - if ( response ) - { - if ( p_InHouse[ playerid ] == -1 ) - return SendError( playerid, "You're not inside any house." ); - - if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) - return SendError( playerid, "You are not the owner of this house." ); - - p_ViewingInterior{ playerid } = listitem; - ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" ); - } - else cmd_h( playerid, "config" ); - } - if ( dialogid == DIALOG_HOUSE_INT_CONFIRM ) - { - if ( response ) - { - if ( p_InHouse[ playerid ] == -1 ) - return SendError( playerid, "You're not inside any house." ); - - if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) - return SendError( playerid, "You are not the owner of this house." ); - - new - intid = p_ViewingInterior{ playerid }; - - switch( listitem ) - { - case 0: - { - if ( g_houseInteriors[ intid ] [ E_COST ] > GetPlayerCash( playerid ) ) - { - ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" ); - SendError( playerid, "This interior costs "COL_GOLD"%s"COL_WHITE". You don't have this amount.", number_format( g_houseInteriors[ intid ] [ E_COST ] ) ); - } - else if ( g_houseInteriors[ intid ] [ E_VIP ] && !p_VIPLevel[ playerid ] ) - { - ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" ); - SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); - } - else if ( ArePlayersInHouse( p_InHouse[ playerid ], playerid ) ) - { - ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" ); - SendError( playerid, "You cannot purchase a house interior if there are people inside the building." ); - } - else - { - if ( g_houseInteriors[ intid ] [ E_VIP ] && p_VIPLevel[ playerid ] && ( ( p_VIPExpiretime[ playerid ] - g_iTime ) / 86400 ) < 3 ) - return SendError( playerid, "You need more than 3 days of V.I.P in order to complete this." ); - - new houseid = p_InHouse[ playerid ]; - GivePlayerCash( playerid, -( g_houseInteriors[ intid ] [ E_COST ] ) ); - - if ( intid != 0 ) - SendServerMessage( playerid, "You have purchased a %s for "COL_GOLD"%s"COL_WHITE". This has been applied to the House ID %d.", g_houseInteriors[ intid ] [ E_NAME ], number_format( g_houseInteriors[ intid ] [ E_COST ] ), houseid ); - else - SendServerMessage( playerid, "You have successfully reset your interior to the default interior." ); - - destroyAllFurniture( houseid ); - FillHomeWithFurniture( houseid, intid ); - g_houseData[ houseid ] [ E_TX ] = g_houseInteriors[ intid ] [ E_EX ]; - g_houseData[ houseid ] [ E_TY ] = g_houseInteriors[ intid ] [ E_EY ]; - g_houseData[ houseid ] [ E_TZ ] = g_houseInteriors[ intid ] [ E_EZ ]; - g_houseData[ houseid ] [ E_INTERIOR_ID ] = g_houseInteriors[ intid ] [ E_INTERIOR_ID ]; - SetPlayerPos( playerid, g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ] ); - SetPlayerInterior( playerid, g_houseInteriors[ intid ] [ E_INTERIOR_ID ] ); - DestroyDynamicCP( g_houseData[ houseid ] [ E_CHECKPOINT ] [ 1 ] ); - g_houseData[ houseid ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ], 1.0, g_houseData[ houseid ] [ E_WORLD ], g_houseData[ houseid ] [ E_INTERIOR_ID ], -1, 50.0 ); - format( Query, sizeof( Query ), "UPDATE HOUSES SET TX=%f, TY=%f, TZ=%f, INTERIOR=%d WHERE ID=%d", g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ], g_houseData[ houseid ] [ E_INTERIOR_ID ], houseid ); - mysql_single_query( Query ); - DestroyDynamic3DTextLabel( g_houseData[ houseid ] [ E_LABEL ] [ 1 ] ); - g_houseData[ houseid ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ houseid ] [ E_TX ], g_houseData[ houseid ] [ E_TY ], g_houseData[ houseid ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ houseid ] [ E_WORLD ] ); - pauseToLoad( playerid ); - } - } - case 1: - { - if ( p_WantedLevel[ playerid ] ) { - ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" ); - return SendError( playerid, "This feature requires you not to have a wanted level." ); - } - if ( ArePlayersInHouse( p_InHouse[ playerid ], playerid ) ) { - ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" ); - return SendError( playerid, "You cannot view a house interior if there are people inside the building." ); - } - TogglePlayerControllable( playerid, 0 ); - SetPlayerPos( playerid, g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ] ); - SetPlayerInterior( playerid, g_houseInteriors[ intid ] [ E_INTERIOR_ID ] ); - InterpolateCameraPos( playerid, g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 2 ] + 1.5, g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 2 ], 15000, CAMERA_MOVE ); - InterpolateCameraLookAt( playerid, g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 2 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 2 ] + 1.5, 15000, CAMERA_MOVE ); - SendServerMessage( playerid, "You are now previewing "COL_GREY"%s "COL_GOLD"%s"COL_WHITE". Press your enter key to stop.", g_houseInteriors[ intid ] [ E_NAME ], number_format( g_houseInteriors[ intid ] [ E_COST ] ) ); - SetPVarInt( playerid, "viewing_houseints", 1 ); - } - } - } - else ShowPlayerDialog( playerid, DIALOG_HOUSE_INTERIORS, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", szg_houseInteriors, "Select", "Back" ); - } - if ( dialogid == DIALOG_HOUSE_TITLE ) - { - if ( response ) - { - if ( p_InHouse[ playerid ] == -1 ) - return SendError( playerid, "You're not inside any house." ); - - if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) - return SendError( playerid, "You are not the owner of this house." ); - - if ( ! ( 1 <= strlen( inputtext ) <= 30 ) ) - return ShowPlayerDialog( playerid, DIALOG_HOUSE_TITLE, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Title", ""COL_WHITE"Input the house title you want to change with:\n\n"COL_RED"Must be between 1 and 30 characters.", "Confirm", "Back" ); - - if ( textContainsIP( inputtext ) ) - return SendError( playerid, "We do not condone advertising." ); - - new houseid = p_InHouse[ playerid ]; - format( g_houseData[ houseid ] [ E_HOUSE_NAME ], 30, "%s", inputtext); - format( Query, sizeof( Query ), "UPDATE `HOUSES` SET NAME='%s' WHERE ID=%d", mysql_escape( g_houseData[ houseid ] [ E_HOUSE_NAME ] ), p_InHouse[ playerid ] ); - mysql_single_query( Query ); - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ houseid ] [ E_HOUSE_NAME ], houseid, g_houseData[ houseid ] [ E_OWNER ], number_format( g_houseData[ houseid ] [ E_COST ] ) ); - UpdateDynamic3DTextLabelText( g_houseData[ houseid ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString ); - SendServerMessage( playerid, "You have successfully changed the name of your house." ); - cmd_h( playerid, "config" ); - } - else cmd_h( playerid, "config" ); - } if ( ( dialogid == DIALOG_VEHICLE_SPAWN ) && response ) { if ( !listitem ) @@ -19873,92 +19012,6 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) SendServerMessage( playerid, "Please read this thoroughly so you know what you can be facing. %d seconds left.", GetPVarInt( playerid, "bought_veh_ts" ) - g_iTime ); ShowPlayerDialog( playerid, DIALOG_BOUGHT_VEH, DIALOG_STYLE_MSGBOX, "{FFFFFF}You've purchased a vehicle!", "{FFFFFF}Glad to see you've purchased a vehicle. Please ensure you read:\n\n* Vehicles are kept until you sell them or go two months inactive. This is not refundable.\n* Do not mispark your vehicle or it can be removed/impounded.\n* Check out /v for vehicle commands.\n* Find an acceptable place to park your new vehicle such as your house or a parking lot.", "Okay", "" ); } - 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; - } - 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; - } - 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." ); - } - 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 ); - } if ( dialogid == DIALOG_ACC_EMAIL ) { if ( ! response ) { @@ -20362,20 +19415,6 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) SendServerMessage( playerid, "You have successfully changed the name of your apartment." ); ShowPlayerDialog( playerid, DIALOG_FLAT_CONTROL, DIALOG_STYLE_LIST, "{FFFFFF}Owned Apartments", "Spawn Here\nLock Apartment\nModify Apartment Name\nSell Apartment", "Select", "Back" ); } - if ( ( dialogid == DIALOG_HOUSE_PW ) && response ) - { - new i = p_PasswordedHouse[ playerid ]; - if ( !strlen( inputtext ) || strlen( inputtext ) > 4 || strmatch( inputtext, "N/A" ) || !strmatch( inputtext, g_houseData[ i ] [ E_PASSWORD ] ) ) ShowPlayerDialog( playerid, DIALOG_HOUSE_PW, DIALOG_STYLE_PASSWORD, "{FFFFFF}House Authentication", ""COL_GREEN"This house is password locked!\n"COL_WHITE"You may only enter this house if you enter the correct password.\n\n"COL_RED"Incorrect Password!", "Enter", "Cancel" ); - else - { - if ( !IsPlayerInRangeOfPoint( playerid, 3.0, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] ) ) return SendError( playerid, "You are not near the house entrance!" ); - SendServerMessage( playerid, "Password correct. Access has been granted." ); - p_InHouse[ playerid ] = i; - SetPlayerPos( playerid, g_houseData[ i ] [ E_TX ], g_houseData[ i ] [ E_TY ], g_houseData[ i ] [ E_TZ ] ); - SetPlayerVirtualWorld( playerid, g_houseData[ i ] [ E_WORLD ] ); - SetPlayerInterior( playerid, g_houseData[ i ] [ E_INTERIOR_ID ] ); - } - } if ( dialogid == DIALOG_FURNITURE ) { new houseid = p_InHouse[ playerid ]; @@ -20383,7 +19422,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) if ( houseid == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( !IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); if ( response ) @@ -20439,7 +19478,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) if ( houseid == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( !IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); new x = 0; @@ -20479,7 +19518,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) if ( houseid != editing_house ) return SendError( playerid, "There was an issue editing the furniture of this home, try again." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( !IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); new objectid = g_houseFurnitureData[ editing_house ] [ editing_furniture ]; @@ -20527,7 +19566,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) if ( houseid != editing_house ) return SendError( playerid, "There was an issue editing the furniture of this home, try again." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( !IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); new objectid = g_houseFurnitureData[ editing_house ] [ editing_furniture ]; @@ -20566,7 +19605,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) if ( houseid == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ houseid ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( !IsPlayerHomeOwner( playerid, houseid ) ) return SendError( playerid, "You are not the owner of this house." ); new vip_slots = 20 + ( p_VIPLevel[ playerid ] * 10 ); @@ -22871,7 +21910,7 @@ function SetPlayerRandomSpawn( playerid ) // house spawning if ( strmatch( p_SpawningKey[ playerid ], "HSE" ) ) { - if ( Iter_Contains( houses, index ) &&strmatch( g_houseData[ index ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) + if ( Iter_Contains( houses, index ) && IsPlayerHomeOwner( playerid, index ) ) { if ( ! IsHouseOnFire( index ) ) { @@ -22880,10 +21919,6 @@ function SetPlayerRandomSpawn( playerid ) p_InHouse[ playerid ] = -1, p_InBusiness[ playerid ] = -1; SetPlayerInterior( playerid, 0 ); SetPlayerPos( playerid, g_houseData[ index ] [ E_EX ], g_houseData[ index ] [ E_EY ], g_houseData[ index ] [ E_EZ ] ); - /*p_InHouse[ playerid ] = index, p_InBusiness[ playerid ] = -1; - SetPlayerPos( playerid, g_houseData[ index ] [ E_TX ], g_houseData[ index ] [ E_TY ], g_houseData[ index ] [ E_TZ ] + 1 ); - SetPlayerVirtualWorld( playerid, g_houseData[ index ] [ E_WORLD ] ); - SetPlayerInterior( playerid, g_houseData[ index ] [ E_INTERIOR_ID ] );*/ return 1; } else SendServerMessage( playerid, "The house you were to be spawned at is on fire therefore normal spawning has been applied." ); @@ -23480,206 +22515,6 @@ thread OnApartmentLoad( ) return 1; } -thread OnHouseLoad( ) -{ - new - rows, fields, i = -1, - loadingTick = GetTickCount( ) - ; - - cache_get_data( rows, fields ); - if ( rows ) - { - static weapon_info[ 40 ], house_name[ 30 ], password[ 5 ], owner[ 24 ]; - - while( ++ i < rows ) - { - // set name., owner, password again (less memory) - cache_get_field_content( i, "NAME", house_name, dbHandle, 30 ); - cache_get_field_content( i, "PASSWORD", password, dbHandle, 5 ); - cache_get_field_content( i, "OWNER", owner, dbHandle, 24 ); - - // create home handle - new house_sql_id = cache_get_field_content_int( i, "ID", dbHandle ); - new handle = CreateHouse( house_name, - cache_get_field_content_int( i, "COST", dbHandle ), - cache_get_field_content_float( i, "EX", dbHandle ), - cache_get_field_content_float( i, "EY", dbHandle ), - cache_get_field_content_float( i, "EZ", dbHandle ), - cache_get_field_content_float( i, "TX", dbHandle ), - cache_get_field_content_float( i, "TY", dbHandle ), - cache_get_field_content_float( i, "TZ", dbHandle ), - cache_get_field_content_int( i, "INTERIOR", dbHandle ), - password, owner, house_sql_id - ); - - if ( handle != ITER_NONE ) { - // store weapon information - cache_get_field_content( i, "WEAPONS", weapon_info ), sscanf( weapon_info, "p<.>e", g_HouseWeapons[ handle ] ); - cache_get_field_content( i, "AMMO", weapon_info ), sscanf( weapon_info, "p<.>e", g_HouseWeaponAmmo[ handle ] ); - } - } - } - printf( "[HOUSES]: %d houses have been loaded. (Tick: %dms)", rows, GetTickCount( ) - loadingTick ); - - // Make Lorenc the owner of unowned VIP houses - foreach ( new houseid : houses ) if ( g_houseData[ houseid ] [ E_COST ] < 10000 ) { - if ( strmatch( g_houseData[ houseid ] [ E_OWNER ], "No-one" ) ) { - SetHouseOwner( houseid, "Lorenc" ); - } - } - - // The server crashes when the fires aren't correctly loaded. - CreateFire( ); - return 1; -} - -stock CreateHouse( house_name[ 30 ], cost, Float: eX, Float: eY, Float: eZ, Float: tX = H_DEFAULT_X, Float: tY = H_DEFAULT_Y, Float: tZ = H_DEFAULT_Z, interior = 2, password[ 5 ] = "N/A", owner[ 24 ] = "No-one", sql_id = ITER_NONE ) -{ - new - hID = ( 0 <= sql_id < MAX_HOUSES ) ? sql_id : Iter_Free( houses ); - - if ( Iter_Contains( houses, sql_id ) ) - hID = ITER_NONE; - - if ( hID != ITER_NONE ) - { - Iter_Add( houses, hID ); - - // set house name, password, owner - format( g_houseData[ hID ] [ E_HOUSE_NAME ], 30, "%s", house_name ); - format( g_houseData[ hID ] [ E_PASSWORD ], 5, "%s", password ); - format( g_houseData[ hID ] [ E_OWNER ], 24, "%s", owner ); - - // set home variables - g_houseData[ hID ] [ E_COST ] = cost; - g_houseData[ hID ] [ E_EX ] = eX; - g_houseData[ hID ] [ E_EY ] = eY; - g_houseData[ hID ] [ E_EZ ] = eZ; - g_houseData[ hID ] [ E_TX ] = tX; - g_houseData[ hID ] [ E_TY ] = tY; - g_houseData[ hID ] [ E_TZ ] = tZ; - g_houseData[ hID ] [ E_INTERIOR_ID ] = interior; - g_houseData[ hID ] [ E_WORLD ] = ( hID + MAX_HOUSES ); - - // reset weapons (in case) - for( new i; i < MAX_HOUSE_WEAPONS; i++ ) { - g_HouseWeapons[ hID ] [ i ] = 0, g_HouseWeaponAmmo[ hID ] [ i ] = -1; - } - - // prefurnish home - if ( sql_id == ITER_NONE ) FillHomeWithFurniture( hID, 0 ); - - // set global - g_houseData[ hID ] [ E_MAP_ICON ] = strmatch( owner, "No-one" ) ? CreateDynamicMapIcon( eX, eY, eZ, 31, 0, -1, -1, -1, HOUSE_MAPICON_RADIUS ) : -1; - - g_houseData[ hID ] [ E_CHECKPOINT ] [ 0 ] = CreateDynamicCP( eX, eY, eZ, 1.0, -1, 0, -1, 100.0 ); - g_houseData[ hID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( tX, tY, tZ, 1.0, g_houseData[ hID ] [ E_WORLD ], g_houseData[ hID ] [ E_INTERIOR_ID ], -1, 100.0 ); - - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ hID ] [ E_HOUSE_NAME ], hID, g_houseData[ hID ] [ E_OWNER ], number_format( cost ) ); - - g_houseData[ hID ] [ E_LABEL ] [ 0 ] = CreateDynamic3DTextLabel( szBigString, COLOR_WHITE, eX, eY, eZ, 20.0 ); - g_houseData[ hID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, tX, tY, tZ, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ hID ] [ E_WORLD ] ); - - // insert if non existant prior - if ( sql_id == ITER_NONE ) { - format( szBigString, sizeof( szBigString ), "INSERT INTO `HOUSES` VALUES (%d,'Home','No-one',%d,%f,%f,%f,%f,%f,%f,%d,'N/A','0.0.0.0.0.0.0.','-1.-1.-1.-1.-1.-1.-1.')", hID, cost, eX, eY, eZ, tX, tY, tZ, interior ); - mysql_single_query( szBigString ); - } - } - return hID; -} - -stock DestroyHouse( houseid ) -{ - if ( ! Iter_Contains( houses, houseid ) ) - return 0; - - new - query[ 40 ], - playerid = GetPlayerIDFromName( g_houseData[ houseid ] [ E_OWNER ] ) - ; - - if ( IsPlayerConnected( playerid ) ) - { - SendClientMessage( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" One of your houses has been destroyed."); - p_OwnedHouses[ playerid ] --; - } - - format( query, sizeof( query ), "DELETE FROM HOUSES WHERE ID=%d", houseid ); - mysql_single_query( query ); - destroyAllFurniture( houseid ); - g_houseData[ houseid ] [ E_HOUSE_NAME ] [ 0 ] = '\0'; - g_houseData[ houseid ] [ E_OWNER ] [ 0 ] = '\0'; - DestroyDynamicMapIcon( g_houseData[ houseid ] [ E_MAP_ICON ] ); - DestroyDynamicCP( g_houseData[ houseid ] [ E_CHECKPOINT ] [ 0 ] ); - DestroyDynamicCP( g_houseData[ houseid ] [ E_CHECKPOINT ] [ 1 ] ); - DestroyDynamic3DTextLabel( g_houseData[ houseid ] [ E_LABEL ] [ 0 ] ); - DestroyDynamic3DTextLabel( g_houseData[ houseid ] [ E_LABEL ] [ 1 ] ); - Iter_Remove( houses, houseid ); - return 1; -} - -stock SetHouseForAuction( ID ) -{ - if ( ID == -1 ) - return 0; - - if ( ! Iter_Contains( houses, ID ) ) - return 0; - - new - query[ 128 ], - player = GetPlayerIDFromName( g_houseData[ ID ] [ E_OWNER ] ) - ; - - if ( IsPlayerConnected( player ) ) - { - SendClientMessage( player, -1, ""COL_PINK"[HOUSE]"COL_WHITE" One of your houses has been taken for auction."); - p_OwnedHouses[ player ] --; - } - for( new i; i < MAX_HOUSE_WEAPONS; i++ ) { g_HouseWeapons[ ID ] [ i ] = 0, g_HouseWeaponAmmo[ ID ] [ i ] = -1; } - format( g_houseData[ ID ] [ E_PASSWORD ], 4, "N/A" ); - format( g_houseData[ ID ] [ E_OWNER ], 7, "No-one" ); - format( g_houseData[ ID ] [ E_HOUSE_NAME ], 5, "Home" ); - g_houseData[ ID ] [ E_TX ] = g_houseInteriors[ 0 ] [ E_EX ]; - g_houseData[ ID ] [ E_TY ] = g_houseInteriors[ 0 ] [ E_EY ]; - g_houseData[ ID ] [ E_TZ ] = g_houseInteriors[ 0 ] [ E_EZ ]; - g_houseData[ ID ] [ E_INTERIOR_ID ] = 2; - destroyAllFurniture( ID ); - FillHomeWithFurniture( ID, 0 ); - format( query, sizeof( query ), "UPDATE HOUSES SET OWNER='No-one',PASSWORD='N/A',NAME='Home',TX=%f,TY=%f,TZ=%f,INTERIOR=%d WHERE ID=%d", g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], g_houseData[ ID ] [ E_INTERIOR_ID ], ID ); - mysql_single_query( query ); - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", ID, number_format( g_houseData[ ID ] [ E_COST ] ) ); - UpdateDynamic3DTextLabelText( g_houseData[ ID ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString); - DestroyDynamic3DTextLabel( g_houseData[ ID ] [ E_LABEL ] [ 1 ] ); - g_houseData[ ID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ ID ] [ E_WORLD ] ); - DestroyDynamicCP( g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] ); - g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 1.0, g_houseData[ ID ] [ E_WORLD ], g_houseData[ ID ] [ E_INTERIOR_ID ], -1, 50.0 ); - DestroyDynamicMapIcon( g_houseData[ ID ] [ E_MAP_ICON ] ); - g_houseData[ ID ] [ E_MAP_ICON ] = CreateDynamicMapIcon( g_houseData[ ID ] [ E_EX ], g_houseData[ ID ] [ E_EY ], g_houseData[ ID ] [ E_EZ ], 31, 0, -1, -1, -1, HOUSE_MAPICON_RADIUS ); - return 1; -} - -stock SetHouseOwner( houseid, szOwner[ MAX_PLAYER_NAME ] ) -{ - if ( ! Iter_Contains( houses, houseid ) || isnull( szOwner ) ) - return 0; - - new - query[ 128 ] - ; - format( g_houseData[ houseid ] [ E_OWNER ], 24, "%s", szOwner ); - - format( query, sizeof( query ), "UPDATE HOUSES SET OWNER='%s' WHERE ID=%d", mysql_escape( szOwner ), houseid ); - mysql_single_query( query ); - - DestroyDynamicMapIcon( g_houseData[ houseid ] [ E_MAP_ICON ] ); - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", houseid, g_houseData[ houseid ] [ E_OWNER ], number_format( g_houseData[ houseid ] [ E_COST ] ) ); - UpdateDynamic3DTextLabelText( g_houseData[ houseid ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString); - return 1; -} - stock GetPlayerOwnedApartments( playerid ) { for( new i; i < sizeof( g_apartmentData ); i++ ) if ( g_apartmentData[ i ] [ E_CREATED ] ) @@ -23690,19 +22525,6 @@ stock GetPlayerOwnedApartments( playerid ) return 0; } -stock GetPlayerOwnedHouses( playerid ) -{ - new count = 0; - foreach ( new i : houses ) - { - if ( strmatch( g_houseData[ i ][ E_OWNER ], ReturnPlayerName( playerid ) ) ) - { - count ++; - } - } - return count; -} - stock GetPlayerOwnedBusinesses( playerid ) { new @@ -26372,40 +25194,6 @@ stock RemovePlayerWeapon(playerid, ...) } } -stock ShowHouseWeaponStorage( playerid ) -{ - if ( !IsPlayerConnected( playerid ) ) - return 0; - - new id = p_InHouse[ playerid ]; - if ( id == -1 ) return SendError( playerid, "You're not inside any house." ); - if ( !strmatch( g_houseData[ id ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." ); - szLargeString[ 0 ] = '\0'; - for( new i = 0; i < MAX_HOUSE_WEAPONS; i++ ) - { - if ( g_HouseWeapons[ id ] [ i ] != 0 ) - format( szLargeString, sizeof( szLargeString ), "%s%s%s(%d)\n", szLargeString, i > 2 ? (""#COL_GOLD"") : ("{FFFFFF}"), ReturnWeaponName( g_HouseWeapons[ id ] [ i ] ), g_HouseWeaponAmmo[ id ] [ i ] ); - else - strcat( szLargeString, i > 2 ? ( ""COL_GOLD"Empty\n" ) : ( ""COL_WHITE"Empty\n" ) ); - - } - ShowPlayerDialog( playerid, DIALOG_HOUSE_WEAPONS, DIALOG_STYLE_LIST, "{FFFFFF}House Weapon Storage", szLargeString, "Withdraw", "Back" ); - return 1; -} - -stock SaveHouseWeaponStorage( houseid ) -{ - new szWeapon[ 21 ], szAmmo[ 50 ]; - for( new i; i < MAX_HOUSE_WEAPONS; i++ ) - { - format( szWeapon, sizeof( szWeapon ), "%s%d.", szWeapon, g_HouseWeapons[ houseid ] [ i ] ); - format( szAmmo, sizeof( szAmmo ), "%s%d.", szAmmo, g_HouseWeaponAmmo[ houseid ] [ i ] ); - } - format( szBigString, sizeof( szBigString ), "UPDATE `HOUSES` SET `WEAPONS`='%s',`AMMO`='%s' WHERE `ID`=%d", szWeapon, szAmmo, houseid ); - mysql_single_query( szBigString ); - return 1; -} - stock IsMeleeWeapon(value) { static const valid_values[2] = { 65535, 28928 @@ -27815,21 +26603,6 @@ stock calculateVehicleSellPrice( vehicleid ) return floatround( float( g_aVehicleSellingPrice[ iModel - 400 ] ) * ( fHealth / 1000.0 ) * 0.75 ); } -stock ArePlayersInHouse( houseid, owner ) -{ - foreach(new i : Player) if ( i != owner ) - { - if ( p_InHouse[ i ] == houseid ) - { - if ( GetPlayerVirtualWorld( i ) == g_houseData[ houseid ] [ E_WORLD ] ) - return true; - - p_InHouse[ i ] = -1; // They're bugged probably - } - } - return false; -} - stock massUnjailPlayers( city, bool: alcatraz = false ) { foreach(new p : Player) @@ -29791,12 +28564,10 @@ thread OnPlayerChangeName( playerid, Float: iCoinRequirement, newName[ ] ) // Update houses (furniture also?) mysql_single_query( sprintf( "UPDATE `HOUSES` SET `OWNER` = '%s' WHERE `OWNER` = '%s'", mysql_escape( newName ), mysql_escape( ReturnPlayerName( playerid ) ) ) ); - foreach ( new i : houses ) { - if ( strmatch( g_houseData[ i ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) { - format( g_houseData[ i ] [ E_OWNER ], 24, "%s", newName ); - format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ i ] [ E_HOUSE_NAME ], i, g_houseData[ i ] [ E_OWNER ], number_format( g_houseData[ i ] [ E_COST ] ) ); - UpdateDynamic3DTextLabelText( g_houseData[ i ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString ); - } + foreach ( new i : houses ) if ( IsPlayerHomeOwner( playerid, i ) ) { + format( g_houseData[ i ] [ E_OWNER ], 24, "%s", newName ); + format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ i ] [ E_HOUSE_NAME ], i, g_houseData[ i ] [ E_OWNER ], number_format( g_houseData[ i ] [ E_COST ] ) ); + UpdateDynamic3DTextLabelText( g_houseData[ i ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString ); } // Update apartments @@ -32751,20 +31522,6 @@ stock ShowPlayerSpawnMenu( playerid ) { return ShowPlayerDialog( playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "{FFFFFF}Spawn Location", ""COL_GREY"Reset Back To Default\nHouse\nBusiness\nGang Facility\nVisage Casino", "Select", "Cancel" ); } -stock SetPlayerSpawnLocation( playerid, spawn_key[ 4 ], spawn_index = 0 ) -{ - // set sql, null if key is null - if ( spawn_key[ 0 ] == '\0' ) { - mysql_single_query( sprintf( "UPDATE `USERS` SET `SPAWN`=NULL WHERE `ID`=%d", p_AccountID[ playerid ] ) ); - } else { - mysql_single_query( sprintf( "UPDATE `USERS` SET `SPAWN`='%s %d' WHERE `ID`=%d", spawn_key, spawn_index, p_AccountID[ playerid ] ) ); - } - - // variable update - strcpy( p_SpawningKey[ playerid ], spawn_key ); - p_SpawningIndex[ playerid ] = spawn_index; - return 1; -} stock PlayerPlaceRandomHits( ) {