* place vehicle, garage, vehicle dealer, vehicle modification into modules (features/vehicles)
This commit is contained in:
parent
e035d41206
commit
4ca207c648
@ -14,6 +14,7 @@
|
|||||||
#include "irresistible\cnr\textdraws.pwn"
|
#include "irresistible\cnr\textdraws.pwn"
|
||||||
#include "irresistible\cnr\spawn.pwn"
|
#include "irresistible\cnr\spawn.pwn"
|
||||||
#include "irresistible\cnr\dialog_ids.pwn"
|
#include "irresistible\cnr\dialog_ids.pwn"
|
||||||
|
#include "irresistible\cnr\checkpoints.pwn"
|
||||||
|
|
||||||
// static cnr features
|
// static cnr features
|
||||||
#include "irresistible\cnr\static\_cnr_static.pwn"
|
#include "irresistible\cnr\static\_cnr_static.pwn"
|
||||||
|
194
gamemodes/irresistible/cnr/checkpoints.pwn
Normal file
194
gamemodes/irresistible/cnr/checkpoints.pwn
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: checkpoints.pwn
|
||||||
|
* Purpose: encloses all server related checkpoints, particularly static ones
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
#define ALL_CHECKPOINTS ( 37 )
|
||||||
|
|
||||||
|
#define CP_BOMB_SHOP ( 0 )
|
||||||
|
#define CP_BANK_MENU ( 1 )
|
||||||
|
#define CP_247_MENU ( 2 )
|
||||||
|
#define CP_CHANGE_JOB ( 3 )
|
||||||
|
#define CP_HOSPITAL ( 4 )
|
||||||
|
#define CP_BANK_MENU_LS ( 5 )
|
||||||
|
#define CP_PAINTBALL ( 6 )
|
||||||
|
#define CP_AMMUNATION_0 ( 7 )
|
||||||
|
#define CP_LUMBERJACK ( 8 )
|
||||||
|
#define CP_FIGHTSTYLE ( 9 )
|
||||||
|
#define CP_AMMUNATION_1 ( 10 )
|
||||||
|
#define CP_AMMUNATION_2 ( 11 )
|
||||||
|
#define CP_COUNTRY_BANK_MENU ( 12 )
|
||||||
|
#define CP_BOMB_SHOP_LV ( 13 )
|
||||||
|
#define CP_HOSPITAL_LV ( 14 )
|
||||||
|
#define CP_FIGHTSTYLE_LV ( 15 )
|
||||||
|
#define CP_BOMB_SHOP_LS ( 16 )
|
||||||
|
#define CP_HOSPITAL1_LS ( 17 )
|
||||||
|
#define CP_HOSPITAL2_LS ( 18 )
|
||||||
|
#define CP_FIGHTSTYLE_LS ( 19 )
|
||||||
|
#define CP_PAWNSHOP ( 20 )
|
||||||
|
#define CP_HOSPITAL_FC ( 21 )
|
||||||
|
#define CP_REFILL_AMMO ( 22 )
|
||||||
|
#define CP_REFILL_AMMO_LS ( 23 )
|
||||||
|
#define CP_REFILL_AMMO_LV ( 24 )
|
||||||
|
/*#define CP_DROP_OFF_COP ( 28 )
|
||||||
|
#define CP_DROP_OFF_FC ( 29 )
|
||||||
|
#define CP_DROP_OFF_DILLIMORE ( 30 )
|
||||||
|
#define CP_DROP_OFF_DIABLO ( 31 )
|
||||||
|
#define CP_DROP_OFF_QUBRADOS ( 32 )
|
||||||
|
#define CP_DROP_OFF_COP_LS ( 33 )
|
||||||
|
#define CP_DROP_OFF_FBI_LS ( 34 )
|
||||||
|
#define CP_DROP_OFF_FBI_LV ( 35 )
|
||||||
|
#define CP_DROP_OFF_COP_LV ( 36 )
|
||||||
|
#define CP_DROP_OFF_FBI ( 37 )
|
||||||
|
#define CP_DROP_OFF_HELI ( 38 )*/
|
||||||
|
#define CP_BIZ_TERMINAL_COKE ( 25 )
|
||||||
|
#define CP_BIZ_TERMINAL_METH ( 26 )
|
||||||
|
#define CP_BIZ_TERMINAL_WEED ( 27 )
|
||||||
|
#define CP_BIZ_TERMINAL_WEAP ( 28 )
|
||||||
|
#define CP_REWARDS_4DRAG ( 29 )
|
||||||
|
#define CP_REWARDS_CALIG ( 30 )
|
||||||
|
#define CP_REWARDS_VISAGE ( 31 )
|
||||||
|
#define CP_AIRPORT_SF ( 32 )
|
||||||
|
#define CP_AIRPORT_LS ( 33 )
|
||||||
|
#define CP_AIRPORT_LV ( 34 )
|
||||||
|
#define CP_CASINO_BAR ( 35 )
|
||||||
|
#define CP_ALCATRAZ_EXPORT ( 36 )
|
||||||
|
|
||||||
|
new g_Checkpoints [ ALL_CHECKPOINTS ] = { -1, ... };
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnScriptInit( )
|
||||||
|
{
|
||||||
|
g_Checkpoints[ CP_BOMB_SHOP ] = CreateDynamicCP( -1923.7546, 303.3475, 41.0469, 2.0, 0, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_COP ] = CreateDynamicCP( -1577.0952, 683.9492, 7.2440, 3.0, 0, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_BANK_MENU ] = CreateDynamicCP( -1405.0657, 831.0966, 984.7126, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_COUNTRY_BANK_MENU ] = CreateDynamicCP( 2156.1299, 1640.2460, 1041.6124, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_CHANGE_JOB ] = CreateDynamicCP( 361.8525, 173.6031, 1008.3828, 1.0, -1, -1, -1, 50.0 );
|
||||||
|
g_Checkpoints[ CP_HOSPITAL ] = CreateDynamicCP( -2647.5007, 659.0084, 970.4332, 2.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_PAINTBALL ] = CreateDynamicCP( -2172.2017, 252.1113, 35.3388, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_FBI ] = CreateDynamicCP( -2446.6785, 522.9684, 30.2548, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_LUMBERJACK ] = CreateDynamicCP( -2323.5676, -97.2582, 35.3078, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_FIGHTSTYLE ] = CreateDynamicCP( 768.2576, -22.8351, 1000.5859, 2.0, -1, -1, -1, 25.0 );
|
||||||
|
g_Checkpoints[ CP_247_MENU ] = CreateDynamicCP( -29.0409, -184.7446, 1003.5469, 1.0, -1, -1, -1, 25.0 );
|
||||||
|
g_Checkpoints[ CP_AMMUNATION_0 ] = CreateDynamicCP( 296.3782, -38.4512, 1001.5156, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
g_Checkpoints[ CP_AMMUNATION_1 ] = CreateDynamicCP( 295.4524, -80.7487, 1001.5156, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
g_Checkpoints[ CP_AMMUNATION_2 ] = CreateDynamicCP( 312.8432, -166.1419, 999.6010, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_HELI ] = CreateDynamicCP( -1651.6956, 700.8394, 38.2422, 5.0, -1, -1, -1, 50.0 );
|
||||||
|
g_Checkpoints[ CP_PAWNSHOP ] = CreateDynamicCP( 1333.0847, -1080.0726, 968.0430, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
g_Checkpoints[ CP_REFILL_AMMO ] = CreateDynamicCP( -1615.2600, 685.5120, 7.1875, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
g_Checkpoints[ CP_REFILL_AMMO_LS ] = CreateDynamicCP( -1615.2600, 685.5120, 7.1875, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_FC ] = CreateDynamicCP( -211.6869, 979.3518, 19.3237, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_DILLIMORE ] = CreateDynamicCP( 614.2876, -588.6716, 17.2330, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_DIABLO ] = CreateDynamicCP( -433.3666, 2255.6064, 42.4297, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_QUBRADOS ] = CreateDynamicCP( -1400.0497, 2647.2358, 55.6875, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_BIZ_TERMINAL_COKE ] = CreateDynamicCP( 2563.5728, -1310.5925, 1143.7242, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_BIZ_TERMINAL_METH ] = CreateDynamicCP( 2034.0669, 1001.6073, 1510.2416, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_BIZ_TERMINAL_WEED ] = CreateDynamicCP( -1742.9982, -1377.3049, 5874.1333, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_BIZ_TERMINAL_WEAP ] = CreateDynamicCP( -6942.8770, -247.7294, 837.5850, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_REWARDS_CALIG ] = CreateDynamicCP( 2157.6294, 1599.4355, 1006.1797, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_REWARDS_4DRAG ] = CreateDynamicCP( 1951.7191, 997.5555, 992.8594, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_REWARDS_VISAGE ] = CreateDynamicCP( 2604.1323, 1570.1182, 1508.3530, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_AIRPORT_LV ] = CreateDynamicCP( 1672.53640, 1447.86160, 10.7881, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_AIRPORT_LS ] = CreateDynamicCP( 1642.22740, -2335.4978, 13.5469, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_AIRPORT_SF ] = CreateDynamicCP( -1422.4063, -286.50810, 14.1484, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_CASINO_BAR ] = CreateDynamicCP( 2655.8694, 1591.1545, 1506.1793, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
g_Checkpoints[ CP_ALCATRAZ_EXPORT ] = CreateDynamicCP( -1999.9487, 1781.2325, 43.7386, 1.0, -1, -1, -1, 30.0 );
|
||||||
|
|
||||||
|
// Out of SF
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, -211.6869, 979.3518, 19.3237, 50.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, 614.2876, -588.6716, 17.2330, 50.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, -433.3666, 2255.6064, 42.4297, 50.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, -1400.0497, 2647.2358, 55.6875, 50.0);
|
||||||
|
|
||||||
|
#if ENABLE_CITY_LV == true
|
||||||
|
g_Checkpoints[ CP_BOMB_SHOP_LV ] = CreateDynamicCP( 1998.7263, 2298.5562, 10.8203, 2.0, 0, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_COP_LV ] = CreateDynamicCP( 2225.6753, 2457.2388, -7.4531, 3.0, 0, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_HOSPITAL_LV ] = CreateDynamicCP( 1607.2659, 1815.2485, 10.8203, 2.0, -1, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_FBI_LV ] = CreateDynamicCP( 948.6036, 1811.2720, 8.6484, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_FIGHTSTYLE_LV ] = CreateDynamicCP( 766.8416, -62.1872, 1000.6563, 2.0, -1, -1, -1, 25.0 );
|
||||||
|
g_Checkpoints[ CP_REFILL_AMMO_LV ] = CreateDynamicCP( 2251.9438, 2488.7981, 10.9908, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, 2225.6753, 2457.2388, -7.4531, 20.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, 948.6036, 1811.2720, 8.6484, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[LEARN FIGHT STYLES]", COLOR_GOLD, 766.8416, -62.1872, 1000.6563, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 9);
|
||||||
|
CreateDynamic3DTextLabel("[BOMB SHOP]", COLOR_GOLD, 1998.7263, 2298.5562, 10.8203, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[HOSPITAL]", COLOR_GOLD, 1607.2659, 1815.2485, 10.8203, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[REFILL AMMO]", COLOR_GOLD, 2251.9438, 2488.7981, 10.9908, 20.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_CITY_LS
|
||||||
|
g_Checkpoints[ CP_BOMB_SHOP_LS ] = CreateDynamicCP( 1911.2462, -1775.8755, 13.3828, 2.0, 0, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_HOSPITAL1_LS ] = CreateDynamicCP( 1172.0767, -1323.3257, 15.4029, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_HOSPITAL2_LS ] = CreateDynamicCP( 2034.0677, -1401.6699, 17.2938, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_HOSPITAL_FC ] = CreateDynamicCP( -320.2127, 1048.2339, 20.3403, 1.0, -1, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_COP_LS ] = CreateDynamicCP( 1569.0277, -1694.1566, 5.8906, 3.0, 0, -1, -1, 100.0 );
|
||||||
|
//g_Checkpoints[ CP_DROP_OFF_FBI_LS ] = CreateDynamicCP( 1516.6716, -1458.9398, 9.5000, 3.0, -1, -1, -1, 100.0 );
|
||||||
|
g_Checkpoints[ CP_FIGHTSTYLE_LS ] = CreateDynamicCP( 772.0868, 12.6397, 1000.6996, 1.0, -1, -1, -1, 25.0 );
|
||||||
|
g_Checkpoints[ CP_BANK_MENU_LS ] = CreateDynamicCP( 2136.4946, 1226.1787, 1017.1369, 1.0, -1, -1, -1, 25.0 );
|
||||||
|
g_Checkpoints[ CP_REFILL_AMMO_LS ] = CreateDynamicCP( 1579.5439, -1635.5166, 13.5609, 1.0, -1, -1, -1, 20.0 );
|
||||||
|
CreateDynamic3DTextLabel("[BANK MENU]", COLOR_GOLD, 2136.4946, 1226.1787, 1017.1369, 20.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, 1569.0277, -1694.1566, 5.8906, 20.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, 1516.6716, -1458.9398, 9.5000, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[LEARN FIGHT STYLES]", COLOR_GOLD, 772.0868, 12.6397, 1000.6996, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 10);
|
||||||
|
CreateDynamic3DTextLabel("[BOMB SHOP]", COLOR_GOLD, 1911.2462, -1775.8755, 13.3828, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[HOSPITAL]", COLOR_GOLD, 1172.0767, -1323.3257, 15.4029, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[HOSPITAL]", COLOR_GOLD, 2034.0677, -1401.6699, 17.2938, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[HOSPITAL]", COLOR_GOLD, -320.2127, 1048.2339, 20.3403, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[REFILL AMMO]", COLOR_GOLD, 1579.5439, -1635.5166, 13.5609, 20.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CreateDynamic3DTextLabel("[ROCK CRUSHER]", COLOR_GOLD, -1999.9487, 1781.2325, 43.7386, 50.0);
|
||||||
|
CreateDynamic3DTextLabel("[CASINO BAR]", COLOR_GOLD, 2655.8694, 1591.1545, 1506.1793, 50.0);
|
||||||
|
CreateDynamic3DTextLabel("[AIRPORT]", COLOR_GOLD, 1672.53640, 1447.86160, 10.7881, 50.0);
|
||||||
|
CreateDynamic3DTextLabel("[AIRPORT]", COLOR_GOLD, 1642.22740, -2335.4978, 13.5469, 50.0);
|
||||||
|
CreateDynamic3DTextLabel("[AIRPORT]", COLOR_GOLD, -1422.4063, -286.50810, 14.1484, 50.0);
|
||||||
|
CreateDynamic3DTextLabel("[REFILL AMMO]", COLOR_GOLD, -1615.2600, 685.5120, 7.1875, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[PAWNSHOP]", COLOR_GOLD, 1333.0847, -1080.0726, 968.0430, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[SHOP]", COLOR_GOLD, -29.0409,-184.7446,1003.5469, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[BANK MENU]", COLOR_GOLD, -1405.0657, 831.0966, 984.7126, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[BANK MENU]", COLOR_GOLD, 2156.1299, 1640.2460, 1041.6124, 20.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, -1577.0952, 683.9492, 7.2440, 20.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, -2446.6785, 522.9684, 30.2548, 20.0);
|
||||||
|
//CreateDynamic3DTextLabel("[DROP OFF]", COLOR_GOLD, -1651.6956, 700.8394, 38.2422, 50.0);
|
||||||
|
CreateDynamic3DTextLabel("[BOMB SHOP]", COLOR_GOLD, -1923.7546, 303.3475, 41.0469, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[GUN STORE]", COLOR_GOLD, 296.3782, -38.4512, 1001.5156, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[GUN STORE]", COLOR_GOLD, 295.4524, -80.7487, 1001.5156, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[GUN STORE]", COLOR_GOLD, 312.8432, -166.1419, 999.6010, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[MAIN DESK]", COLOR_GOLD, 361.8525, 173.6031, 1008.3828, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[HOSPITAL]", COLOR_GOLD, -2647.5007, 659.0084, 970.4332, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[PAINTBALL]", COLOR_GOLD, -2172.2017, 252.1113, 35.3388, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[GUN REDEEM]\n"COL_WHITE"/vipgun", COLOR_GOLD, -1945.9280, 830.0893, 1214.2678, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[GUN REDEEM]\n"COL_WHITE"/vipgun", COLOR_GOLD, -1966.1765, 851.0482, 1214.2678, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[LUMBERJACK JOB]", COLOR_GOLD, -2323.5676, -97.2582, 35.3078, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[LEARN FIGHT STYLES]", COLOR_GOLD, 768.2576, -22.8351, 1000.5859, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 8 );
|
||||||
|
CreateDynamic3DTextLabel("[BUSINESS TERMINAL]", COLOR_GOLD, 2563.5728, -1310.5925, 1143.7242, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[BUSINESS TERMINAL]", COLOR_GOLD, 2034.0669, 1001.6073, 1510.2416, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[BUSINESS TERMINAL]", COLOR_GOLD, -1742.9982, -1377.3049, 5874.1333, 20.0);
|
||||||
|
CreateDynamic3DTextLabel("[BUSINESS TERMINAL]", COLOR_GOLD, -6942.8770, -247.7294, 837.5850, 20.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerEnterDynamicCP( playerid, checkpointid )
|
||||||
|
{
|
||||||
|
/* ** Checkpoint Denials ** */
|
||||||
|
if ( GetPlayerState( playerid ) == PLAYER_STATE_SPECTATING ) {
|
||||||
|
return Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( GetPlayerSpecialAction( playerid ) == SPECIAL_ACTION_CUFFED ) {
|
||||||
|
return SendError( playerid, "You can't do anything as you are cuffed." ), Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( IsPlayerTied( playerid ) ) {
|
||||||
|
return SendError( playerid, "You can't do anything as you are tied." ), Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) || IsPlayerInEvent( playerid ) ) {
|
||||||
|
return SendError( playerid, "You can't do anything as you are in an event." ), Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
// houses
|
// houses
|
||||||
#include "irresistible\cnr\features\houses\_houses.pwn"
|
#include "irresistible\cnr\features\houses\_houses.pwn"
|
||||||
|
#include "irresistible\cnr\features\vehicles\_vehicles.pwn"
|
||||||
#include "irresistible\cnr\features\gangs\_gangs.pwn"
|
#include "irresistible\cnr\features\gangs\_gangs.pwn"
|
||||||
#include "irresistible\cnr\features\visage\_visage.pwn"
|
#include "irresistible\cnr\features\visage\_visage.pwn"
|
||||||
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
|
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
|
||||||
|
12
gamemodes/irresistible/cnr/features/vehicles/_vehicles.pwn
Normal file
12
gamemodes/irresistible/cnr/features/vehicles/_vehicles.pwn
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: cnr\features\vehicles\_vehicles.pwn
|
||||||
|
* Purpose: encloses all vehicle modules & components (cnr)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include "irresistible\cnr\features\vehicles\vehicles.pwn"
|
||||||
|
#include "irresistible\cnr\features\vehicles\vdealership.pwn"
|
||||||
|
#include "irresistible\cnr\features\vehicles\vmodifications.pwn"
|
||||||
|
#include "irresistible\cnr\features\vehicles\garages.pwn"
|
559
gamemodes/irresistible/cnr/features/vehicles/garages.pwn
Normal file
559
gamemodes/irresistible/cnr/features/vehicles/garages.pwn
Normal file
@ -0,0 +1,559 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: cnr\features\vehicles\garages.pwn
|
||||||
|
* Purpose: garage system to allow players to store their personal vehicles
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Macros ** */
|
||||||
|
#define UpdateBusinessTitle(%0) \
|
||||||
|
mysql_function_query(dbHandle,sprintf("SELECT f.`NAME` FROM `USERS` f LEFT JOIN `BUSINESSES` m ON m.`OWNER_ID`=f.`ID` WHERE m.`ID`=%d",%0),true,"OnUpdateBusinessTitle","i",%0)
|
||||||
|
|
||||||
|
#define UpdateGarageTitle(%0) \
|
||||||
|
mysql_function_query(dbHandle,sprintf("SELECT f.`NAME` FROM `USERS` f LEFT JOIN `GARAGES` m ON m.`OWNER`=f.`ID` WHERE m.`ID`=%d",(%0)),true,"OnUpdateGarageTitle","i",(%0))
|
||||||
|
|
||||||
|
#define UpdateGarageData(%0) \
|
||||||
|
mysql_function_query(dbHandle,sprintf("UPDATE `GARAGES` SET OWNER=%d,PRICE=%d,INTERIOR=%d WHERE ID=%d",g_garageData[(%0)][E_OWNER_ID],g_garageData[(%0)][E_PRICE],g_garageData[(%0)][E_INTERIOR_ID],(%0)),true,"","")
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
#define MAX_GARAGES ( 200 )
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
enum E_GARAGE_DATA
|
||||||
|
{
|
||||||
|
E_OWNER_ID, E_PRICE, E_INTERIOR_ID,
|
||||||
|
Float: E_X, Float: E_Y, Float: E_Z,
|
||||||
|
Float: E_ANGLE, E_SQL_ID, E_CHECKPOINT,
|
||||||
|
Text3D: E_LABEL, E_WORLD
|
||||||
|
};
|
||||||
|
|
||||||
|
enum E_GARAGE_INT_DATA
|
||||||
|
{
|
||||||
|
E_NAME[ 17 ], E_INTERIOR,
|
||||||
|
E_VEHICLE_CAPACITY, E_PRICE, Float: E_ANGLE,
|
||||||
|
Float: E_X, Float: E_Y, Float: E_Z,
|
||||||
|
Float: E_PREVIEW_POS[ 3 ], Float: E_PREVIEW_LOOKAT[ 3 ]
|
||||||
|
};
|
||||||
|
|
||||||
|
new
|
||||||
|
g_garageInteriorData [ ] [ E_GARAGE_INT_DATA ] =
|
||||||
|
{
|
||||||
|
{ "Default Interior", 11, 3, 0, 0.0, 405.0301, 2508.6348, 16.7825, { 419.2017, 2517.6489, 17.9550 }, { 401.4677, 2506.3042, 16.9824 } },
|
||||||
|
{ "Medium Interior", 22, 5, 1500000, 180.0, 150.8938, 2497.9995, 16.5999, { 140.8066, 2483.9426, 16.7998 }, { 159.9573, 2501.1057, 16.7998 } },
|
||||||
|
{ "Luxury Interior", 33, 10, 3000000, 270.0, 380.1852, 2496.8149, 16.4343, { 375.7204, 2486.4741, 16.6344 }, { 427.4626, 2505.8796, 16.6344 } }
|
||||||
|
},
|
||||||
|
g_garageData [ MAX_GARAGES ] [ E_GARAGE_DATA ],
|
||||||
|
szg_garageInteriors [ 174 ],
|
||||||
|
|
||||||
|
// Iterator
|
||||||
|
Iterator:garages<MAX_GARAGES>
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
|
{
|
||||||
|
if ( dialogid == DIALOG_GARAGE_INTERIORS )
|
||||||
|
{
|
||||||
|
if ( response )
|
||||||
|
{
|
||||||
|
if ( p_InGarage[ playerid ] == -1 )
|
||||||
|
return SendError( playerid, "You're not inside any garage." );
|
||||||
|
|
||||||
|
if ( g_garageData[ p_InGarage[ playerid ] ] [ E_OWNER_ID ] != p_AccountID[ playerid ] )
|
||||||
|
return SendError( playerid, "You are not the owner of this garage." );
|
||||||
|
|
||||||
|
p_ViewingInterior{ playerid } = listitem;
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", "Purchase Garage Interior\nPreview Garage Interior", "Select", "Back" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( dialogid == DIALOG_GARAGE_INT_CONFIRM )
|
||||||
|
{
|
||||||
|
if ( response )
|
||||||
|
{
|
||||||
|
if ( p_InGarage[ playerid ] == -1 )
|
||||||
|
return SendError( playerid, "You're not inside any garage." );
|
||||||
|
|
||||||
|
if ( g_garageData[ p_InGarage[ playerid ] ] [ E_OWNER_ID ] != p_AccountID[ playerid ] )
|
||||||
|
return SendError( playerid, "You are not the owner of this garage." );
|
||||||
|
|
||||||
|
new
|
||||||
|
intid = p_ViewingInterior{ playerid };
|
||||||
|
|
||||||
|
switch( listitem )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
if ( g_garageInteriorData[ intid ] [ E_PRICE ] > GetPlayerCash( playerid ) )
|
||||||
|
{
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", "Purchase Garage Interior\nPreview Garage Interior", "Select", "Back" );
|
||||||
|
SendError( playerid, "This interior costs "COL_GOLD"%s"COL_WHITE". You don't have this amount.", cash_format( g_garageInteriorData[ intid ] [ E_PRICE ] ) );
|
||||||
|
}
|
||||||
|
else if ( ArePlayersInGarage( playerid, p_InGarage[ playerid ] ) )
|
||||||
|
{
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", "Purchase Garage Interior\nPreview Garage Interior", "Select", "Back" );
|
||||||
|
SendError( playerid, "You cannot purchase a garage interior if there are people inside the building." );
|
||||||
|
}
|
||||||
|
else if ( GetPlayerVehiclesInGarage( playerid, p_InGarage[ playerid ], .strict_mode = true ) )
|
||||||
|
{
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", "Purchase Garage Interior\nPreview Garage Interior", "Select", "Back" );
|
||||||
|
SendError( playerid, "You cannot purchase a garage interior if there are vehicles inside the building." );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new garageid = p_InGarage[ playerid ];
|
||||||
|
GivePlayerCash( playerid, -( g_garageInteriorData[ intid ] [ E_PRICE ] ) );
|
||||||
|
|
||||||
|
if ( intid != 0 )
|
||||||
|
SendServerMessage( playerid, "You have purchased a %s for "COL_GOLD"%s"COL_WHITE" your garage.", g_garageInteriorData[ intid ] [ E_NAME ], cash_format( g_garageInteriorData[ intid ] [ E_PRICE ] ) );
|
||||||
|
else
|
||||||
|
SendServerMessage( playerid, "You have successfully reset your interior to the default interior." );
|
||||||
|
|
||||||
|
pauseToLoad( playerid );
|
||||||
|
|
||||||
|
SetPlayerPos( playerid, g_garageInteriorData[ intid ] [ E_X ], g_garageInteriorData[ intid ] [ E_Y ], g_garageInteriorData[ intid ] [ E_Z ] );
|
||||||
|
SetPlayerInterior( playerid, g_garageInteriorData[ intid ] [ E_INTERIOR ] );
|
||||||
|
SetPlayerVirtualWorld( playerid, g_garageData[ garageid ] [ E_WORLD ] );
|
||||||
|
|
||||||
|
mysql_single_query( sprintf( "UPDATE `GARAGES` SET `INTERIOR`=%d WHERE `ID`=%d", ( g_garageData[ garageid ] [ E_INTERIOR_ID ] = intid ), garageid ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
if ( p_WantedLevel[ playerid ] ) {
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", "Purchase Garage Interior\nPreview Garage Interior", "Select", "Back" );
|
||||||
|
return SendError( playerid, "This feature requires you not to have a wanted level." );
|
||||||
|
}
|
||||||
|
if ( ArePlayersInGarage( playerid, p_InGarage[ playerid ] ) ) {
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", "Purchase Garage Interior\nPreview Garage Interior", "Select", "Back" );
|
||||||
|
return SendError( playerid, "You cannot view a garage interior if there are people inside the building." );
|
||||||
|
}
|
||||||
|
|
||||||
|
TogglePlayerControllable( playerid, 0 );
|
||||||
|
|
||||||
|
SetPlayerPos( playerid, g_garageInteriorData[ intid ] [ E_X ], g_garageInteriorData[ intid ] [ E_Y ], g_garageInteriorData[ intid ] [ E_Z ] );
|
||||||
|
SetPlayerInterior( playerid, g_garageInteriorData[ intid ] [ E_INTERIOR ] );
|
||||||
|
|
||||||
|
InterpolateCameraPos( playerid, g_garageInteriorData[ intid ] [ E_PREVIEW_POS ] [ 0 ], g_garageInteriorData[ intid ] [ E_PREVIEW_POS ] [ 1 ], g_garageInteriorData[ intid ] [ E_PREVIEW_POS ] [ 2 ] + 1.5, g_garageInteriorData[ intid ] [ E_PREVIEW_LOOKAT ] [ 0 ], g_garageInteriorData[ intid ] [ E_PREVIEW_LOOKAT ] [ 1 ], g_garageInteriorData[ intid ] [ E_PREVIEW_LOOKAT ] [ 2 ], 15000, CAMERA_MOVE );
|
||||||
|
InterpolateCameraLookAt( playerid, g_garageInteriorData[ intid ] [ E_PREVIEW_LOOKAT ] [ 0 ], g_garageInteriorData[ intid ] [ E_PREVIEW_LOOKAT ] [ 1 ], g_garageInteriorData[ intid ] [ E_PREVIEW_LOOKAT ] [ 2 ], g_garageInteriorData[ intid ] [ E_PREVIEW_POS ] [ 0 ], g_garageInteriorData[ intid ] [ E_PREVIEW_POS ] [ 1 ], g_garageInteriorData[ 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_garageInteriorData[ intid ] [ E_NAME ], cash_format( g_garageInteriorData[ intid ] [ E_PRICE ] ) );
|
||||||
|
SetPVarInt( playerid, "viewing_garageints", 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else ShowPlayerDialog( playerid, DIALOG_GARAGE_INTERIORS, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", szg_garageInteriors, "Select", "Back" );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
||||||
|
{
|
||||||
|
if ( PRESSED( KEY_SECONDARY_ATTACK ) )
|
||||||
|
{
|
||||||
|
if ( GetPVarInt( playerid, "viewing_garageints" ) == 1 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iInterior = g_garageData[ p_InGarage[ playerid ] ] [ E_INTERIOR_ID ];
|
||||||
|
|
||||||
|
SendServerMessage( playerid, "You've stopped viewing the garage interior." );
|
||||||
|
SetPlayerPos( playerid, g_garageInteriorData[ iInterior ] [ E_X ], g_garageInteriorData[ iInterior ] [ E_Y ], g_garageInteriorData[ iInterior ] [ E_Z ] );
|
||||||
|
SetPlayerInterior( playerid, g_garageInteriorData[ iInterior ] [ E_INTERIOR ] );
|
||||||
|
DeletePVar( playerid, "viewing_garageints" );
|
||||||
|
TogglePlayerControllable( playerid, 1 );
|
||||||
|
SetCameraBehindPlayer( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Commands ** */
|
||||||
|
CMD:garage( 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)" );
|
||||||
|
|
||||||
|
new
|
||||||
|
iOwner = INVALID_PLAYER_ID,
|
||||||
|
iGarage = p_InGarage[ playerid ],
|
||||||
|
iVehicle = GetPlayerVehicleID( playerid ),
|
||||||
|
iVehicleSeat = GetPlayerVehicleSeat( playerid )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( strmatch( params, "buy" ) )
|
||||||
|
{
|
||||||
|
if ( GetPlayerOwnedGarages( playerid ) >= GetPlayerGarageSlots( playerid ) ) return SendError( playerid, "You cannot purchase any more garages, you've reached the limit." );
|
||||||
|
if ( GetPlayerScore( playerid ) < 500 ) return SendError( playerid, "You need at least 500 score to buy a garage." );
|
||||||
|
|
||||||
|
foreach(new g : garages)
|
||||||
|
{
|
||||||
|
if ( IsPlayerInDynamicCP( playerid, g_garageData[ g ] [ E_CHECKPOINT ] ) )
|
||||||
|
{
|
||||||
|
if ( !g_garageData[ g ] [ E_OWNER_ID ] )
|
||||||
|
{
|
||||||
|
if ( GetPlayerCash( playerid ) < g_garageData[ g ] [ E_PRICE ] )
|
||||||
|
return SendError( playerid, "You don't have enough money to purchase this garage." );
|
||||||
|
|
||||||
|
g_garageData[ g ] [ E_OWNER_ID ] = p_AccountID[ playerid ];
|
||||||
|
UpdateGarageData( g );
|
||||||
|
UpdateGarageTitle( g );
|
||||||
|
GivePlayerCash( playerid, -( g_garageData[ g ] [ E_PRICE ] ) );
|
||||||
|
autosaveStart( playerid, true ); // auto-save
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You have bought this garage for "COL_GOLD"%s"COL_WHITE".", cash_format( g_garageData[ g ] [ E_PRICE ] ) );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else return SendError( playerid, "This garage isn't for sale." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SendError( playerid, "You are not near any garage entrances." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "upgrade" ) )
|
||||||
|
{
|
||||||
|
if ( iGarage == -1 ) return SendError( playerid, "You are not in any garage." );
|
||||||
|
else if ( g_garageData[ iGarage ] [ E_OWNER_ID ] != p_AccountID[ playerid ] ) return SendError( playerid, "You are not the owner of this garage." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_GARAGE_INTERIORS, DIALOG_STYLE_LIST, "{FFFFFF}Garage Interiors", szg_garageInteriors, "Select", "Back" );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "enter" ) )
|
||||||
|
{
|
||||||
|
foreach(new g : garages)
|
||||||
|
{
|
||||||
|
if ( IsPlayerInDynamicCP( playerid, g_garageData[ g ] [ E_CHECKPOINT ] ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iInterior = g_garageData[ g ] [ E_INTERIOR_ID ]
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( iVehicle != 0 && iVehicleSeat == 0 )
|
||||||
|
{
|
||||||
|
if ( !g_garageData[ g ] [ E_OWNER_ID ] )
|
||||||
|
return SendServerMessage( playerid, "You cannot enter unowned garages. To buy this, type "COL_GREY"/garage buy"COL_WHITE"." );
|
||||||
|
|
||||||
|
if ( !g_buyableVehicle{ iVehicle } || g_adminSpawnedCar{ iVehicle } )
|
||||||
|
return SendError( playerid, "Only vehicles that are sold through the vehicle dealership can be entered through." );
|
||||||
|
|
||||||
|
new iSlot = getVehicleSlotFromID( iVehicle, iOwner );
|
||||||
|
|
||||||
|
if ( p_AccountID[ iOwner ] != g_garageData[ g ] [ E_OWNER_ID ] )
|
||||||
|
return SendError( playerid, "You cannot enter with vehicles that are not owned by the owner of this garage." );
|
||||||
|
|
||||||
|
if ( g_vehicleData[ iOwner ] [ iSlot ] [ E_LOCKED ] && playerid != iOwner )
|
||||||
|
return SendError( playerid, "This vehicle is locked and thus you cannot enter/exit a garage with it." );
|
||||||
|
|
||||||
|
SetPlayerVehicleInteriorData( iOwner, iSlot, g_garageInteriorData[ iInterior ] [ E_INTERIOR ], g_garageData[ g ] [ E_WORLD ], g_garageInteriorData[ iInterior ] [ E_X ], g_garageInteriorData[ iInterior ] [ E_Y ], g_garageInteriorData[ iInterior ] [ E_Z ] + 2.0, g_garageInteriorData[ iInterior ] [ E_ANGLE ], g );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pauseToLoad( playerid );
|
||||||
|
SetPlayerPos( playerid, g_garageInteriorData[ iInterior ] [ E_X ], g_garageInteriorData[ iInterior ] [ E_Y ], g_garageInteriorData[ iInterior ] [ E_Z ] );
|
||||||
|
SetPlayerInterior( playerid, g_garageInteriorData[ iInterior ] [ E_INTERIOR ] );
|
||||||
|
SetPlayerVirtualWorld( playerid, g_garageData[ g ] [ E_WORLD ] );
|
||||||
|
}
|
||||||
|
return ( p_InGarage[ playerid ] = g ), 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SendError( playerid, "You are not near any garage entrance." );
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "exit" ) )
|
||||||
|
{
|
||||||
|
if ( iGarage == -1 ) return SendError( playerid, "You are not in any garage." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( iVehicle != 0 && iVehicleSeat == 0 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iSlot = getVehicleSlotFromID( iVehicle, iOwner );
|
||||||
|
|
||||||
|
if ( g_vehicleData[ iOwner ] [ iSlot ] [ E_LOCKED ] && playerid != iOwner )
|
||||||
|
return SendError( playerid, "This vehicle is locked and thus you cannot enter/exit a garage with it." );
|
||||||
|
|
||||||
|
SetPlayerVehicleInteriorData( iOwner, iSlot, 0, 0, g_garageData[ iGarage ] [ E_X ], g_garageData[ iGarage ] [ E_Y ], g_garageData[ iGarage ] [ E_Z ], g_garageData[ iGarage ] [ E_ANGLE ] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetPlayerPosEx( playerid, g_garageData[ iGarage ] [ E_X ], g_garageData[ iGarage ] [ E_Y ], g_garageData[ iGarage ] [ E_Z ], 0 ), SetPlayerVirtualWorld( playerid, 0 );
|
||||||
|
}
|
||||||
|
return ( p_InGarage[ playerid ] = -1 ), 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "sell" ) )
|
||||||
|
{
|
||||||
|
if ( iGarage == -1 ) return SendError( playerid, "You are not in any garage." );
|
||||||
|
else if ( g_garageData[ iGarage ] [ E_OWNER_ID ] != p_AccountID[ playerid ] ) return SendError( playerid, "You are not the owner of this garage." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iCashMoney = floatround( ( g_garageData[ iGarage ] [ E_PRICE ] / 2 ) + ( g_garageInteriorData[ g_garageData[ iGarage ] [ E_INTERIOR_ID ] ] [ E_PRICE ] / 2 ) );
|
||||||
|
|
||||||
|
if ( GetPlayerVehiclesInGarage( playerid, iGarage, .strict_mode = true ) )
|
||||||
|
return SendError( playerid, "You must ensure all vehicles are removed from the facility before selling it." );
|
||||||
|
|
||||||
|
g_garageData[ iGarage ] [ E_OWNER_ID ] = 0;
|
||||||
|
g_garageData[ iGarage ] [ E_INTERIOR_ID ] = 0;
|
||||||
|
|
||||||
|
// UpdateGarageData( iGarage ); (add on resale)
|
||||||
|
// OnUpdateGarageTitle( iGarage ); // No point querying (add on resale)
|
||||||
|
GivePlayerCash( playerid, iCashMoney );
|
||||||
|
|
||||||
|
SetPlayerPosEx( playerid, g_garageData[ iGarage ] [ E_X ], g_garageData[ iGarage ] [ E_Y ], g_garageData[ iGarage ] [ E_Z ], 0 ), SetPlayerVirtualWorld( playerid, 0 );
|
||||||
|
SendServerMessage( playerid, "You have successfully sold your garage for "COL_GOLD"%s"COL_WHITE".", cash_format( iCashMoney ) );
|
||||||
|
|
||||||
|
// Destroy garage, prevent resale
|
||||||
|
DestroyGarage( iGarage );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if ( !strcmp( params, "vehicle", false, 7 ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
vehicleid = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( iGarage == -1 )
|
||||||
|
return SendError( playerid, "You are not in any garage." );
|
||||||
|
|
||||||
|
if ( g_garageData[ iGarage ] [ E_OWNER_ID ] != p_AccountID[ playerid ] )
|
||||||
|
return SendError( playerid, "You are not the owner of this garage." );
|
||||||
|
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) )
|
||||||
|
return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
|
||||||
|
if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER )
|
||||||
|
return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
|
||||||
|
if ( vehicleid == -1 )
|
||||||
|
return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
|
||||||
|
if ( playerid != ownerid )
|
||||||
|
return SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
|
||||||
|
if ( !strlen( params[ 8 ] ) )
|
||||||
|
return SendUsage( playerid, "/garage vehicle [PIMP/EDIT]" );
|
||||||
|
|
||||||
|
if ( strmatch( params[ 8 ], "pimp" ) )
|
||||||
|
{
|
||||||
|
if ( GetVehicleCustomComponents( ownerid, vehicleid ) >= GetPlayerPimpVehicleSlots( ownerid ) )
|
||||||
|
return SendError( playerid, "You cannot purchase more than %d vehicle components.", GetPlayerPimpVehicleSlots( ownerid ) );
|
||||||
|
|
||||||
|
return ShowVehicleComponentCategories( playerid );
|
||||||
|
}
|
||||||
|
else if ( strmatch( params[ 8 ], "edit" ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
szBigString[ 0 ] = '\0';
|
||||||
|
|
||||||
|
for( new i = 0; i < MAX_PIMPS; i++ ) if ( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ i ] ) {
|
||||||
|
for( new c = 0; c < sizeof( g_vehicleComponentsData ); c++ ) if ( g_vehicleComponentsData[ c ] [ E_MODEL_ID ] == g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ] ) {
|
||||||
|
format( szBigString, sizeof( szBigString ), "%s%s\n", szBigString, g_vehicleComponentsData[ c ] [ E_NAME ] );
|
||||||
|
}
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !count )
|
||||||
|
return SendError( playerid, "This vehicle does not have any components to it." );
|
||||||
|
|
||||||
|
return ShowPlayerDialog( playerid, DIALOG_COMPONENT_MENU, DIALOG_STYLE_LIST, "Vehicle Components", szBigString, "Select", "Cancel" );
|
||||||
|
}
|
||||||
|
else return SendUsage( playerid, "/garage vehicle [PIMP/EDIT]" );
|
||||||
|
}
|
||||||
|
return SendUsage( playerid, "/garage [BUY/UPGRADE/VEHICLE/ENTER/EXIT/SELL]" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** SQL Threads ** */
|
||||||
|
thread OnGaragesLoad( )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
rows, fields, i = -1,
|
||||||
|
loadingTick = GetTickCount( )
|
||||||
|
;
|
||||||
|
|
||||||
|
cache_get_data( rows, fields );
|
||||||
|
if ( rows )
|
||||||
|
{
|
||||||
|
while( ++i < rows )
|
||||||
|
{
|
||||||
|
CreateGarage(
|
||||||
|
cache_get_field_content_int( i, "OWNER", dbHandle ),
|
||||||
|
cache_get_field_content_int( i, "PRICE", dbHandle ),
|
||||||
|
cache_get_field_content_int( i, "INTERIOR", dbHandle ),
|
||||||
|
cache_get_field_content_float( i, "X", dbHandle ),
|
||||||
|
cache_get_field_content_float( i, "Y", dbHandle ),
|
||||||
|
cache_get_field_content_float( i, "Z", dbHandle ),
|
||||||
|
cache_get_field_content_float( i, "ANGLE", dbHandle ),
|
||||||
|
cache_get_field_content_int( i, "ID", dbHandle )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf( "[GARAGES]: %d garages have been loaded. (Tick: %dms)", i, GetTickCount( ) - loadingTick );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnUpdateGarageTitle( slot )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
rows, szOwner[ MAX_PLAYER_NAME ] = "No-one";
|
||||||
|
|
||||||
|
cache_get_data( rows, tmpVariable );
|
||||||
|
|
||||||
|
if ( rows )
|
||||||
|
cache_get_field_content( 0, "NAME", szOwner );
|
||||||
|
|
||||||
|
UpdateDynamic3DTextLabelText( g_garageData[ slot ] [ E_LABEL ], COLOR_GOLD, sprintf( "Garage(%d)\nOwner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", slot, szOwner, cash_format( g_garageData[ slot ] [ E_PRICE ] ) ) );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Functions ** */
|
||||||
|
stock CreateGarage( iAccountID, iPrice, iInterior, Float: fX, Float: fY, Float: fZ, Float: fAngle, iExistingID = ITER_NONE )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iGarage = iExistingID != ITER_NONE ? iExistingID : Iter_Free(garages);
|
||||||
|
|
||||||
|
if ( Iter_Contains( garages, iExistingID ) )
|
||||||
|
iGarage = ITER_NONE; // In the unlikelihood...
|
||||||
|
|
||||||
|
if ( iGarage != ITER_NONE )
|
||||||
|
{
|
||||||
|
g_garageData[ iGarage ] [ E_OWNER_ID ] = iAccountID;
|
||||||
|
g_garageData[ iGarage ] [ E_PRICE ] = iPrice;
|
||||||
|
g_garageData[ iGarage ] [ E_INTERIOR_ID ] = iInterior;
|
||||||
|
g_garageData[ iGarage ] [ E_WORLD ] = iGarage + ( MAX_GARAGES * 32 ); // Random
|
||||||
|
|
||||||
|
g_garageData[ iGarage ] [ E_X ] = fX;
|
||||||
|
g_garageData[ iGarage ] [ E_Y ] = fY;
|
||||||
|
g_garageData[ iGarage ] [ E_Z ] = fZ;
|
||||||
|
g_garageData[ iGarage ] [ E_ANGLE ] = fAngle;
|
||||||
|
|
||||||
|
g_garageData[ iGarage ] [ E_CHECKPOINT ] = CreateDynamicCP( fX, fY, fZ, 3.0, -1, 0, -1, 100.0 );
|
||||||
|
g_garageData[ iGarage ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "Garage(%d)\nOwner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", iGarage, cash_format( g_garageData[ iGarage ] [ E_PRICE ] ) ), COLOR_GOLD, fX, fY, fZ, 20.0 );
|
||||||
|
|
||||||
|
if ( iExistingID != ITER_NONE && iAccountID ) UpdateGarageTitle( iGarage );
|
||||||
|
else if ( iExistingID == ITER_NONE )
|
||||||
|
{
|
||||||
|
format( szBigString, 162, "INSERT INTO `GARAGES`(`ID`,`OWNER`,`PRICE`,`INTERIOR`,`X`,`Y`,`Z`,`ANGLE`) VALUES (%d,%d,%d,%d,%f,%f,%f,%f)", iGarage, iAccountID, iPrice, iInterior, fX, fY, fZ, fAngle );
|
||||||
|
mysql_single_query( szBigString );
|
||||||
|
}
|
||||||
|
|
||||||
|
Iter_Add(garages, iGarage);
|
||||||
|
}
|
||||||
|
return iGarage;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock DestroyGarage( iGarage )
|
||||||
|
{
|
||||||
|
if ( iGarage < 0 || iGarage >= MAX_GARAGES )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !Iter_Contains( garages, iGarage ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
new
|
||||||
|
playerid = GetPlayerIDFromAccountID( g_garageData[ iGarage ] [ E_OWNER_ID ] );
|
||||||
|
|
||||||
|
if ( IsPlayerConnected( playerid ) )
|
||||||
|
{
|
||||||
|
for( new i = 0; i < MAX_BUYABLE_VEHICLES; i++ )
|
||||||
|
if ( g_vehicleData[ playerid ] [ i ] [ E_CREATED ] && g_vehicleData[ playerid ] [ i ] [ E_GARAGE ] == iGarage )
|
||||||
|
SetVehiclePos( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ], g_garageData[ iGarage ] [ E_X ], g_garageData[ iGarage ] [ E_Y ], g_garageData[ iGarage ] [ E_Z ] ), LinkVehicleToInterior( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ], 0 ), SetVehicleVirtualWorld( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ], 0 );
|
||||||
|
|
||||||
|
SendClientMessage( playerid, -1, ""COL_PINK"[GARAGE]"COL_WHITE" One of your garages has been destroyed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_single_query( sprintf( "UPDATE `VEHICLES` SET `X`=%f,`Y`=%f,`Z`=%f,`GARAGE`=-1 WHERE `GARAGE`=%d", g_garageData[ iGarage ] [ E_X ], g_garageData[ iGarage ] [ E_Y ], g_garageData[ iGarage ] [ E_Z ], iGarage ) );
|
||||||
|
mysql_single_query( sprintf( "DELETE FROM `GARAGES` WHERE `ID`=%d", iGarage ) );
|
||||||
|
|
||||||
|
Iter_Remove(garages, iGarage);
|
||||||
|
g_garageData[ iGarage ] [ E_OWNER_ID ] = 0;
|
||||||
|
DestroyDynamicCP( g_garageData[ iGarage ] [ E_CHECKPOINT ] );
|
||||||
|
DestroyDynamic3DTextLabel( g_garageData[ iGarage ] [ E_LABEL ] );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock PlayerBreachedGarageLimit( playerid, vID, bool: admin_place = false )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iOwner = playerid;
|
||||||
|
|
||||||
|
if ( admin_place ) /// Admin Mode
|
||||||
|
getVehicleSlotFromID( GetPlayerVehicleID( playerid ), iOwner );
|
||||||
|
|
||||||
|
// Garage System
|
||||||
|
if ( ( g_vehicleData[ iOwner ] [ vID ] [ E_GARAGE ] = p_InGarage[ playerid ] ) != -1 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iGarage = g_vehicleData[ iOwner ] [ vID ] [ E_GARAGE ],
|
||||||
|
iVehiclesOccupying = GetPlayerVehiclesInGarage( iOwner, iGarage )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( g_vehicleData[ iOwner ] [ vID ] [ E_OWNER_ID ] != g_garageData[ iGarage ] [ E_OWNER_ID ] )
|
||||||
|
return g_vehicleData[ iOwner ] [ vID ] [ E_GARAGE ] = -1, -1;
|
||||||
|
|
||||||
|
if ( iVehiclesOccupying > g_garageInteriorData[ g_garageData[ iGarage ] [ E_INTERIOR_ID ] ] [ E_VEHICLE_CAPACITY ] )
|
||||||
|
return g_vehicleData[ iOwner ] [ vID ] [ E_GARAGE ] = -1, -2;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetPlayerOwnedGarages( playerid ) {
|
||||||
|
new
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
foreach ( new garageid : garages ) if ( g_garageData[ garageid ] [ E_OWNER_ID ] == p_AccountID[ playerid ] ) {
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetPlayerVehiclesInGarage( playerid, slot, strict_mode=0 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
if ( Iter_Contains( garages, slot ) )
|
||||||
|
{
|
||||||
|
for( new i = 0; i < MAX_BUYABLE_VEHICLES; i++ ) if ( g_vehicleData[ playerid ] [ i ] [ E_CREATED ] ) {
|
||||||
|
if ( g_vehicleData[ playerid ] [ i ] [ E_GARAGE ] == slot || ( strict_mode && GetVehicleVirtualWorld( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ] ) == g_garageData[ slot ] [ E_WORLD ] ) )
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ArePlayersInGarage( playerid, slot )
|
||||||
|
{
|
||||||
|
foreach ( new i : Player ) {
|
||||||
|
if ( p_InGarage[ i ] == slot && i != playerid ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock UpdatePlayerGarageTitles( playerid )
|
||||||
|
{
|
||||||
|
foreach ( new g : garages ) if ( g_garageData[ g ] [ E_OWNER_ID ] == GetPlayerAccountID( playerid ) ) {
|
||||||
|
UpdateGarageTitle( g );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetGarageVehicleCapacity( garageid ) {
|
||||||
|
return g_garageInteriorData[ g_garageData[ garageid ] [ E_INTERIOR_ID ] ] [ E_VEHICLE_CAPACITY ];
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetGarageInteriorID( garageid ) {
|
||||||
|
return g_garageInteriorData[ g_garageData[ garageid ] [ E_INTERIOR_ID ] ] [ E_INTERIOR ];
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetGarageVirtualWorld( garageid ) {
|
||||||
|
return g_garageData[ garageid ] [ E_WORLD ];
|
||||||
|
}
|
514
gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn
Normal file
514
gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn
Normal file
@ -0,0 +1,514 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module:
|
||||||
|
* Purpose:
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
#define BV_TYPE_AIRPLANES ( 1 )
|
||||||
|
#define BV_TYPE_HELICOPTERS ( 2 )
|
||||||
|
#define BV_TYPE_BIKES ( 3 )
|
||||||
|
#define BV_TYPE_CONVERTIBLES ( 4 )
|
||||||
|
#define BV_TYPE_INDUSTRIAL ( 5 )
|
||||||
|
#define BV_TYPE_LOWRIDERS ( 6 )
|
||||||
|
#define BV_TYPE_OFF_ROAD ( 7 )
|
||||||
|
#define BV_TYPE_PUBLIC_SERVICE ( 8 )
|
||||||
|
#define BV_TYPE_SALOONS ( 9 )
|
||||||
|
#define BV_TYPE_SPORTS ( 10 )
|
||||||
|
#define BV_TYPE_STATION_WAGONS ( 11 )
|
||||||
|
#define BV_TYPE_BOATS ( 12 )
|
||||||
|
#define BV_TYPE_UNIQUE ( 13 )
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
enum E_BV_DATA
|
||||||
|
{
|
||||||
|
E_TYPE, E_MODEL, E_VIP, E_PRICE, E_NAME[ 18 ]
|
||||||
|
};
|
||||||
|
|
||||||
|
new
|
||||||
|
g_BVCategories[ ] [ 16 ] =
|
||||||
|
{
|
||||||
|
{ "Airplanes" }, { "Helicopters" }, { "Bikes" },
|
||||||
|
{ "Convertibles" }, { "Industrial" }, { "Lowriders" },
|
||||||
|
{ "Off Road" }, { "Public Service" }, { "Saloons" },
|
||||||
|
{ "Sport Vehicles" }, { "Station Wagons" }, { "Boats" },
|
||||||
|
{ "Unique Vehicles" }
|
||||||
|
},
|
||||||
|
g_BuyableVehicleData [ ] [ E_BV_DATA ] =
|
||||||
|
{
|
||||||
|
// Airplanes
|
||||||
|
{ BV_TYPE_AIRPLANES, 577, 0, 35000000, "AT400" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 592, 0, 17500000, "Andromada" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 519, 0, 10000000, "Shamal" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 513, 0, 4500000, "Stuntplane" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 511, 0, 3300000, "Beagle" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 553, 1, 3300000, "Nevada" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 593, 0, 3000000, "Dodo" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 476, 1, 3000000, "Rustler" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 460, 1, 2700000, "Skimmer" },
|
||||||
|
{ BV_TYPE_AIRPLANES, 512, 0, 2200000, "Cropduster" },
|
||||||
|
|
||||||
|
// Helicopters
|
||||||
|
{ BV_TYPE_HELICOPTERS, 487, 0, 7500000, "Maverick" },
|
||||||
|
{ BV_TYPE_HELICOPTERS, 417, 0, 6000000, "Leviathan" },
|
||||||
|
{ BV_TYPE_HELICOPTERS, 497, 1, 5000000, "Police Maverick" },
|
||||||
|
{ BV_TYPE_HELICOPTERS, 488, 1, 3250000, "SAN News Maverick" },
|
||||||
|
{ BV_TYPE_HELICOPTERS, 563, 0, 3000000, "Raindance" },
|
||||||
|
{ BV_TYPE_HELICOPTERS, 469, 1, 3000000, "Sparrow" },
|
||||||
|
{ BV_TYPE_HELICOPTERS, 548, 1, 2700000, "Cargobob" },
|
||||||
|
|
||||||
|
// Bikes
|
||||||
|
{ BV_TYPE_BIKES, 522, 0, 2500000, "NRG-500" },
|
||||||
|
{ BV_TYPE_BIKES, 510, 0, 2000000, "Mountain Bike" },
|
||||||
|
{ BV_TYPE_BIKES, 521, 0, 1500000, "FCR-900" },
|
||||||
|
{ BV_TYPE_BIKES, 481, 0, 1500000, "BMX" },
|
||||||
|
{ BV_TYPE_BIKES, 461, 0, 1000000, "PCJ-600" },
|
||||||
|
{ BV_TYPE_BIKES, 509, 0, 800000, "Bike" },
|
||||||
|
{ BV_TYPE_BIKES, 581, 0, 750000, "BF-400" },
|
||||||
|
{ BV_TYPE_BIKES, 468, 0, 750000, "Sanchez" },
|
||||||
|
{ BV_TYPE_BIKES, 471, 0, 500000, "Quad" },
|
||||||
|
{ BV_TYPE_BIKES, 463, 0, 550000, "Freeway" },
|
||||||
|
{ BV_TYPE_BIKES, 586, 0, 400000, "Wayfarer" },
|
||||||
|
{ BV_TYPE_BIKES, 462, 0, 375000, "Faggio" },
|
||||||
|
{ BV_TYPE_BIKES, 448, 1, 50000, "Pizzaboy" },
|
||||||
|
|
||||||
|
// Convertiblies
|
||||||
|
{ BV_TYPE_CONVERTIBLES, 480, 0, 1700000, "Comet" },
|
||||||
|
{ BV_TYPE_CONVERTIBLES, 439, 0, 750000, "Stallion" },
|
||||||
|
{ BV_TYPE_CONVERTIBLES, 533, 0, 650000, "Feltzer" },
|
||||||
|
{ BV_TYPE_CONVERTIBLES, 555, 0, 620000, "Windsor" },
|
||||||
|
|
||||||
|
// Industrial
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 498, 1, 2000000, "Boxville" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 578, 1, 1250000, "DFT-30" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 408, 1, 1000000, "Trashmaster" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 554, 0, 500000, "Yosemite" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 482, 0, 500000, "Burrito" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 600, 0, 375000, "Picador" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 552, 1, 300000, "Utility Van" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 413, 0, 300000, "Pony" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 582, 1, 250000, "Newsvan" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 440, 0, 250000, "Rumpo" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 422, 0, 220000, "Bobcat" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 531, 0, 180000, "Tractor" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 414, 0, 180000, "Mule" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 543, 0, 130000, "Sadler" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 478, 0, 100000, "Walton" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 499, 0, 80000, "Benson" },
|
||||||
|
{ BV_TYPE_INDUSTRIAL, 456, 0, 60000, "Yankee" },
|
||||||
|
|
||||||
|
// Lowriders
|
||||||
|
{ BV_TYPE_LOWRIDERS, 535, 0, 1500000, "Slamvan" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 567, 0, 1250000, "Savanna" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 536, 0, 800000, "Blade" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 412, 0, 800000, "Voodoo" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 575, 0, 750000, "Broadway" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 576, 0, 600000, "Tornado" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 534, 0, 430000, "Remington" },
|
||||||
|
{ BV_TYPE_LOWRIDERS, 566, 0, 300000, "Tahoma" },
|
||||||
|
|
||||||
|
// Off road
|
||||||
|
{ BV_TYPE_OFF_ROAD, 444, 1, 3000000, "Monster" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 556, 1, 2500000, "Monster A" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 557, 1, 2500000, "Monster B" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 573, 1, 1800000, "Dune" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 579, 0, 1750000, "Huntley" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 470, 1, 1500000, "Patriot" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 495, 0, 1500000, "Sandking" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 489, 0, 850000, "Rancher" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 400, 0, 710000, "Landstalker" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 568, 1, 650000, "Bandito" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 500, 0, 500000, "Mesa" },
|
||||||
|
{ BV_TYPE_OFF_ROAD, 424, 0, 450000, "BF Injection" },
|
||||||
|
|
||||||
|
// Public Service
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 601, 1, 3000000, "S.W.A.T." },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 596, 1, 2500000, "Police Car (LSPD)" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 597, 1, 2500000, "Police Car (SFPD)" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 598, 1, 2500000, "Police Car (LVPD)" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 416, 1, 2500000, "Ambulance" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 407, 1, 2500000, "Firetruck"},
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 544, 1, 2500000, "Firetruck LA" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 437, 1, 2000000, "Coach" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 427, 1, 2000000, "Enforcer" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 599, 1, 1800000, "Police Ranger" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 438, 1, 1700000, "Cabbie" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 431, 1, 1600000, "Bus" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 528, 1, 1300000, "FBI Truck" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 523, 1, 1100000, "HPV1000" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 420, 1, 1000000, "Taxi" },
|
||||||
|
{ BV_TYPE_PUBLIC_SERVICE, 490, 1, 950000, "FBI Rancher" },
|
||||||
|
|
||||||
|
// Saloons
|
||||||
|
{ BV_TYPE_SALOONS, 580, 0, 5000000, "Stafford" },
|
||||||
|
{ BV_TYPE_SALOONS, 560, 0, 2500000, "Sultan" },
|
||||||
|
{ BV_TYPE_SALOONS, 562, 0, 1800000, "Elegy" },
|
||||||
|
{ BV_TYPE_SALOONS, 421, 0, 1750000, "Washington" },
|
||||||
|
{ BV_TYPE_SALOONS, 426, 0, 1500000, "Premier" },
|
||||||
|
{ BV_TYPE_SALOONS, 492, 0, 875000, "Greenwood" },
|
||||||
|
{ BV_TYPE_SALOONS, 558, 0, 750000, "Uranus" },
|
||||||
|
{ BV_TYPE_SALOONS, 504, 1, 750000, "Bloodring Banger" },
|
||||||
|
{ BV_TYPE_SALOONS, 405, 0, 725000, "Sentinel" },
|
||||||
|
{ BV_TYPE_SALOONS, 474, 0, 650000, "Hermes" },
|
||||||
|
{ BV_TYPE_SALOONS, 507, 0, 650000, "Elegant" },
|
||||||
|
{ BV_TYPE_SALOONS, 466, 0, 560000, "Glendale" },
|
||||||
|
{ BV_TYPE_SALOONS, 517, 0, 500000, "Majestic" },
|
||||||
|
{ BV_TYPE_SALOONS, 467, 0, 480000, "Oceanic" },
|
||||||
|
{ BV_TYPE_SALOONS, 585, 0, 480000, "Emperor" },
|
||||||
|
{ BV_TYPE_SALOONS, 516, 0, 475000, "Nebula" },
|
||||||
|
{ BV_TYPE_SALOONS, 419, 0, 425000, "Esperanto" },
|
||||||
|
{ BV_TYPE_SALOONS, 550, 0, 420000, "Sunrise" },
|
||||||
|
{ BV_TYPE_SALOONS, 518, 0, 400000, "Buccaneer" },
|
||||||
|
{ BV_TYPE_SALOONS, 491, 0, 350000, "Virgo" },
|
||||||
|
{ BV_TYPE_SALOONS, 549, 0, 310000, "Tampa" },
|
||||||
|
{ BV_TYPE_SALOONS, 445, 0, 300000, "Admiral" },
|
||||||
|
{ BV_TYPE_SALOONS, 401, 0, 250000, "Bravura" },
|
||||||
|
{ BV_TYPE_SALOONS, 551, 0, 230000, "Merit" },
|
||||||
|
{ BV_TYPE_SALOONS, 529, 0, 210000, "Willard" },
|
||||||
|
{ BV_TYPE_SALOONS, 542, 0, 200000, "Clover" },
|
||||||
|
{ BV_TYPE_SALOONS, 540, 0, 200000, "Vincent" },
|
||||||
|
{ BV_TYPE_SALOONS, 546, 0, 190000, "Intruder" },
|
||||||
|
{ BV_TYPE_SALOONS, 547, 0, 160000, "Primo" },
|
||||||
|
{ BV_TYPE_SALOONS, 526, 0, 160000, "Fortune" },
|
||||||
|
{ BV_TYPE_SALOONS, 410, 0, 150000, "Manana" },
|
||||||
|
{ BV_TYPE_SALOONS, 436, 0, 100000, "Previon" },
|
||||||
|
{ BV_TYPE_SALOONS, 527, 0, 75000, "Cadrona" },
|
||||||
|
|
||||||
|
// Sports
|
||||||
|
{ BV_TYPE_SPORTS, 411, 0, 5000000, "Infernus" },
|
||||||
|
{ BV_TYPE_SPORTS, 451, 0, 4000000, "Turismo" },
|
||||||
|
{ BV_TYPE_SPORTS, 541, 0, 3250000, "Bullet" },
|
||||||
|
{ BV_TYPE_SPORTS, 415, 0, 2600000, "Cheetah" },
|
||||||
|
{ BV_TYPE_SPORTS, 494, 1, 2500000, "Hotring Racer A" },
|
||||||
|
{ BV_TYPE_SPORTS, 502, 1, 2500000, "Hotring Racer B" },
|
||||||
|
{ BV_TYPE_SPORTS, 503, 1, 2500000, "Hotring Racer C" },
|
||||||
|
{ BV_TYPE_SPORTS, 402, 0, 2250000, "Buffalo" },
|
||||||
|
{ BV_TYPE_SPORTS, 429, 0, 1750000, "Banshee" },
|
||||||
|
{ BV_TYPE_SPORTS, 565, 0, 1250000, "Flash" },
|
||||||
|
{ BV_TYPE_SPORTS, 477, 0, 1100000, "ZR-350" },
|
||||||
|
{ BV_TYPE_SPORTS, 506, 0, 1000000, "Super GT" },
|
||||||
|
{ BV_TYPE_SPORTS, 559, 0, 1000000, "Jester" },
|
||||||
|
{ BV_TYPE_SPORTS, 602, 0, 1000000, "Alpha" },
|
||||||
|
{ BV_TYPE_SPORTS, 587, 0, 750000, "Euros" },
|
||||||
|
{ BV_TYPE_SPORTS, 475, 0, 675000, "Sabre" },
|
||||||
|
{ BV_TYPE_SPORTS, 603, 0, 630000, "Phoenix" },
|
||||||
|
{ BV_TYPE_SPORTS, 589, 0, 625000, "Club" },
|
||||||
|
{ BV_TYPE_SPORTS, 496, 0, 325000, "Blista Compact" },
|
||||||
|
|
||||||
|
// Station Wagons
|
||||||
|
{ BV_TYPE_STATION_WAGONS, 479, 0, 610000, "Regina" },
|
||||||
|
{ BV_TYPE_STATION_WAGONS, 458, 0, 600000, "Solair" },
|
||||||
|
{ BV_TYPE_STATION_WAGONS, 561, 0, 400000, "Stratum" },
|
||||||
|
{ BV_TYPE_STATION_WAGONS, 404, 0, 300000, "Perenniel" },
|
||||||
|
{ BV_TYPE_STATION_WAGONS, 418, 0, 320000, "Moonbeam" },
|
||||||
|
|
||||||
|
// Boats
|
||||||
|
{ BV_TYPE_BOATS, 484, 0, 5000000, "Marquis" },
|
||||||
|
{ BV_TYPE_BOATS, 493, 0, 3500000, "Jetmax" },
|
||||||
|
{ BV_TYPE_BOATS, 430, 1, 3500000, "Predator" },
|
||||||
|
{ BV_TYPE_BOATS, 446, 0, 2500000, "Squallo" },
|
||||||
|
{ BV_TYPE_BOATS, 454, 0, 1750000, "Tropic" },
|
||||||
|
{ BV_TYPE_BOATS, 595, 1, 1600000, "Launch" },
|
||||||
|
{ BV_TYPE_BOATS, 452, 0, 1000000, "Speeder" },
|
||||||
|
{ BV_TYPE_BOATS, 472, 1, 900000, "Coastguard" },
|
||||||
|
{ BV_TYPE_BOATS, 473, 0, 600000, "Dinghy" },
|
||||||
|
{ BV_TYPE_BOATS, 453, 0, 250000, "Reefer" },
|
||||||
|
|
||||||
|
// Unique
|
||||||
|
{ BV_TYPE_UNIQUE, 406, 1, 2900000, "Dumper" },
|
||||||
|
{ BV_TYPE_UNIQUE, 532, 1, 2500000, "Combine Harvester" },
|
||||||
|
{ BV_TYPE_UNIQUE, 409, 0, 2000000, "Stretch" },
|
||||||
|
{ BV_TYPE_UNIQUE, 539, 1, 2000000, "Vortex" },
|
||||||
|
{ BV_TYPE_UNIQUE, 508, 1, 2000000, "Journey" },
|
||||||
|
{ BV_TYPE_UNIQUE, 443, 1, 1300000, "Packer" },
|
||||||
|
{ BV_TYPE_UNIQUE, 423, 1, 850000, "Mr Whoopee" },
|
||||||
|
{ BV_TYPE_UNIQUE, 588, 1, 850000, "Hotdog" },
|
||||||
|
{ BV_TYPE_UNIQUE, 428, 1, 800000, "Securicar" },
|
||||||
|
{ BV_TYPE_UNIQUE, 434, 0, 780000, "Hotknife" },
|
||||||
|
{ BV_TYPE_UNIQUE, 483, 0, 770000, "Camper" },
|
||||||
|
{ BV_TYPE_UNIQUE, 525, 1, 500000, "Towtruck" },
|
||||||
|
{ BV_TYPE_UNIQUE, 545, 0, 500000, "Hustler" },
|
||||||
|
{ BV_TYPE_UNIQUE, 457, 1, 325000, "Caddy" },
|
||||||
|
{ BV_TYPE_UNIQUE, 486, 1, 200000, "Dozer" },
|
||||||
|
{ BV_TYPE_UNIQUE, 571, 1, 150000, "Kart" },
|
||||||
|
{ BV_TYPE_UNIQUE, 442, 0, 140000, "Romero" },
|
||||||
|
{ BV_TYPE_UNIQUE, 572, 1, 100000, "Mower" }
|
||||||
|
},
|
||||||
|
g_VehicleDealerCP [ 3 ] = { -1, ... }
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnScriptInit( )
|
||||||
|
{
|
||||||
|
// create checkpoints and labels for the dealerships
|
||||||
|
g_VehicleDealerCP[ 0 ] = CreateDynamicCP( -1867.9092, -646.3469, 1002.1284, 1.0, -1, -1, -1, 25.0 );
|
||||||
|
g_VehicleDealerCP[ 1 ] = CreateDynamicCP( -126.2794, 117.3427, 1004.7233, 1.0, -1, -1, -1, 25.0 );
|
||||||
|
g_VehicleDealerCP[ 2 ] = CreateDynamicCP( 540.7507, -1299.1378, 17.2859, 1.0, -1, -1, -1, 25.0 );
|
||||||
|
|
||||||
|
CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, -1867.9092, -646.3469, 1002.1284, 20.0 );
|
||||||
|
CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, 540.7507, -1299.1378, 17.2859, 20.0 );
|
||||||
|
CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, -126.2794, 117.3427, 1004.7233, 20.0 );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerEnterDynamicCP( playerid, checkpointid )
|
||||||
|
{
|
||||||
|
if ( checkpointid == g_VehicleDealerCP[ 0 ] || checkpointid == g_VehicleDealerCP[ 1 ] || checkpointid == g_VehicleDealerCP[ 2 ] ) {
|
||||||
|
return ShowBuyableVehiclesList( playerid ), Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
|
{
|
||||||
|
if ( dialogid == DIALOG_VEHDEALER && response ) {
|
||||||
|
ShowBuyableVehiclesTypeDialog( playerid, listitem + 1 );
|
||||||
|
}
|
||||||
|
else if ( dialogid == DIALOG_VEHDEALER_BUY )
|
||||||
|
{
|
||||||
|
if ( response )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
x = 0; // Error check
|
||||||
|
|
||||||
|
for( new id; id < sizeof( g_BuyableVehicleData ); id ++ )
|
||||||
|
{
|
||||||
|
if ( g_BuyableVehicleData[ id ] [ E_TYPE ] == GetPVarInt( playerid, "vehicle_preview" ) )
|
||||||
|
{
|
||||||
|
if ( x == listitem )
|
||||||
|
{
|
||||||
|
SetPVarInt( playerid, "buying_vehicle", id );
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_VEHDEALER_OPTIONS, DIALOG_STYLE_LIST, "{FFFFFF}Vehicle Dealership", "Purchase This Vehicle\nPreview Vehicle", "Select", "Back" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowBuyableVehiclesList( playerid ), SendError( playerid, "An error has occurred. (0x68F)");
|
||||||
|
}
|
||||||
|
else ShowBuyableVehiclesList( playerid );
|
||||||
|
}
|
||||||
|
else if ( dialogid == DIALOG_VEHDEALER_OPTIONS )
|
||||||
|
{
|
||||||
|
if ( !response )
|
||||||
|
return ShowBuyableVehiclesTypeDialog( playerid, GetPVarInt( playerid, "vehicle_preview" ) ), 1;
|
||||||
|
|
||||||
|
switch( listitem )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
new
|
||||||
|
data_id = GetPVarInt( playerid, "buying_vehicle" ),
|
||||||
|
model = g_BuyableVehicleData[ data_id ] [ E_MODEL ]
|
||||||
|
;
|
||||||
|
if ( p_OwnedVehicles[ playerid ] >= GetPlayerVehicleSlots( playerid ) ) return SendError( playerid, "You have reached the limit of purchasing vehicles." );
|
||||||
|
if ( GetPlayerScore( playerid ) < 200 ) return SendError( playerid, "You need at least 200 score to buy a vehicle." );
|
||||||
|
if ( GetPlayerCash( playerid ) < g_BuyableVehicleData[ data_id ] [ E_PRICE ] ) return SendError( playerid, "You don't have enough money for this vehicle." );
|
||||||
|
|
||||||
|
// VIP Check
|
||||||
|
if ( g_BuyableVehicleData[ data_id ] [ E_VIP ] )
|
||||||
|
{
|
||||||
|
if ( p_VIPLevel[ playerid ] < VIP_REGULAR )
|
||||||
|
return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
|
||||||
|
|
||||||
|
if ( ( ( 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 Float: X, Float: Y, Float: Z, Float: fA;
|
||||||
|
|
||||||
|
// set teleport vehicle location
|
||||||
|
if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 0 ] ) ) // LV?
|
||||||
|
{
|
||||||
|
if ( IsBoatVehicle( model ) ) X = 1633.71860, Y = 563.73600, Z = -0.0579, fA = 90.00000;
|
||||||
|
else if ( IsAirVehicle( model ) ) X = 1477.43920, Y = 1761.4778, Z = 11.2735, fA = 180.9139;
|
||||||
|
else X = 1986.85240, Y = 2049.2278, Z = 10.8203, fA = 132.5364;
|
||||||
|
}
|
||||||
|
else if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 1 ] ) ) // LS?
|
||||||
|
{
|
||||||
|
if ( IsBoatVehicle( model ) ) X = 728.4574, Y = -1516.2633, Z = 0.3122, fA = 178.5724;
|
||||||
|
else if ( IsAirVehicle( model ) ) X = 2048.7910, Y = -2493.8928, Z = 14.4686, fA = 90.00000;
|
||||||
|
else X = 560.9333, Y = -1267.5469, Z = 16.9957, fA = 17.2539;
|
||||||
|
}
|
||||||
|
else // SF
|
||||||
|
{
|
||||||
|
if ( IsBoatVehicle( model ) ) X = -2686.6484, Y = -938.5189, Z = -0.1212, fA = 109.4955;
|
||||||
|
else if ( IsAirVehicle( model ) ) X = -1666.2905, Y = -173.4397, Z = 15.0692, fA = 314.6289;
|
||||||
|
else X = -2518.9045, Y = -614.8578, Z = 132.302, fA = 267.8874;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPlayerInterior( playerid, 0 );
|
||||||
|
SetPlayerVirtualWorld( playerid, 0 );
|
||||||
|
|
||||||
|
X += fRandomEx( 0, 1 );
|
||||||
|
Z += 3; // Just plane jams or someshit...
|
||||||
|
|
||||||
|
new bID = CreateBuyableVehicle( playerid, model, random( 126 ), random( 126 ), X, Y, Z, fA, g_BuyableVehicleData[ data_id ] [ E_PRICE ] );
|
||||||
|
if ( bID == -1 ) return SendClientMessage( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" Unable to create a vehicle due to a unexpected error." );
|
||||||
|
GivePlayerCash( playerid, -g_BuyableVehicleData[ data_id ] [ E_PRICE ] );
|
||||||
|
autosaveStart( playerid, true ); // auto-save
|
||||||
|
|
||||||
|
GetVehicleParamsEx( g_vehicleData[ playerid ] [ bID ] [ E_VEHICLE_ID ], engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
SetVehicleParamsEx( g_vehicleData[ playerid ] [ bID ] [ E_VEHICLE_ID ], VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
PutPlayerInVehicle( playerid, g_vehicleData[ playerid ] [ bID ] [ E_VEHICLE_ID ], 0 );
|
||||||
|
|
||||||
|
SendServerMessage( playerid, "You have bought an "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE"!", g_BuyableVehicleData[ data_id ] [ E_NAME ], cash_format( g_BuyableVehicleData[ data_id ] [ E_PRICE ] ) );
|
||||||
|
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", "" );
|
||||||
|
SetPVarInt( playerid, "bought_veh_ts", g_iTime + 30 );
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
new model = g_BuyableVehicleData[ GetPVarInt( playerid, "buying_vehicle" ) ] [ E_MODEL ];
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 0 ] = CreatePlayerTextDraw(playerid,289.000000, 230.000000, "preview 2");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 0 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 0 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 0 ], 0.500000, 4.400000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 0 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 0 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 0 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 0 ], 60.000000, 60.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 0 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 0 ], -16.000000, 0.000000, 0.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 0 ], 0);
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 1 ] = CreatePlayerTextDraw(playerid,358.000000, 160.000000, "preview 3");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 1 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 1 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 1 ], 0.500000, 4.400000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 1 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 1 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 1 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 1 ], 60.000000, 60.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 1 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 1 ], -16.000000, 0.000000, 270.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 1 ], 0);
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 2 ] = CreatePlayerTextDraw(playerid,358.000000, 230.000000, "preview 4");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 2 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 2 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 2 ], 0.500000, 4.400000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 2 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 2 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 2 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 2 ], 60.000000, 60.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 2 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 2 ], -16.000000, 0.000000, 90.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 2 ], 0);
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 3 ] = CreatePlayerTextDraw(playerid,428.000000, 160.000000, "preview 4");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 3 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 3 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 3 ], 0.500000, 4.400000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 3 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 3 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 3 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 3 ], 60.000000, 60.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 3 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 3 ], 270.000000, 0.000000, 0.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 3 ], 0);
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 4 ] = CreatePlayerTextDraw(playerid,428.000000, 230.000000, "preview 5");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 4 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 4 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 4 ], 0.500000, 4.400000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 4 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 4 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 4 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 4 ], 60.000000, 60.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 4 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 4 ], 90.000000, 0.000000, 0.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 4 ], 0);
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 5 ] = CreatePlayerTextDraw(playerid,150.000000, 160.000000, "big preview");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 5 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 5 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 5 ], 0.500000, 1.000000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 5 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 5 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 5 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 5 ], 130.000000, 130.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 5 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 5 ], -16.000000, 0.000000, 45.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 5 ], 0);
|
||||||
|
|
||||||
|
p_VehiclePreviewTD[ 6 ] = CreatePlayerTextDraw(playerid,289.000000, 160.000000, "preview 6");
|
||||||
|
PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 6 ], 112);
|
||||||
|
PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 6 ], 5);
|
||||||
|
PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 6 ], 0.500000, 4.400000);
|
||||||
|
PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 6 ], -1);
|
||||||
|
PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 6 ], 1);
|
||||||
|
PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 6 ], 0);
|
||||||
|
PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 6 ], 60.000000, 60.000000);
|
||||||
|
PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 6 ], model);
|
||||||
|
PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 6 ], -16.000000, 0.000000, 180.000000, 1.000000);
|
||||||
|
PlayerTextDrawSetSelectable(playerid, p_VehiclePreviewTD[ 6 ], 0);
|
||||||
|
|
||||||
|
TextDrawShowForPlayer( playerid, g_VehiclePreviewBoxTD );
|
||||||
|
TextDrawShowForPlayer( playerid, g_VehiclePreviewTxtTD );
|
||||||
|
TextDrawShowForPlayer( playerid, p_VehiclePreviewCloseTD );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 0 ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 1 ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 2 ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 3 ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 4 ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 5 ] );
|
||||||
|
PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 6 ] );
|
||||||
|
|
||||||
|
p_inMovieMode{ playerid } = false;
|
||||||
|
cmd_moviemode( playerid, "" ); // Hide textdraws :3
|
||||||
|
|
||||||
|
SelectTextDraw( playerid, COLOR_RED );
|
||||||
|
SetPVarInt( playerid, "viewing_vehicle", 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( dialogid == DIALOG_BOUGHT_VEH )
|
||||||
|
{
|
||||||
|
if ( GetPVarInt( playerid, "bought_veh_ts" ) < g_iTime )
|
||||||
|
{
|
||||||
|
DeletePVar( playerid, "bought_veh_ts" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
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", "" );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Functions ** */
|
||||||
|
stock ShowBuyableVehiclesList( playerid )
|
||||||
|
{
|
||||||
|
static
|
||||||
|
szCategory[ 16 * sizeof( g_BVCategories ) ];
|
||||||
|
|
||||||
|
if ( szCategory[ 0 ] == '\0' ) {
|
||||||
|
for( new i; i < sizeof( g_BVCategories ); i++ ) {
|
||||||
|
format( szCategory, sizeof( szCategory ), "%s%s\n", szCategory, g_BVCategories[ i ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ShowPlayerDialog( playerid, DIALOG_VEHDEALER, DIALOG_STYLE_LIST, "{FFFFFF}Vehicle Dealership", szCategory, "Select", "Cancel" );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ShowBuyableVehiclesTypeDialog( playerid, type_id )
|
||||||
|
{
|
||||||
|
static
|
||||||
|
szBuyableVehicles[ 1400 ];
|
||||||
|
|
||||||
|
erase( szBuyableVehicles );
|
||||||
|
|
||||||
|
for( new i; i < sizeof( g_BuyableVehicleData ); i++ )
|
||||||
|
{
|
||||||
|
if ( g_BuyableVehicleData[ i ] [ E_TYPE ] == type_id )
|
||||||
|
format( szBuyableVehicles, sizeof( szBuyableVehicles ), "%s"COL_GOLD"%s%s%s\t%s\n", szBuyableVehicles, cash_format( g_BuyableVehicleData[ i ] [ E_PRICE ] ), g_BuyableVehicleData[ i ] [ E_VIP ] ? ( "" ) : ( #COL_WHITE ), g_BuyableVehicleData[ i ] [ E_PRICE ] < 100000 ? ( "\t" ) : ( "" ), g_BuyableVehicleData[ i ] [ E_NAME ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_VEHDEALER_BUY, DIALOG_STYLE_LIST, "{FFFFFF}Vehicle Dealership", szBuyableVehicles, "Options", "Cancel" );
|
||||||
|
SetPVarInt( playerid, "vehicle_preview", type_id );
|
||||||
|
return 1;
|
||||||
|
}
|
899
gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn
Normal file
899
gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn
Normal file
@ -0,0 +1,899 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: cnr\features\vehicles\vehicles.pwn
|
||||||
|
* Purpose: personal vehicle system
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
#define MAX_BUYABLE_VEHICLES ( 20 + VIP_MAX_EXTRA_SLOTS )
|
||||||
|
#define MAX_CAR_MODS 15
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
enum E_CAR_DATA
|
||||||
|
{
|
||||||
|
E_VEHICLE_ID, bool: E_CREATED, bool: E_LOCKED,
|
||||||
|
Float: E_X, Float: E_Y, Float: E_Z,
|
||||||
|
Float: E_ANGLE, E_OWNER_ID, E_PRICE,
|
||||||
|
E_COLOR[ 2 ], E_MODEL, E_PLATE[ 32 ],
|
||||||
|
E_PAINTJOB, E_SQL_ID, E_GARAGE
|
||||||
|
};
|
||||||
|
|
||||||
|
new
|
||||||
|
g_vehicleData [ MAX_PLAYERS ] [ MAX_BUYABLE_VEHICLES ] [ E_CAR_DATA ],
|
||||||
|
bool: g_buyableVehicle [ MAX_VEHICLES char ],
|
||||||
|
g_vehicleModifications [ MAX_PLAYERS ] [ MAX_BUYABLE_VEHICLES ] [ MAX_CAR_MODS ]
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
|
{
|
||||||
|
if ( dialogid == DIALOG_VEHICLE_SPAWN && response )
|
||||||
|
{
|
||||||
|
if ( !listitem )
|
||||||
|
{
|
||||||
|
for( new id; id < MAX_BUYABLE_VEHICLES; id ++ )
|
||||||
|
if ( g_vehicleData[ playerid ] [ id ] [ E_CREATED ] && g_vehicleData[ playerid ] [ id ] [ E_OWNER_ID ] == p_AccountID[ playerid ] && IsValidVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) )
|
||||||
|
RespawnBuyableVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] );
|
||||||
|
|
||||||
|
SendServerMessage( playerid, "You have respawned all your vehicles." );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( new id, x = 1; id < MAX_BUYABLE_VEHICLES; id ++ )
|
||||||
|
{
|
||||||
|
if ( g_vehicleData[ playerid ] [ id ] [ E_CREATED ] && g_vehicleData[ playerid ] [ id ] [ E_OWNER_ID ] == p_AccountID[ playerid ] && IsValidVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) )
|
||||||
|
{
|
||||||
|
if ( x == listitem )
|
||||||
|
{
|
||||||
|
RespawnBuyableVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] );
|
||||||
|
SendServerMessage( playerid, "You have respawned your "COL_GREY"%s"COL_WHITE".", GetVehicleName( GetVehicleModel( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( dialogid == DIALOG_VEHICLE_LOCATE && response )
|
||||||
|
{
|
||||||
|
if ( GetPlayerInterior( playerid ) || GetPlayerVirtualWorld( playerid ) )
|
||||||
|
return SendError( playerid, "You cannot use this feature inside of an interior." );
|
||||||
|
|
||||||
|
new
|
||||||
|
Float: X, Float: Y, Float: Z;
|
||||||
|
|
||||||
|
GetPlayerPos( playerid, X, Y, Z );
|
||||||
|
|
||||||
|
for( new id, x = 0; id < MAX_BUYABLE_VEHICLES; id ++ )
|
||||||
|
{
|
||||||
|
if ( g_vehicleData[ playerid ] [ id ] [ E_CREATED ] == true && g_vehicleData[ playerid ] [ id ] [ E_OWNER_ID ] == p_AccountID[ playerid ] && IsValidVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) )
|
||||||
|
{
|
||||||
|
if ( x == listitem )
|
||||||
|
{
|
||||||
|
if ( GetPlayerCash( playerid ) < 10000 )
|
||||||
|
return SendError( playerid, "You need $10,000 to bring your vehicle to you." );
|
||||||
|
|
||||||
|
foreach( new i : Player )
|
||||||
|
{
|
||||||
|
if( GetPlayerVehicleID( i ) == g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] )
|
||||||
|
{
|
||||||
|
GetPlayerPos( i, X, Y, Z );
|
||||||
|
SetPlayerPos( i, X, Y, ( Z + 0.5 ) );
|
||||||
|
SendServerMessage( i, "You have been thrown out of the vehicle as the owner has teleported it away!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
Float: nodeX, Float: nodeY, Float: nodeZ, Float: nextX, Float: nextY,
|
||||||
|
nodeid = NearestNodeFromPoint( X, Y, Z ),
|
||||||
|
nextNodeid = NearestNodeFromPoint( X, Y, Z, 9999.9, nodeid )
|
||||||
|
;
|
||||||
|
|
||||||
|
GetNodePos( nextNodeid, nextX, nextY, nodeZ );
|
||||||
|
GetNodePos( nodeid, nodeX, nodeY, nodeZ );
|
||||||
|
|
||||||
|
new
|
||||||
|
Float: rotation = atan2( nextY - nodeY, nextX - nodeX ) - 90.0;
|
||||||
|
|
||||||
|
SetVehiclePos( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], nodeX, nodeY, nodeZ + 1.0 );
|
||||||
|
SetVehicleZAngle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], rotation );
|
||||||
|
LinkVehicleToInterior( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], 0 );
|
||||||
|
SetVehicleVirtualWorld( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], 0 );
|
||||||
|
|
||||||
|
// alert
|
||||||
|
Beep( playerid );
|
||||||
|
GivePlayerCash( playerid, -10000 );
|
||||||
|
p_VehicleBringCooldown[ playerid ] = g_iTime + 120;
|
||||||
|
SendServerMessage( playerid, "You have brought your "COL_GREY"%s"COL_WHITE". Check the nearest road for it.", GetVehicleName( GetVehicleModel( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerDriveVehicle( playerid, vehicleid )
|
||||||
|
{
|
||||||
|
if ( g_buyableVehicle{ vehicleid } == true )
|
||||||
|
{
|
||||||
|
new ownerid, slotid;
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid, slotid );
|
||||||
|
|
||||||
|
if ( v == -1 ) {
|
||||||
|
return 1; // ignore if unowned/erroneous
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ownerid != playerid )
|
||||||
|
{
|
||||||
|
if ( g_vehicleData[ ownerid ] [ slotid ] [ E_LOCKED ] == true )
|
||||||
|
{
|
||||||
|
if ( p_AdminLevel[ playerid ] < 3 || !p_AdminOnDuty{ playerid } )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
model_id = GetVehicleModel( vehicleid );
|
||||||
|
|
||||||
|
GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
SetVehicleParamsEx( vehicleid, VEHICLE_PARAMS_ON, lights, VEHICLE_PARAMS_ON, doors, bonnet, boot, objective );
|
||||||
|
|
||||||
|
// Remove helicopter bottoms
|
||||||
|
if ( GetGVarInt( "heli_gunner", vehicleid ) && ( model_id == 487 || model_id == 497 ) ) {
|
||||||
|
DestroyDynamicObject( GetGVarInt( "heli_gunner", vehicleid ) );
|
||||||
|
DeleteGVar( "heli_gunner", vehicleid );
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncObject( playerid, 1 ); // Just sets the players position where the vehicle is.
|
||||||
|
SendError( playerid, "You cannot drive this car, it has been locked by the owner." );
|
||||||
|
}
|
||||||
|
else SendClientMessage( playerid, -1, ""COL_PINK"[ADMIN]"COL_GREY" This is a locked vehicle." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ownerid == playerid )
|
||||||
|
{
|
||||||
|
SendClientMessage(playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" Welcome back to your vehicle.");
|
||||||
|
Beep( playerid );
|
||||||
|
GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
SetVehicleParamsEx( vehicleid, VEHICLE_PARAMS_ON, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else SendClientMessageFormatted( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" This vehicle is owned by %s.", ReturnPlayerName( ownerid ) );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnEnterExitModShop( playerid, enterexit, interiorid )
|
||||||
|
{
|
||||||
|
if ( enterexit == 0 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
vehicleid = GetPlayerVehicleID( playerid );
|
||||||
|
|
||||||
|
if ( IsValidVehicle( vehicleid ) )
|
||||||
|
{
|
||||||
|
if ( g_buyableVehicle{ vehicleid } == true )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
v = getVehicleSlotFromID( vehicleid, ownerid )
|
||||||
|
;
|
||||||
|
if ( ownerid == playerid && v != -1 )
|
||||||
|
{
|
||||||
|
if ( UpdateBuyableVehicleMods( playerid, v ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
szMods[ MAX_CAR_MODS * 10 ];
|
||||||
|
|
||||||
|
for( new i; i < MAX_CAR_MODS; i++ ) {
|
||||||
|
format( szMods, sizeof( szMods ), "%s%d.", szMods, g_vehicleModifications[ playerid ] [ v ] [ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
format( szBigString, sizeof( szBigString ), "UPDATE `VEHICLES` SET `MODS`='%s' WHERE `ID`=%d", szMods, g_vehicleData[ playerid ] [ v ] [ E_SQL_ID ] );
|
||||||
|
mysql_single_query( szBigString );
|
||||||
|
}
|
||||||
|
else SendError( playerid, "Couldn't update your vehicle mods due to an unexpected error (0x82FF)." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnVehiclePaintjob( playerid, vehicleid, paintjobid )
|
||||||
|
{
|
||||||
|
if ( g_buyableVehicle{ vehicleid } == true )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
v = getVehicleSlotFromID( vehicleid, ownerid )
|
||||||
|
;
|
||||||
|
if ( ownerid == playerid && v != -1 )
|
||||||
|
{
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_PAINTJOB ] = paintjobid;
|
||||||
|
SaveVehicleData( playerid, v );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnVehicleRespray( playerid, vehicleid, color1, color2 )
|
||||||
|
{
|
||||||
|
if ( g_buyableVehicle{ vehicleid } == true )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
v = getVehicleSlotFromID( vehicleid, ownerid )
|
||||||
|
;
|
||||||
|
if ( ownerid == playerid && v != -1 )
|
||||||
|
{
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_COLOR ] [ 0 ] = color1;
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_COLOR ] [ 1 ] = color2;
|
||||||
|
SaveVehicleData( playerid, v );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Commands ** */
|
||||||
|
CMD:vehicle( playerid, params[ ] ) return cmd_v( playerid, params );
|
||||||
|
CMD:v( 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)" );
|
||||||
|
|
||||||
|
// force hoarders to sell
|
||||||
|
if ( ! p_VIPLevel[ playerid ] && p_OwnedVehicles[ playerid ] > GetPlayerVehicleSlots( playerid ) && ! strmatch( params, "sell" ) && ! strmatch( params, "bring" ) ) {
|
||||||
|
for( new i = 0; i < p_OwnedVehicles[ playerid ]; i++ ) if ( g_vehicleData[ playerid ] [ i ] [ E_OWNER_ID ] == p_AccountID[ playerid ] ) {
|
||||||
|
g_vehicleData[ playerid ] [ i ] [ E_LOCKED ] = false;
|
||||||
|
}
|
||||||
|
return SendError( playerid, "Please renew your V.I.P or sell this vehicle to match your vehicle allocated limit. (/v sell/bring only)" );
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
vehicleid = GetPlayerVehicleID( playerid ),
|
||||||
|
ownerid = INVALID_PLAYER_ID
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( isnull( params ) ) return SendUsage( playerid, "/v [SELL/COLOR/LOCK/PARK/RESPAWN/BRING/DATA/PLATE/PAINTJOB/RESET]" );
|
||||||
|
else if ( strmatch( params, "sell" ) )
|
||||||
|
{
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid );
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( g_buyableVehicle{ vehicleid } == false ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( playerid != ownerid ) return SendError( playerid, "You cannot sell this vehicle." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
format( szBigString, sizeof( szBigString ), "[SELL] [%s] %s | %d | %s\r\n", getCurrentDate( ), ReturnPlayerName( playerid ), v, GetVehicleName( GetVehicleModel( g_vehicleData[ playerid ] [ v ] [ E_VEHICLE_ID ] ) ) );
|
||||||
|
AddFileLogLine( "log_destroycar.txt", szBigString );
|
||||||
|
GivePlayerCash( playerid, ( g_vehicleData[ playerid ] [ v ] [ E_PRICE ] / 2 ) );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" You have sold this vehicle for half the price it was (%s).", cash_format( ( g_vehicleData[ playerid ] [ v ] [ E_PRICE ] / 2 ) ) );
|
||||||
|
DestroyBuyableVehicle( playerid, v );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "lock" ) )
|
||||||
|
{
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid );
|
||||||
|
if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( g_buyableVehicle{ vehicleid } == false ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( playerid != ownerid ) return SendError( playerid, "You cannot lock this vehicle." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_LOCKED ] = !g_vehicleData[ playerid ] [ v ] [ E_LOCKED ];
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" You have %s this vehicle.", g_vehicleData[ playerid ] [ v ] [ E_LOCKED ] == true ? ( "locked" ) : ( "un-locked" ) );
|
||||||
|
SaveVehicleData( playerid, v );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "park" ) )
|
||||||
|
{
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid ), Float: X, Float: Y, Float: Z, Float: Angle;
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( playerid != ownerid ) return SendError( playerid, "You cannot park this vehicle." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( IsVehicleUpsideDown( GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "Sorry, you're just going to have to ditch your car as soon as possible." );
|
||||||
|
|
||||||
|
new
|
||||||
|
iBreach = PlayerBreachedGarageLimit( playerid, v );
|
||||||
|
|
||||||
|
if ( iBreach == -1 ) return SendError( playerid, "You cannot park vehicles that are not owned by the owner of this garage." );
|
||||||
|
if ( iBreach == -2 ) return SendError( playerid, "This garage has already reached its capacity of %d vehicles.", GetGarageVehicleCapacity( p_InGarage[ playerid ] ) );
|
||||||
|
|
||||||
|
GetVehiclePos( vehicleid, X, Y, Z );
|
||||||
|
GetVehicleZAngle( vehicleid, Angle );
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_X ] = X, g_vehicleData[ playerid ] [ v ] [ E_Y ] = Y, g_vehicleData[ playerid ] [ v ] [ E_Z ] = Z, g_vehicleData[ playerid ] [ v ] [ E_ANGLE ] = Angle;
|
||||||
|
PutPlayerInVehicle( playerid, RespawnBuyableVehicle( vehicleid, playerid ), 0 );
|
||||||
|
SetTimerEx( "timedUpdates_RBV", 25, false, "ddf", playerid, INVALID_VEHICLE_ID, -1000.0 );
|
||||||
|
SaveVehicleData( playerid, v );
|
||||||
|
SendClientMessage( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" You have parked this vehicle." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "respawn" ) )
|
||||||
|
{
|
||||||
|
if ( p_OwnedVehicles[ playerid ] > 0 )
|
||||||
|
{
|
||||||
|
szLargeString = ""COL_GREY"Respawn All Vehicles\n";
|
||||||
|
for( new i; i < p_OwnedVehicles[ playerid ]; i++ )
|
||||||
|
{
|
||||||
|
if ( g_vehicleData[ playerid ] [ i ] [ E_OWNER_ID ] == p_AccountID[ playerid ] && IsValidVehicle( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ] ) ) {
|
||||||
|
format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, GetVehicleName( GetVehicleModel( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ] ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_VEHICLE_SPAWN, DIALOG_STYLE_LIST, "{FFFFFF}Spawn your vehicle", szLargeString, "Select", "Cancel" );
|
||||||
|
}
|
||||||
|
else SendError( playerid, "You don't own any vehicles." );
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "locate" ) ) return SendServerMessage( playerid, "This feature has been replaced with "COL_GREY"/v bring"COL_WHITE"." );
|
||||||
|
else if ( strmatch( params, "bring" ) )
|
||||||
|
{
|
||||||
|
if ( p_VehicleBringCooldown[ playerid ] > g_iTime )
|
||||||
|
return SendError( playerid, "You must wait %s before using this feature again.", secondstotime( p_VehicleBringCooldown[ playerid ] - g_iTime ) );
|
||||||
|
|
||||||
|
if ( p_OwnedVehicles[ playerid ] > 0 )
|
||||||
|
{
|
||||||
|
szLargeString = ""COL_WHITE"Bringing your vehicle to you will cost $10,000!\n";
|
||||||
|
for( new i; i < p_OwnedVehicles[ playerid ]; i++ )
|
||||||
|
{
|
||||||
|
if ( g_vehicleData[ playerid ] [ i ] [ E_OWNER_ID ] == p_AccountID[ playerid ] && IsValidVehicle( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ] ) ) {
|
||||||
|
format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, GetVehicleName( GetVehicleModel( g_vehicleData[ playerid ] [ i ] [ E_VEHICLE_ID ] ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_VEHICLE_LOCATE, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Bring Vehicle", szLargeString, "Select", "Cancel" );
|
||||||
|
}
|
||||||
|
else SendError( playerid, "You don't own any vehicles." );
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "data" ) )
|
||||||
|
{
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You are not in any vehicle." );
|
||||||
|
else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid );
|
||||||
|
if ( playerid != ownerid ) return SendError( playerid, "You don't own this vehicle." );
|
||||||
|
|
||||||
|
format( szBigString, sizeof( szBigString ), ""COL_GREY"Vehicle Owner:"COL_WHITE" %s\n"\
|
||||||
|
""COL_GREY"Vehicle Type:"COL_WHITE" %s\n"\
|
||||||
|
""COL_GREY"Vehicle ID:"COL_WHITE" %d\n"\
|
||||||
|
""COL_GREY"Vehicle Price:"COL_WHITE" %s",
|
||||||
|
ReturnPlayerName( ownerid ), GetVehicleName( GetVehicleModel( GetPlayerVehicleID( playerid ) ) ),
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_SQL_ID ], cash_format( g_vehicleData[ playerid ] [ v ] [ E_PRICE ] ) );
|
||||||
|
ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{FFFFFF}Vehicle Data", szBigString, "Okay", "" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !strcmp( params, "color", false, 4 ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
color1, color2
|
||||||
|
;
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." );
|
||||||
|
else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
else if ( sscanf( params[ 6 ], "dd", color1, color2 ) ) return SendUsage( playerid, "/v color [COLOR_1] [COLOR_2]" );
|
||||||
|
else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This isn't a buyable vehicle." );
|
||||||
|
else if ( GetPlayerCash( playerid ) < 100 ) return SendError( playerid, "You don't have enough cash for this." );
|
||||||
|
else if ( color1 > 255 || color1 < 0 || color2 > 255 || color2 < 0 ) return SendError( playerid, "Invalid vehicle color ID." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new vID = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid );
|
||||||
|
if ( playerid != ownerid ) return SendError( playerid, "You don't own this vehicle." );
|
||||||
|
if ( IsVehicleUpsideDown( GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "Sorry, you're just going to have to ditch your car as soon as possible." );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 0 ] = color1;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 1 ] = color2;
|
||||||
|
GivePlayerCash( playerid, -100 );
|
||||||
|
PutPlayerInVehicle( playerid, RespawnBuyableVehicle( vehicleid, playerid ), 0 );
|
||||||
|
SaveVehicleData( playerid, vID );
|
||||||
|
SendServerMessage( playerid, "You have successfully changed your vehicle colors." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !strcmp( params, "plate", false, 4 ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
szPlate[ 32 ]
|
||||||
|
;
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." );
|
||||||
|
else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
else if ( sscanf( params[ 6 ], "s[32]", szPlate ) ) return SendUsage( playerid, "/v plate [TEXT]" );
|
||||||
|
else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This isn't a buyable vehicle." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new vID = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid );
|
||||||
|
if ( playerid != ownerid ) return SendError( playerid, "You don't own this vehicle." );
|
||||||
|
if ( IsBoatVehicle( GetVehicleModel( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] ) ) || IsAirVehicle( GetVehicleModel( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] ) ) ) return SendError( playerid, "Sorry, this feature is not available on planes and boats." );
|
||||||
|
if ( IsVehicleUpsideDown( GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "Sorry, you're just going to have to ditch your car as soon as possible." );
|
||||||
|
format( g_vehicleData[ playerid ] [ vID ] [ E_PLATE ], 32, "%s", szPlate );
|
||||||
|
PutPlayerInVehicle( playerid, RespawnBuyableVehicle( vehicleid, playerid ), 0 );
|
||||||
|
SaveVehicleData( playerid, vID );
|
||||||
|
SendServerMessage( playerid, "Your have changed your vehicle's number plate to "COL_GREY"%s"COL_WHITE".", szPlate );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !strcmp( params, "paintjob", false, 7 ) )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
paintjobid
|
||||||
|
;
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." );
|
||||||
|
else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
else if ( sscanf( params[ 9 ], "d", paintjobid ) ) return SendUsage( playerid, "/v paintjob [PAINT_JOB_ID]" );
|
||||||
|
else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This isn't a buyable vehicle." );
|
||||||
|
else if ( GetPlayerCash( playerid ) < 500 ) return SendError( playerid, "You don't have enough cash for this." );
|
||||||
|
else if ( paintjobid < 0 || paintjobid > 3 ) return SendError( playerid, "Please specify a paintjob between 0 to 3." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new vID = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid );
|
||||||
|
if ( playerid != ownerid ) return SendError( playerid, "You don't own this vehicle." );
|
||||||
|
if ( !IsPaintJobVehicle( GetVehicleModel( GetPlayerVehicleID( playerid ) ) ) ) return SendError( playerid, "This vehicle cannot have a paintjob installed." );
|
||||||
|
if ( IsVehicleUpsideDown( GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "Sorry, you're just going to have to ditch your car as soon as possible." );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_PAINTJOB ] = paintjobid;
|
||||||
|
ChangeVehiclePaintjob( GetPlayerVehicleID( playerid ), paintjobid );
|
||||||
|
GivePlayerCash( playerid, -500 );
|
||||||
|
PutPlayerInVehicle( playerid, RespawnBuyableVehicle( vehicleid, playerid ), 0 );
|
||||||
|
SaveVehicleData( playerid, vID );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !strcmp( params, "toggle", false, 5 ) )
|
||||||
|
{
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid );
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( playerid != ownerid ) return SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !strlen( params[ 7 ] ) )
|
||||||
|
return SendUsage( playerid, "/v toggle [DOORS/BONNET/BOOT/LIGHTS/WINDOWS]" );
|
||||||
|
|
||||||
|
GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
|
||||||
|
if ( !strcmp( params[ 7 ], "doors", true, 5 ) ) {
|
||||||
|
if ( !strlen( params[ 13 ] ) ) return SendUsage( playerid, "/v toggle doors [OPEN/CLOSE]" );
|
||||||
|
if ( strmatch( params[ 13 ], "open" ) ) {
|
||||||
|
SetVehicleParamsCarDoors( vehicleid, 1, 1, 1, 1 );
|
||||||
|
return SendServerMessage( playerid, "You have opened the doors of this vehicle." );
|
||||||
|
}
|
||||||
|
else if ( strmatch( params[ 13 ], "close" ) ) {
|
||||||
|
SetVehicleParamsCarDoors( vehicleid, 0, 0, 0, 0 );
|
||||||
|
return SendServerMessage( playerid, "You have closed the doors of this vehicle." );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return SendUsage( playerid, "/v toggle doors [OPEN/CLOSE]" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ( !strcmp( params[ 7 ], "windows", true, 7 ) ) {
|
||||||
|
if ( !strlen( params[ 15 ] ) ) return SendUsage( playerid, "/v toggle windows [OPEN/CLOSE]" );
|
||||||
|
if ( strmatch( params[ 15 ], "open" ) ) {
|
||||||
|
SetVehicleParamsCarWindows( vehicleid, 0, 0, 0, 0 );
|
||||||
|
return SendServerMessage( playerid, "You have opened the windows of this vehicle." );
|
||||||
|
}
|
||||||
|
else if ( strmatch( params[ 15 ], "close" ) ) {
|
||||||
|
SetVehicleParamsCarWindows( vehicleid, 1, 1, 1, 1 );
|
||||||
|
return SendServerMessage( playerid, "You have closed the windows of this vehicle." );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return SendUsage( playerid, "/v toggle windows [OPEN/CLOSE]" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ( strmatch( params[ 7 ], "bonnet" ) ){
|
||||||
|
SendServerMessage( playerid, "You have %s the bonnet of this vehicle.", ( bonnet = !bonnet ) ? ( "opened" ) : ( "closed" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ( strmatch( params[ 7 ], "boot" ) ) {
|
||||||
|
SendServerMessage( playerid, "You have %s the boot of this vehicle.", ( boot = !boot ) ? ( "opened" ) : ( "closed" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ( strmatch( params[ 7 ], "lights" ) ) {
|
||||||
|
SendServerMessage( playerid, "You have %s the lights of this vehicle.", ( lights = !lights ) ? ( "switched on" ) : ( "switched off" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
return SendUsage( playerid, "/v toggle [DOORS/BONNET/BOOT/LIGHTS/WINDOWS]" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( strmatch( params, "reset" ) )
|
||||||
|
{
|
||||||
|
new v = getVehicleSlotFromID( vehicleid, ownerid );
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
else if ( playerid != ownerid ) return SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( IsVehicleUpsideDown( vehicleid ) ) return SendError( playerid, "Sorry, you're just going to have to ditch your car as soon as possible." );
|
||||||
|
ResetBuyableVehicleMods( playerid, v, 0 );
|
||||||
|
ChangeVehiclePaintjob( vehicleid, 3 );
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_PAINTJOB ] = 3;
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_COLOR ] [ 0 ] = 0;
|
||||||
|
g_vehicleData[ playerid ] [ v ] [ E_COLOR ] [ 1 ] = 0;
|
||||||
|
PutPlayerInVehicle( playerid, RespawnBuyableVehicle( vehicleid, playerid ), 0 );
|
||||||
|
SaveVehicleData( playerid, v );
|
||||||
|
SendClientMessage( playerid, -1, ""COL_GREY"[SERVER]"COL_WHITE" You have reset your vehicle's appearance." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else SendUsage( playerid, "/v [SELL/COLOR/LOCK/PARK/RESPAWN/BRING/DATA/PLATE/PAINTJOB/TOGGLE/RESET]" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** SQL Threads ** */
|
||||||
|
thread OnVehicleLoad( playerid )
|
||||||
|
{
|
||||||
|
if ( !IsPlayerConnected( playerid ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
new
|
||||||
|
rows, fields, i = -1, vID,
|
||||||
|
Query[ 76 ]
|
||||||
|
;
|
||||||
|
|
||||||
|
cache_get_data( rows, fields );
|
||||||
|
if ( rows )
|
||||||
|
{
|
||||||
|
while( ++i < rows )
|
||||||
|
{
|
||||||
|
for( vID = 0; vID < MAX_BUYABLE_VEHICLES; vID++ )
|
||||||
|
if ( !g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] ) break;
|
||||||
|
|
||||||
|
if ( vID >= MAX_BUYABLE_VEHICLES )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
cache_get_field_content( i, "PLATE", g_vehicleData[ playerid ] [ vID ] [ E_PLATE ], dbHandle, 32 );
|
||||||
|
cache_get_field_content( i, "MODS", Query ), sscanf( Query, "p<.>e<ddddddddddddddd>", g_vehicleModifications[ playerid ] [ vID ] );
|
||||||
|
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_SQL_ID ] = cache_get_field_content_int( i, "ID", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_OWNER_ID ] = cache_get_field_content_int( i, "OWNER", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_MODEL ] = cache_get_field_content_int( i, "MODEL", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_LOCKED ] = !!cache_get_field_content_int( i, "LOCKED", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_X ] = cache_get_field_content_float( i, "X", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_Y ] = cache_get_field_content_float( i, "Y", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_Z ] = cache_get_field_content_float( i, "Z", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_ANGLE ] = cache_get_field_content_float( i, "ANGLE", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 0 ] = cache_get_field_content_int( i, "COLOR1", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 1 ] = cache_get_field_content_int( i, "COLOR2", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_PRICE ] = cache_get_field_content_int( i, "PRICE", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_PAINTJOB ] = cache_get_field_content_int( i, "PAINTJOB", dbHandle );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_GARAGE ] = cache_get_field_content_int( i, "GARAGE", dbHandle );
|
||||||
|
|
||||||
|
new iVehicle = CreateVehicle( g_vehicleData[ playerid ] [ vID ] [ E_MODEL ], g_vehicleData[ playerid ] [ vID ] [ E_X ], g_vehicleData[ playerid ] [ vID ] [ E_Y ], g_vehicleData[ playerid ] [ vID ] [ E_Z ], g_vehicleData[ playerid ] [ vID ] [ E_ANGLE ], g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 0 ], g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 1 ], 999 );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] = iVehicle;
|
||||||
|
|
||||||
|
if ( iVehicle != INVALID_VEHICLE_ID ) {
|
||||||
|
if ( g_vehicleData[ playerid ] [ vID ] [ E_GARAGE ] != -1 ) {
|
||||||
|
LinkVehicleToInterior( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ], GetGarageInteriorID( g_vehicleData[ playerid ] [ vID ] [ E_GARAGE ] ) );
|
||||||
|
SetVehicleVirtualWorld( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ], GetGarageVirtualWorld( g_vehicleData[ playerid ] [ vID ] [ E_GARAGE ] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
SetVehicleNumberPlate( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ], g_vehicleData[ playerid ] [ vID ] [ E_PLATE ] );
|
||||||
|
ChangeVehiclePaintjob( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ], g_vehicleData[ playerid ] [ vID ] [ E_PAINTJOB ] );
|
||||||
|
for( new x = 0; x < MAX_CAR_MODS; x++ )
|
||||||
|
{
|
||||||
|
if ( g_vehicleModifications[ playerid ] [ vID ] [ x ] >= 1000 && g_vehicleModifications[ playerid ] [ vID ] [ x ] < 1193 )
|
||||||
|
{
|
||||||
|
if ( isLegalCarMod( GetVehicleModel( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] ), g_vehicleModifications[ playerid ] [ vID ] [ x ] ) )
|
||||||
|
AddVehicleComponent( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ], g_vehicleModifications[ playerid ] [ vID ] [ x ] );
|
||||||
|
else
|
||||||
|
g_vehicleModifications[ playerid ] [ vID ] [ x ] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_adminSpawnedCar{ g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] } = false;
|
||||||
|
g_buyableVehicle{ g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] = true;
|
||||||
|
|
||||||
|
// Load vehicle components
|
||||||
|
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `COMPONENTS` WHERE `VEHICLE_ID`=%d", g_vehicleData[ playerid ] [ vID ] [ E_SQL_ID ] );
|
||||||
|
mysql_function_query( dbHandle, szNormalString, true, "OnVehicleComponentsLoad", "dd", playerid, vID );
|
||||||
|
}
|
||||||
|
|
||||||
|
p_OwnedVehicles[ playerid ] = rows;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnPlayerCreateBuyableVehicle( playerid, slot )
|
||||||
|
{
|
||||||
|
g_vehicleData[ playerid ] [ slot ] [ E_SQL_ID ] = cache_insert_id( );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Functions ** */
|
||||||
|
stock CreateBuyableVehicle( playerid, Model, Color1, Color2, Float: X, Float: Y, Float: Z, Float: Angle, Cost )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
vID,
|
||||||
|
szString[ 300 ],
|
||||||
|
iCar = INVALID_VEHICLE_ID
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( playerid != INVALID_PLAYER_ID && !IsPlayerConnected( playerid ) )
|
||||||
|
return INVALID_PLAYER_ID;
|
||||||
|
|
||||||
|
for( vID = 0; vID < MAX_BUYABLE_VEHICLES; vID++ )
|
||||||
|
if ( !g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] ) break;
|
||||||
|
|
||||||
|
if ( vID >= MAX_BUYABLE_VEHICLES )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if ( g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if ( vID != -1 )
|
||||||
|
{
|
||||||
|
strcpy( g_vehicleData[ playerid ] [ vID ] [ E_PLATE ], "SF-CNR" );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_LOCKED ] = false;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_X ] = X;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_Y ] = Y;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_Z ] = Z;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_ANGLE ] = Angle;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_PRICE ] = Cost;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 0 ] = Color1;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 1 ] = Color2;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] = true;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_PRICE ] = Cost;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_MODEL ] = Model;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_PAINTJOB ] = 3;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_GARAGE ] = -1;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_OWNER_ID ] = p_AccountID[ playerid ];
|
||||||
|
ResetBuyableVehicleMods( playerid, vID );
|
||||||
|
iCar = CreateVehicle( Model, X, Y, Z, Angle, Color1, Color2, 999999999 );
|
||||||
|
g_adminSpawnedCar{ iCar } = false;
|
||||||
|
//GetVehicleParamsEx( iCar, engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
//SetVehicleParamsEx( iCar, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
SetVehicleNumberPlate( iCar, "SF-CNR" );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] = iCar;
|
||||||
|
g_buyableVehicle{ iCar } = true;
|
||||||
|
format( szString, sizeof( szString ), "INSERT INTO `VEHICLES` (`MODEL`,`LOCKED`,`X`,`Y`,`Z`,`ANGLE`,`COLOR1`,`COLOR2`,`PRICE`,`OWNER`,`PLATE`,`PAINTJOB`,`MODS`) VALUES (%d,0,%f,%f,%f,%f,%d,%d,%d,%d,'SF-CNR',3,'0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.')", Model, X, Y, Z, Angle, Color1, Color2, Cost, g_vehicleData[ playerid ] [ vID ] [ E_OWNER_ID ] );
|
||||||
|
mysql_function_query( dbHandle, szString, true, "OnPlayerCreateBuyableVehicle", "dd", playerid, vID );
|
||||||
|
|
||||||
|
p_OwnedVehicles[ playerid ] ++; // Append value
|
||||||
|
}
|
||||||
|
return vID;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ResetBuyableVehicleMods( playerid, id, fordestroy=1 )
|
||||||
|
{
|
||||||
|
if ( id < 0 || id > MAX_BUYABLE_VEHICLES )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( !g_vehicleData[ playerid ] [ id ] [ E_CREATED ] )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for( new i = 0; i < MAX_CAR_MODS; i++ )
|
||||||
|
{
|
||||||
|
if ( !fordestroy && IsValidVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) ) {
|
||||||
|
if ( isLegalCarMod( GetVehicleModel( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ), g_vehicleModifications[ playerid ] [ id ] [ i ] ) )
|
||||||
|
RemoveVehicleComponent( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], g_vehicleModifications[ playerid ] [ id ] [ i ] );
|
||||||
|
}
|
||||||
|
g_vehicleModifications[ playerid ] [ id ] [ i ] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
format( szNormalString, sizeof( szNormalString ), "UPDATE `VEHICLES` SET `MODS`='0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.' WHERE `ID`=%d", g_vehicleData[ playerid ] [ id ] [ E_SQL_ID ] );
|
||||||
|
mysql_single_query( szNormalString );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock DestroyBuyableVehicle( playerid, vID, bool: db_remove = true )
|
||||||
|
{
|
||||||
|
if ( vID < 0 || vID > MAX_BUYABLE_VEHICLES )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( playerid == INVALID_PLAYER_ID )
|
||||||
|
return INVALID_PLAYER_ID;
|
||||||
|
|
||||||
|
if ( !g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
new
|
||||||
|
query[ 40 ]
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( db_remove )
|
||||||
|
{
|
||||||
|
SendClientMessage( playerid, -1, ""COL_PINK"[VEHICLE]"COL_WHITE" One of your vehicles has been destroyed.");
|
||||||
|
p_OwnedVehicles[ playerid ] --;
|
||||||
|
|
||||||
|
format( query, sizeof( query ), "DELETE FROM `VEHICLES` WHERE `ID`=%d", g_vehicleData[ playerid ] [ vID ] [ E_SQL_ID ] );
|
||||||
|
mysql_single_query( query );
|
||||||
|
|
||||||
|
ResetBuyableVehicleMods( playerid, vID );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset vehicle component data (hook into module)
|
||||||
|
DestroyVehicleCustomComponents( playerid, vID, db_remove );
|
||||||
|
|
||||||
|
// Reset vehicle data
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_OWNER_ID ] = 0;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_LOCKED ] = false;
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_CREATED ] = false;
|
||||||
|
g_buyableVehicle{ g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] } = false;
|
||||||
|
DestroyVehicle( g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] );
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_VEHICLE_ID ] = INVALID_VEHICLE_ID;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock RespawnBuyableVehicle( samp_veh_id, occupantid = INVALID_PLAYER_ID )
|
||||||
|
{
|
||||||
|
new playerid, id;
|
||||||
|
new gravy = getVehicleSlotFromID( samp_veh_id, playerid, id );
|
||||||
|
|
||||||
|
if ( gravy == -1 )
|
||||||
|
return INVALID_VEHICLE_ID;
|
||||||
|
|
||||||
|
if ( id == -1 && !g_vehicleData[ playerid ] [ id ] [ E_CREATED ] )
|
||||||
|
return INVALID_VEHICLE_ID;
|
||||||
|
|
||||||
|
if ( !IsValidVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ) )
|
||||||
|
return INVALID_VEHICLE_ID; // If it aint working.
|
||||||
|
|
||||||
|
new
|
||||||
|
Float: beforeAngle,
|
||||||
|
Float: Health,
|
||||||
|
newVeh = INVALID_VEHICLE_ID
|
||||||
|
;
|
||||||
|
|
||||||
|
GetVehicleZAngle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], beforeAngle );
|
||||||
|
GetVehicleDamageStatus( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], panels, doors, lights, tires ); // Can't do this to restore health.
|
||||||
|
GetVehicleHealth( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], Health );
|
||||||
|
|
||||||
|
if ( ( newVeh = CreateVehicle( g_vehicleData[ playerid ] [ id ] [ E_MODEL ], g_vehicleData[ playerid ] [ id ] [ E_X ], g_vehicleData[ playerid ] [ id ] [ E_Y ], g_vehicleData[ playerid ] [ id ] [ E_Z ], g_vehicleData[ playerid ] [ id ] [ E_ANGLE ], g_vehicleData[ playerid ] [ id ] [ E_COLOR ] [ 0 ], g_vehicleData[ playerid ] [ id ] [ E_COLOR ] [ 1 ], 999999999 ) ) == INVALID_VEHICLE_ID ) {
|
||||||
|
printf( "[ERROR] CreateVehicle(%d, %f, %f, %f, %f, %d, %d, %d);", g_vehicleData[ playerid ] [ id ] [ E_MODEL ], g_vehicleData[ playerid ] [ id ] [ E_X ], g_vehicleData[ playerid ] [ id ] [ E_Y ], g_vehicleData[ playerid ] [ id ] [ E_Z ], g_vehicleData[ playerid ] [ id ] [ E_ANGLE ], g_vehicleData[ playerid ] [ id ] [ E_COLOR ] [ 0 ], g_vehicleData[ playerid ] [ id ] [ E_COLOR ] [ 1 ], 999999999 );
|
||||||
|
return SendError( playerid, "Couldn't update vehicle due to a unknown error." );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset special data
|
||||||
|
ResetVehicleMethlabData( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], true );
|
||||||
|
|
||||||
|
// Destroy vehicle
|
||||||
|
DestroyVehicle( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] );
|
||||||
|
g_buyableVehicle{ g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] } = false;
|
||||||
|
g_buyableVehicle{ newVeh } = true;
|
||||||
|
g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] = newVeh;
|
||||||
|
|
||||||
|
// Restore old data
|
||||||
|
SetVehicleNumberPlate( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], g_vehicleData[ playerid ] [ id ] [ E_PLATE ] );
|
||||||
|
ChangeVehiclePaintjob( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], g_vehicleData[ playerid ] [ id ] [ E_PAINTJOB ] );
|
||||||
|
for( new i = 0; i < MAX_CAR_MODS; i++ ) {
|
||||||
|
if ( g_vehicleModifications[ playerid ] [ id ] [ i ] >= 1000 && g_vehicleModifications[ playerid ] [ id ] [ i ] < 1193 )
|
||||||
|
{
|
||||||
|
if ( isLegalCarMod( GetVehicleModel( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ] ), g_vehicleModifications[ playerid ] [ id ] [ i ] ) )
|
||||||
|
AddVehicleComponent( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], g_vehicleModifications[ playerid ] [ id ] [ i ] );
|
||||||
|
else
|
||||||
|
g_vehicleModifications[ playerid ] [ id ] [ i ] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateVehicleDamageStatus( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], panels, doors, lights, tires );
|
||||||
|
SetVehicleHealth( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], Health );
|
||||||
|
|
||||||
|
if ( g_vehicleData[ playerid ] [ id ] [ E_GARAGE ] != -1 ) {
|
||||||
|
LinkVehicleToInterior( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], GetGarageInteriorID( g_vehicleData[ playerid ] [ id ] [ E_GARAGE ] ) );
|
||||||
|
SetVehicleVirtualWorld( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], GetGarageVirtualWorld( g_vehicleData[ playerid ] [ id ] [ E_GARAGE ] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( occupantid != INVALID_PLAYER_ID ) // So nothing bugs with /v color
|
||||||
|
{
|
||||||
|
new Float: X, Float: Y, Float: Z;
|
||||||
|
SyncSpectation( playerid ); // Bug?
|
||||||
|
GetPlayerPos( occupantid, X, Y, Z );
|
||||||
|
SetVehiclePos( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], X, Y, Z + 1 );
|
||||||
|
LinkVehicleToInterior( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], GetPlayerInterior( playerid ) );
|
||||||
|
SetVehicleVirtualWorld( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], GetPlayerVirtualWorld( playerid ) );
|
||||||
|
SetTimerEx( "timedUpdates_RBV", 50, false, "ddf", occupantid, g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], beforeAngle );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace components (hook into module)
|
||||||
|
ReplaceVehicleCustomComponents( playerid, id );
|
||||||
|
|
||||||
|
if ( !g_vehicleData[ playerid ] [ id ] [ E_OWNER_ID ] ) {
|
||||||
|
GetVehicleParamsEx( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], engine, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
SetVehicleParamsEx( g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ], VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective );
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_vehicleData[ playerid ] [ id ] [ E_VEHICLE_ID ];
|
||||||
|
}
|
||||||
|
|
||||||
|
stock SaveVehicleData( playerid, vID )
|
||||||
|
{
|
||||||
|
if ( vID == -1 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
new
|
||||||
|
szPlate[ 32 ];
|
||||||
|
|
||||||
|
// Plate System
|
||||||
|
if ( isnull( g_vehicleData[ playerid ] [ vID ] [ E_PLATE ] ) )
|
||||||
|
szPlate = "SF-CNR";
|
||||||
|
else
|
||||||
|
strcat( szPlate, g_vehicleData[ playerid ] [ vID ] [ E_PLATE ] );
|
||||||
|
|
||||||
|
// Begin Saving
|
||||||
|
format( szLargeString, sizeof( szLargeString ), "UPDATE `VEHICLES` SET `MODEL`=%d,`LOCKED`=%d,`X`=%f,`Y`=%f,`Z`=%f,`ANGLE`=%f,`COLOR1`=%d,`COLOR2`=%d,`PRICE`=%d,`PAINTJOB`=%d,`OWNER`=%d,`PLATE`='%s',`GARAGE`=%d WHERE `ID`=%d",
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_MODEL ], g_vehicleData[ playerid ] [ vID ] [ E_LOCKED ], g_vehicleData[ playerid ] [ vID ] [ E_X ], g_vehicleData[ playerid ] [ vID ] [ E_Y ], g_vehicleData[ playerid ] [ vID ] [ E_Z ],
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_ANGLE ], g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 0 ], g_vehicleData[ playerid ] [ vID ] [ E_COLOR ] [ 1 ], g_vehicleData[ playerid ] [ vID ] [ E_PRICE ], g_vehicleData[ playerid ] [ vID ] [ E_PAINTJOB ],
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_OWNER_ID ], mysql_escape( szPlate ), g_vehicleData[ playerid ] [ vID ] [ E_GARAGE ],
|
||||||
|
g_vehicleData[ playerid ] [ vID ] [ E_SQL_ID ] );
|
||||||
|
|
||||||
|
mysql_single_query( szLargeString );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock dischargeVehicles( playerid )
|
||||||
|
{
|
||||||
|
if ( p_OwnedVehicles[ playerid ] )
|
||||||
|
{
|
||||||
|
for( new v; v < MAX_BUYABLE_VEHICLES; v++ )
|
||||||
|
DestroyBuyableVehicle( playerid, v, .db_remove = false );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function timedUpdates_RBV( playerid, vehicleid, Float: angle ) {
|
||||||
|
if ( vehicleid != INVALID_VEHICLE_ID )
|
||||||
|
SetVehicleZAngle( vehicleid, angle );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock UpdateBuyableVehicleMods( playerid, v )
|
||||||
|
{
|
||||||
|
if ( v < 0 || v > MAX_BUYABLE_VEHICLES ) return 0;
|
||||||
|
if ( !g_vehicleData[ playerid ] [ v ] [ E_CREATED ] ) return 0;
|
||||||
|
new vehicleid = g_vehicleData[ playerid ] [ v ] [ E_VEHICLE_ID ];
|
||||||
|
if ( !IsValidVehicle( vehicleid ) ) return 0;
|
||||||
|
|
||||||
|
for( new i; i < MAX_CAR_MODS; i++ )
|
||||||
|
if ( ( g_vehicleModifications[ playerid ] [ v ] [ i ] = GetVehicleComponentInSlot( vehicleid, i ) ) < 1000 ) g_vehicleModifications[ playerid ] [ v ] [ i ] = 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock getVehicleSlotFromID( vID, &playerid=0, &slot=0 )
|
||||||
|
{
|
||||||
|
foreach(new i : Player)
|
||||||
|
{
|
||||||
|
for( new x; x < MAX_BUYABLE_VEHICLES; x++ ) if ( g_vehicleData[ i ] [ x ] [ E_CREATED ] )
|
||||||
|
{
|
||||||
|
if ( g_vehicleData[ i ] [ x ] [ E_VEHICLE_ID ] == vID )
|
||||||
|
{
|
||||||
|
playerid = i;
|
||||||
|
slot = x;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock SetPlayerVehicleInteriorData( iOwner, iSlot, iInterior, iWorld, Float: fX, Float: fY, Float: fZ, Float: fAngle, iGarage = -1 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iVehicle = g_vehicleData[ iOwner ] [ iSlot ] [ E_VEHICLE_ID ];
|
||||||
|
|
||||||
|
SetVehiclePos( iVehicle, fX, fY, fZ );
|
||||||
|
SetVehicleZAngle( iVehicle, fAngle );
|
||||||
|
|
||||||
|
LinkVehicleToInterior( iVehicle, iInterior );
|
||||||
|
SetVehicleVirtualWorld( iVehicle, iWorld );
|
||||||
|
|
||||||
|
ReplaceVehicleCustomComponents( iOwner, iSlot ); // Change virtual worlds
|
||||||
|
|
||||||
|
// Update for passengers etc
|
||||||
|
foreach ( new i : Player )
|
||||||
|
{
|
||||||
|
if ( GetPlayerVehicleID( i ) == iVehicle || GetPlayerSurfingVehicleID( i ) == iVehicle )
|
||||||
|
{
|
||||||
|
p_InGarage[ i ] = iGarage;
|
||||||
|
SetPlayerInterior( i, iInterior );
|
||||||
|
SetPlayerVirtualWorld( i, iWorld );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
692
gamemodes/irresistible/cnr/features/vehicles/vmodifications.pwn
Normal file
692
gamemodes/irresistible/cnr/features/vehicles/vmodifications.pwn
Normal file
@ -0,0 +1,692 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module: cnr\features\vehicles\vehicle_modifications.pwn
|
||||||
|
* Purpose: custom vehicle components (objects) for player vehicles
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Definitions ** */
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
#define MAX_PIMPS ( 10 )
|
||||||
|
#define MAX_COMPONENT_NAME ( 32 )
|
||||||
|
|
||||||
|
#define CATEGORY_SPOILERS ( 0 )
|
||||||
|
#define CATEGORY_HOOD ( 1 )
|
||||||
|
#define CATEGORY_BAGS ( 2 )
|
||||||
|
#define CATEGORY_LAMPS ( 3 )
|
||||||
|
#define CATEGORY_WHEELS ( 4 )
|
||||||
|
#define CATEGORY_BULLBAR ( 5 )
|
||||||
|
#define CATEGORY_FRONT_BUMPER ( 6 )
|
||||||
|
#define CATEGORY_REAR_BUMPER ( 7 )
|
||||||
|
#define CATEGORY_VENTS ( 8 )
|
||||||
|
#define CATEGORY_NEON ( 9 )
|
||||||
|
#define CATEGORY_MECHANIC_ITEMS ( 10 )
|
||||||
|
#define CATEGORY_MILITARY_ITEMS ( 11 )
|
||||||
|
#define CATEGORY_MISCELLANEOUS ( 12 )
|
||||||
|
|
||||||
|
enum E_CAR_MODS
|
||||||
|
{
|
||||||
|
E_CATEGORY, E_LIMIT, E_MODEL_ID,
|
||||||
|
E_NAME[ MAX_COMPONENT_NAME ], E_PRICE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum E_PIMP_DATA
|
||||||
|
{
|
||||||
|
bool: E_CREATED[ MAX_PIMPS ], E_OBJECT[ MAX_PIMPS ], E_MODEL[ MAX_PIMPS ],
|
||||||
|
Float: E_X[ MAX_PIMPS ], Float: E_Y[ MAX_PIMPS ], Float: E_Z[ MAX_PIMPS ],
|
||||||
|
Float: E_RX[ MAX_PIMPS ], Float: E_RY[ MAX_PIMPS ], Float: E_RZ[ MAX_PIMPS ],
|
||||||
|
E_SQL_ID[ MAX_PIMPS ], bool: E_DISABLED[ MAX_PIMPS ]
|
||||||
|
};
|
||||||
|
|
||||||
|
new
|
||||||
|
g_vehicleComponentsCategories[ ] [ MAX_COMPONENT_NAME ] = {
|
||||||
|
"Spoilers", "Hood", "Bags", "Lamps", "Wheels", "Bullbar", "Front Bumper", "Rear Bumper", "Vents", "Neon", "Mechanic Items", "Military Items", "Miscellaneous"
|
||||||
|
},
|
||||||
|
g_vehicleComponentsData[ ] [ E_CAR_MODS ] =
|
||||||
|
{
|
||||||
|
// Spoilers
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1023, "Fury", 8000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1001, "Win", 9000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1000, "Pro", 10000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1016, "Worx", 10000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1058, "Alien - Stratum", 10000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1014, "Champ", 11000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1003, "Alpha", 12000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1002, "Drag", 13000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1015, "Race", 14000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1060, "X-Flow - Stratum", 14000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1049, "Alien - Flash", 14000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1162, "Alien - Jester", 18000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1164, "Alien - Uranus", 19000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1147, "Alien - Elegy", 22000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1050, "X-Flow - Flash", 23000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1138, "Alien - Sultan", 25000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1158, "X-Flow - Jester", 27000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1163, "X-Flow - Uranus", 28000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1146, "X-Flow - Elegy", 30000 },
|
||||||
|
{ CATEGORY_SPOILERS, 0, 1139, "X-Flow - Sultan", 35000 },
|
||||||
|
|
||||||
|
// Hood
|
||||||
|
{ CATEGORY_HOOD, 0, 1011, "Race Scoop", 13000 },
|
||||||
|
{ CATEGORY_HOOD, 0, 1004, "Champ Scoop", 15000 },
|
||||||
|
{ CATEGORY_HOOD, 0, 1005, "Fury Scoop", 16000 },
|
||||||
|
{ CATEGORY_HOOD, 0, 1012, "Worx Scoop", 23000 },
|
||||||
|
|
||||||
|
// Bags
|
||||||
|
{ CATEGORY_BAGS, 0, 11745, "Bag", 15000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1279, "Tent Pack", 17000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1550, "Money Bag", 35000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1210, "Money Case", 25000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1575, "Grey Drug Bag", 15000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1576, "Orange Drug Bag", 15000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1577, "Yellow Drug Bag", 15000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1578, "Green Drug Bag", 15000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1579, "Blue Drug Bag", 15000 },
|
||||||
|
{ CATEGORY_BAGS, 0, 1580, "Red Drug Bag", 15000 },
|
||||||
|
|
||||||
|
// Lamps
|
||||||
|
{ CATEGORY_LAMPS, 0, 1013, "Round Fog", 15000 },
|
||||||
|
{ CATEGORY_LAMPS, 0, 1024, "Square Fog", 25000 },
|
||||||
|
|
||||||
|
// Wheels
|
||||||
|
{ CATEGORY_WHEELS, 0, 1025, "Offroad", 25000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1080, "Switch", 25000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1077, "Classic", 30000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1073, "Shadow", 35000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1079, "Cutter", 35000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1085, "Atomic", 35000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1096, "Ahab", 35000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1078, "Twist", 40000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1081, "Grove", 40000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1084, "Trance", 45000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1075, "Rimshine", 45000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1074, "Mega", 45000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1076, "Wires", 50000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1098, "Access", 55000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1097, "Virtual", 65000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1082, "Import", 75000},
|
||||||
|
{ CATEGORY_WHEELS, 0, 1327, "Large Wheel", 80000 },
|
||||||
|
{ CATEGORY_WHEELS, 0, 1083, "Dollar", 100000 },
|
||||||
|
|
||||||
|
// Bullbar
|
||||||
|
{ CATEGORY_BULLBAR, 0, 1123, "Bullbar Chrome Bars", 30000 },
|
||||||
|
{ CATEGORY_BULLBAR, 0, 1100, "Chrome Grill", 35000 },
|
||||||
|
{ CATEGORY_BULLBAR, 0, 1125, "Bullbar Chrome Lights", 37000 },
|
||||||
|
|
||||||
|
// Front Bumper
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1155, "Alien - Stratum", 15000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1160, "Alien - Jester", 20000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1166, "Alien - Uranus", 20000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1153, "Alien - Flash", 25000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1157, "X-Flow - Stratum", 25000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1171, "Alien - Elegy", 25000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1181, "Slamin - Blade", 25000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1185, "Slamin - Remington", 25000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1190, "Slamin - Tornado", 25000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1165, "X-Flow - Uranus", 30000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1169, "Alien - Sultan", 30000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1173, "X-Flow - Jester", 30000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1152, "X-Flow - Flash", 35000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1172, "X-Flow - Elegy", 35000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1170, "X-Flow - Sultan", 40000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1174, "Chrome - Broadway 1", 45000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1176, "Chrome - Broadway 2", 45000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1117, "Chrome - Slamvan", 50000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1182, "Chrome - Blade", 50000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1188, "Slamin - Savanna", 50000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1189, "Chrome - Savanna",50000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1191, "Chrome - Tornado", 50000 },
|
||||||
|
{ CATEGORY_FRONT_BUMPER, 0, 1179, "Chrome - Remington", 55000 },
|
||||||
|
|
||||||
|
// Rear Bumper
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1154, "Alien - Stratum", 15000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1159, "Alien - Jester", 15000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1168, "Alien - Uranus", 15000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1175, "Slamin - Broadway", 15000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1150, "Alien - Flash", 18000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1149, "Alien - Elegy", 19000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1140, "X-Flow - Sultan", 20000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1178, "Slamin - Remington", 23000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1156, "X-Flow Straum", 25000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1161, "X-Flow - Jester", 25000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1183, "Slamin - Blade", 25000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1186, "Slamin - Savanna", 25000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1167, "X-Flow - Uranus", 25000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1193, "Slamin - Tornado", 25000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1151, "X-Flow - Flash", 28000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1148, "X-Flow - Elegy", 29000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1141, "Alien - Sultan", 30000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1177, "Slamin - Broadway", 35000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1180, "Chrome - Remington", 50000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1184, "Chrome - Blade", 50000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1187, "Chrome - Savanna", 50000 },
|
||||||
|
{ CATEGORY_REAR_BUMPER, 0, 1192, "Chrome - Tornado", 50000 },
|
||||||
|
|
||||||
|
// Vents
|
||||||
|
{ CATEGORY_VENTS, 0, 1142, "Left Oval Vents", 4000 },
|
||||||
|
{ CATEGORY_VENTS, 0, 1143, "Right Oval Vents", 4000 },
|
||||||
|
{ CATEGORY_VENTS, 0, 1144, "Left Square Vents", 6000 },
|
||||||
|
{ CATEGORY_VENTS, 0, 1145, "Right Square Vents", 6000 },
|
||||||
|
{ CATEGORY_VENTS, 3, 914, "Large Air Vent", 250000 },
|
||||||
|
|
||||||
|
// Neon
|
||||||
|
{ CATEGORY_NEON, 0, 18647, "Red Neon", 200000 },
|
||||||
|
{ CATEGORY_NEON, 0, 18648, "Blue Neon", 200000 },
|
||||||
|
{ CATEGORY_NEON, 0, 18649, "Green Neon", 200000 },
|
||||||
|
{ CATEGORY_NEON, 0, 18650, "Yellow Neon", 200000 },
|
||||||
|
{ CATEGORY_NEON, 0, 18651, "Pink Neon", 200000 },
|
||||||
|
{ CATEGORY_NEON, 0, 18652, "White Neon", 200000 },
|
||||||
|
|
||||||
|
// Military Items
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 0, 1654, "Dynamite", 8000 },
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 0, 19590, "Sword", 14000 },
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 0, 19832, "Ammo Box", 20000 },
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 0, 2040, "Ammo box closed", 20000 },
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 0, 2041, "Ammo box open", 20000 },
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 1, 964, "Army crate", 40000 },
|
||||||
|
{ CATEGORY_MILITARY_ITEMS, 0, 11738, "Medikit", 135000 },
|
||||||
|
|
||||||
|
// Mechanic Items
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 18644, "Screwdriver", 1500 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 18633, "Wrench", 2500 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 18635, "Hammer", 2500 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 1650, "Gas Can", 5000 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 19621, "Oil Can", 7500 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 19816, "Oxygen Tank", 20000 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 19921, "Toolbox", 23000 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 1, 19917, "Engine", 65000 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 1, 920, "Generator", 80000 },
|
||||||
|
{ CATEGORY_MECHANIC_ITEMS, 0, 19631, "Sledge Hammer", 90000 },
|
||||||
|
|
||||||
|
// Miscellaneous
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19309, "Taxi White", 2000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19310, "Taxi Black", 4000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 18632, "Fishing Rod", 8000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19624, "Suitcase", 15000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19314, "Bullhorn", 15000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 18646, "Police Light", 25000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19280, "Floodlight", 30000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19419, "Police Light Strip", 45000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19320, "Pumpkin", 45000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19306, "Red Flag", 50000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19307, "Blue Flag", 50000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19086, "Chainsaw Dildo", 69696},
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 11704, "Devil Mask", 75000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 2, 2985, "Mounted Minigun", 80000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 19315, "Deer", 133769 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 0, 1609, "Turtle", 250000 },
|
||||||
|
{ CATEGORY_MISCELLANEOUS, 1, 19601, "Snow Plough", 1500000 }
|
||||||
|
},
|
||||||
|
|
||||||
|
g_vehiclePimpData[ MAX_PLAYERS ] [ MAX_BUYABLE_VEHICLES ] [ E_PIMP_DATA ]
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnPlayerEditDynObject( playerid, objectid, response, Float: x, Float: y, Float: z, Float: rx, Float: ry, Float: rz )
|
||||||
|
{
|
||||||
|
if ( GetPVarType( playerid, "components_editing" ) != 0 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
vehicleid = GetPlayerVehicleID( playerid ),
|
||||||
|
slotid = GetPVarInt( playerid, "components_editing" ),
|
||||||
|
v = getVehicleSlotFromID( vehicleid, ownerid )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( v == -1 )
|
||||||
|
return CancelEdit( playerid ), SendError( playerid, "You need to be in a buyable vehicle." );
|
||||||
|
|
||||||
|
if ( playerid != ownerid )
|
||||||
|
return CancelEdit( playerid ), SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
|
||||||
|
if ( !g_vehiclePimpData[ ownerid ] [ v ] [ E_CREATED ] [ slotid ] )
|
||||||
|
return CancelEdit( playerid ), SendError( playerid, "Internal Server Error (0x1C)." );
|
||||||
|
|
||||||
|
if ( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] != objectid )
|
||||||
|
return CancelEdit( playerid ), SendError( playerid, "Internal Server Error (0x2D)." );
|
||||||
|
|
||||||
|
static
|
||||||
|
Float: X, Float: Y, Float:Z, Float: Angle;
|
||||||
|
|
||||||
|
if ( response == EDIT_RESPONSE_FINAL )
|
||||||
|
{
|
||||||
|
// Grab positions prior
|
||||||
|
GetVehicleZAngle( vehicleid, Angle );
|
||||||
|
GetVehiclePos( vehicleid, X, Y, Z );
|
||||||
|
|
||||||
|
// Calculate offsets
|
||||||
|
new
|
||||||
|
Float: fDistance = VectorSize( x - X, y - Y, 0.0 ),
|
||||||
|
Float: fAngle = Angle - atan2( y - Y, x - X ),
|
||||||
|
Float: finalX = fDistance * floatcos( fAngle, degrees ),
|
||||||
|
Float: finalY = fDistance * floatsin( -fAngle, degrees ),
|
||||||
|
Float: finalZ = z - Z
|
||||||
|
;
|
||||||
|
|
||||||
|
// Get model size
|
||||||
|
GetVehicleModelInfo( GetVehicleModel( vehicleid ), VEHICLE_MODEL_INFO_SIZE, X, Y, Z );
|
||||||
|
|
||||||
|
// Half because we're using pretty much the radius, not circumference (way to look at it)
|
||||||
|
X /= 2.0, Y /= 2.0;
|
||||||
|
|
||||||
|
if ( floatabs( finalX ) > X + 0.35 ) {
|
||||||
|
SendServerMessage( playerid, "The object breaches the X axis limit for this vehicle (%0.1f). It has been moved.", ( finalX = X + 0.35 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( floatabs( finalY ) > Y + 0.35 ) {
|
||||||
|
SendServerMessage( playerid, "The object breaches the Y axis limit for this vehicle (%0.1f). It has been moved.", ( finalY = Y + 0.35 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( floatabs( finalZ ) > Z + 0.35 ) {
|
||||||
|
SendServerMessage( playerid, "The object breaches the Z axis limit for this vehicle (%0.1f). It has been moved.", ( finalZ = Z + 0.35 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Readjust variables
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_X ] [ slotid ] = finalX;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_Y ] [ slotid ] = finalY;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_Z ] [ slotid ] = finalZ;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_RX ] [ slotid ] = rx;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_RY ] [ slotid ] = ry;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_RZ ] [ slotid ] = rz - Angle;
|
||||||
|
|
||||||
|
format( szNormalString, sizeof( szNormalString ), "UPDATE `COMPONENTS` SET `X`=%f,`Y`=%f,`Z`=%f,`RX`=%f,`RY`=%f,`RZ`=%f WHERE `ID`=%d", finalX, finalY, finalZ, rx, ry, rz - Angle, g_vehiclePimpData[ ownerid ] [ v ] [ E_SQL_ID ] [ slotid ] );
|
||||||
|
mysql_single_query( szNormalString );
|
||||||
|
|
||||||
|
//DestroyDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] );
|
||||||
|
//g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] = CreateDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_MODEL ] [ slotid ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );
|
||||||
|
AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], vehicleid, finalX, finalY, finalZ, rx, ry, rz - Angle );
|
||||||
|
|
||||||
|
GetVehiclePos( vehicleid, X, Y, Z );
|
||||||
|
return SetVehiclePos( vehicleid, X, Y, Z + 0.05 );
|
||||||
|
}
|
||||||
|
else if ( response == EDIT_RESPONSE_CANCEL )
|
||||||
|
{
|
||||||
|
//DestroyDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] );
|
||||||
|
//g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] = CreateDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_MODEL ] [ slotid ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );
|
||||||
|
AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], vehicleid,
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_X ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_Y ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_Z ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_RX ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_RY ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_RZ ] [ slotid ] );
|
||||||
|
|
||||||
|
// Sync new position
|
||||||
|
if ( GetVehiclePos( vehicleid, X, Y, Z ) ) {
|
||||||
|
SetVehiclePos( vehicleid, X, Y, Z + 0.05 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
|
{
|
||||||
|
if ( ( dialogid == DIALOG_COMPONENTS_CATEGORY ) && response ) {
|
||||||
|
SetPVarInt( playerid, "components_category", listitem );
|
||||||
|
return ShowPlayerVehicleComponents( playerid, listitem );
|
||||||
|
}
|
||||||
|
else if ( dialogid == DIALOG_COMPONENTS )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
iComponent = GetPVarInt( playerid, "components_category" );
|
||||||
|
|
||||||
|
if ( response )
|
||||||
|
{
|
||||||
|
for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent )
|
||||||
|
{
|
||||||
|
if ( listitem == x++ )
|
||||||
|
{
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) )
|
||||||
|
return SendError( playerid, "You need to be in a vehicle to use this command." );
|
||||||
|
|
||||||
|
if ( GetPlayerCash( playerid ) < g_vehicleComponentsData[ i ] [ E_PRICE ] )
|
||||||
|
return SendError( playerid, "You need %s to purchase this vehicle component.", cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) );
|
||||||
|
|
||||||
|
if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER )
|
||||||
|
return SendError( playerid, "You need to be a driver to use this command." );
|
||||||
|
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
vehicleid = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( vehicleid == -1 )
|
||||||
|
return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
|
||||||
|
if ( playerid != ownerid )
|
||||||
|
return SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
|
||||||
|
if ( GetVehicleCustomComponents( ownerid, vehicleid ) >= GetPlayerPimpVehicleSlots( ownerid ) )
|
||||||
|
return SendError( playerid, "You cannot purchase more than %d vehicle components.", GetPlayerPimpVehicleSlots( ownerid ) );
|
||||||
|
|
||||||
|
new
|
||||||
|
slotid = GetVehicleComponentSlot( ownerid, vehicleid );
|
||||||
|
|
||||||
|
if ( slotid == -1 )
|
||||||
|
return SendError( playerid, "You cannot add more than %d components to your vehicle.", MAX_PIMPS );
|
||||||
|
|
||||||
|
// make sure the person is above the limit
|
||||||
|
if ( g_vehicleComponentsData[ i ] [ E_LIMIT ] != 0 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
instances = 0;
|
||||||
|
|
||||||
|
for( new p = 0; p < MAX_PIMPS; p++ )
|
||||||
|
if ( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ p ] && g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_MODEL ] [ p ] == g_vehicleComponentsData[ i ] [ E_MODEL_ID ] )
|
||||||
|
instances ++;
|
||||||
|
|
||||||
|
if ( instances >= g_vehicleComponentsData[ i ] [ E_LIMIT ] )
|
||||||
|
return SendError( playerid, "You can place a %s a maximum of %d time(s).", g_vehicleComponentsData[ i ] [ E_NAME ], g_vehicleComponentsData[ i ] [ E_LIMIT ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
Float: X, Float: Y, Float: Z;
|
||||||
|
|
||||||
|
GivePlayerCash( playerid, -g_vehicleComponentsData[ i ] [ E_PRICE ] );
|
||||||
|
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ slotid ] = true;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ slotid ] = false;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ slotid ] = g_vehicleComponentsData[ i ] [ E_MODEL_ID ];
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ slotid ] = 0.0;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ slotid ] = 0.0;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ slotid ] = 1.0;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ slotid ] = 0.0;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ slotid ] = 0.0;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ slotid ] = 0.0;
|
||||||
|
|
||||||
|
format( szNormalString, sizeof( szNormalString ), "INSERT INTO `COMPONENTS` (`VEHICLE_ID`,`MODEL`,`X`,`Y`,`Z`,`RX`,`RY`,`RZ`) VALUES (%d,%d,0.0,0.0,1.0,0.0,0.0,0.0)", g_vehicleData[ ownerid ] [ vehicleid ] [ E_SQL_ID ], g_vehicleComponentsData[ i ] [ E_MODEL_ID ] );
|
||||||
|
mysql_function_query( dbHandle, szNormalString, true, "OnPlayerCreateVehicleComponent", "ddd", playerid, vehicleid, slotid );
|
||||||
|
|
||||||
|
GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z );
|
||||||
|
SetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z + 0.05 );
|
||||||
|
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ] = CreateDynamicObject( g_vehicleComponentsData[ i ] [ E_MODEL_ID ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .worldid = GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ]) );
|
||||||
|
AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ], g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 );
|
||||||
|
return SendServerMessage( playerid, "You have bought a "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_vehicleComponentsData[ i ] [ E_NAME ], cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return cmd_garage( playerid, "vehicle pimp" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ( dialogid == DIALOG_COMPONENT_MENU ) && response )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
vehicleid = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( vehicleid == -1 )
|
||||||
|
return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
|
||||||
|
if ( playerid != ownerid )
|
||||||
|
return SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
|
||||||
|
for( new i = 0, x = 0; i < MAX_PIMPS; i++ ) if ( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ i ] ) {
|
||||||
|
if ( listitem == x++ ) {
|
||||||
|
return ShowPlayerVehicleComponentMenu( playerid, ownerid, vehicleid, i );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ( dialogid == DIALOG_COMPONENT_EDIT ) && response )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
i = GetPVarInt( playerid, "components_editing" ),
|
||||||
|
vehicleid = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid )
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( vehicleid == -1 )
|
||||||
|
return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
|
||||||
|
if ( playerid != ownerid )
|
||||||
|
return SendError( playerid, "This vehicle does not belong to you." );
|
||||||
|
|
||||||
|
switch( listitem )
|
||||||
|
{
|
||||||
|
case 0: // Disable
|
||||||
|
{
|
||||||
|
if ( ( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ i ] = !g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ i ] ) == false )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
Float: X, Float: Y, Float: Z;
|
||||||
|
|
||||||
|
// Recreate object
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] = CreateDynamicObject( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .worldid = GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ] ) );
|
||||||
|
|
||||||
|
// Attach object to vehicle
|
||||||
|
AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ], g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ],
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ i ],
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ i ] );
|
||||||
|
|
||||||
|
// Reposition vehicle
|
||||||
|
GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z );
|
||||||
|
SetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z + 0.05 );
|
||||||
|
|
||||||
|
SendServerMessage( playerid, "You have successfully enabled your vehicle component" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DestroyDynamicObject( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] );
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] = -1;
|
||||||
|
SendServerMessage( playerid, "You have successfully disabled your vehicle component" );
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_single_query( sprintf( "UPDATE `COMPONENTS` SET `DISABLED`=%d WHERE `ID`=%d", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_SQL_ID ] [ i ] ) );
|
||||||
|
return ShowPlayerVehicleComponentMenu( playerid, ownerid, vehicleid, i );
|
||||||
|
}
|
||||||
|
case 1: // Edit
|
||||||
|
{
|
||||||
|
new
|
||||||
|
Float: X, Float: Y, Float: Z, Float: Angle;
|
||||||
|
|
||||||
|
GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z );
|
||||||
|
GetVehicleZAngle( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], Angle );
|
||||||
|
DestroyDynamicObject( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] );
|
||||||
|
|
||||||
|
// printf("Destroyed %d", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] );
|
||||||
|
|
||||||
|
X += g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ i ];
|
||||||
|
Y += g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ i ];
|
||||||
|
Z += g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ i ];
|
||||||
|
|
||||||
|
new
|
||||||
|
iObject = CreateDynamicObject( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ], X, Y, Z, g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ i ] - Angle, .worldid = GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ] ) );
|
||||||
|
|
||||||
|
// printf("%d = CreateDynamicObject( %d, %f, %f, %f, %f, %f, %f )", iObject, g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ], X, Y, Z, g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ i ], g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ i ] - Angle );
|
||||||
|
|
||||||
|
if ( ( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] = iObject ) ) {
|
||||||
|
GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z );
|
||||||
|
SetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z + 0.05 );
|
||||||
|
|
||||||
|
EditDynamicObject( playerid, iObject );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 2: // Pimp
|
||||||
|
{
|
||||||
|
new
|
||||||
|
pimpid;
|
||||||
|
|
||||||
|
for( ; pimpid < sizeof( g_vehicleComponentsData ); pimpid++ )
|
||||||
|
if ( g_vehicleComponentsData[ pimpid ] [ E_MODEL_ID ] == g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( g_vehicleComponentsData[ pimpid ] [ E_MODEL_ID ] != g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ] )
|
||||||
|
return SendError( playerid, "You cannot sell this component as it no longer exists." );
|
||||||
|
|
||||||
|
new
|
||||||
|
sellPrice = floatround( g_vehicleComponentsData[ pimpid ] [ E_PRICE ] * 0.5 );
|
||||||
|
|
||||||
|
GivePlayerCash( playerid, sellPrice );
|
||||||
|
DestroyDynamicObject( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] );
|
||||||
|
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ i ] = -1;
|
||||||
|
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ i ] = false;
|
||||||
|
|
||||||
|
mysql_single_query( sprintf( "DELETE FROM `COMPONENTS` WHERE `ID`=%d", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_SQL_ID ] [ i ] ) );
|
||||||
|
SendServerMessage( playerid, "You have sold your "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_vehicleComponentsData[ pimpid ] [ E_NAME ], cash_format( sellPrice ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** SQL Threads ** */
|
||||||
|
hook OnVehicleComponentsLoad( playerid, vid )
|
||||||
|
{
|
||||||
|
if ( !IsPlayerConnected( playerid ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !g_vehicleData[ playerid ] [ vid ] [ E_CREATED ] )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
new
|
||||||
|
rows, fields, i = -1, cid
|
||||||
|
;
|
||||||
|
|
||||||
|
cache_get_data( rows, fields );
|
||||||
|
|
||||||
|
if ( rows )
|
||||||
|
{
|
||||||
|
while( ++i < rows )
|
||||||
|
{
|
||||||
|
for( cid = 0; cid < MAX_PIMPS; cid++ )
|
||||||
|
if ( !g_vehiclePimpData[ playerid ] [ vid ] [ E_CREATED ] [ cid ] ) break;
|
||||||
|
|
||||||
|
if ( cid >= MAX_PIMPS )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( g_vehiclePimpData[ playerid ] [ vid ] [ E_CREATED ] [ cid ] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_CREATED ] [ cid ] = true;
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_SQL_ID ] [ cid ] = cache_get_field_content_int( i, "ID", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_MODEL ] [ cid ] = cache_get_field_content_int( i, "MODEL", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_X ] [ cid ] = cache_get_field_content_float( i, "X", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_Y ] [ cid ] = cache_get_field_content_float( i, "Y", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_Z ] [ cid ] = cache_get_field_content_float( i, "Z", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_RX ] [ cid ] = cache_get_field_content_float( i, "RX", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_RY ] [ cid ] = cache_get_field_content_float( i, "RY", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_RZ ] [ cid ] = cache_get_field_content_float( i, "RZ", dbHandle );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_DISABLED ] [ cid ] = !!cache_get_field_content_int( i, "DISABLED", dbHandle );
|
||||||
|
|
||||||
|
DestroyDynamicObject( g_vehiclePimpData[ playerid ] [ vid ] [ E_OBJECT ] [ cid ] );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_OBJECT ] [ cid ] = -1;
|
||||||
|
|
||||||
|
if ( g_vehiclePimpData[ playerid ] [ vid ] [ E_DISABLED ] [ cid ] == false )
|
||||||
|
{
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_OBJECT ] [ cid ] = CreateDynamicObject( g_vehiclePimpData[ playerid ] [ vid ] [ E_MODEL ] [ cid ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .worldid = GetVehicleVirtualWorld( g_vehicleData[ playerid ] [ vid ] [ E_VEHICLE_ID ] ) );
|
||||||
|
AttachDynamicObjectToVehicle( g_vehiclePimpData[ playerid ] [ vid ] [ E_OBJECT ] [ cid ], g_vehicleData[ playerid ] [ vid ] [ E_VEHICLE_ID ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_X ] [ cid ], g_vehiclePimpData[ playerid ] [ vid ] [ E_Y ] [ cid ], g_vehiclePimpData[ playerid ] [ vid ] [ E_Z ] [ cid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vid ] [ E_RX ] [ cid ], g_vehiclePimpData[ playerid ] [ vid ] [ E_RY ] [ cid ], g_vehiclePimpData[ playerid ] [ vid ] [ E_RZ ] [ cid ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnPlayerCreateVehicleComponent( playerid, vehicleid, slotid )
|
||||||
|
{
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_SQL_ID ] [ slotid ] = cache_insert_id( );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Functions ** */
|
||||||
|
stock GetVehicleComponentSlot( playerid, vehicleid ) {
|
||||||
|
|
||||||
|
for( new id = 0; id < MAX_PIMPS; id++ ) {
|
||||||
|
if ( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ id ] == false ) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ShowPlayerVehicleComponents( playerid, categoryid ) {
|
||||||
|
|
||||||
|
erase( szLargeString );
|
||||||
|
|
||||||
|
for( new i = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == categoryid ) {
|
||||||
|
format( szLargeString, sizeof( szLargeString ), "%s%s\t"COL_GOLD"%s\n", szLargeString, g_vehicleComponentsData[ i ] [ E_NAME ], cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) );
|
||||||
|
}
|
||||||
|
return ShowPlayerDialog( playerid, DIALOG_COMPONENTS, DIALOG_STYLE_TABLIST, sprintf( "Pimp My Ride - %s", g_vehicleComponentsCategories[ categoryid ] ), szLargeString, "Purchase", "Back" );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock DestroyVehicleCustomComponents( playerid, vehicleid, bool: destroy_db = false )
|
||||||
|
{
|
||||||
|
for( new slotid = 0; slotid < MAX_PIMPS; slotid++ ) {
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ slotid ] = false;
|
||||||
|
DestroyDynamicObject( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ] );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( destroy_db ) {
|
||||||
|
mysql_single_query( sprintf( "DELETE FROM `COMPONENTS` WHERE `VEHICLE_ID`=%d", g_vehicleData[ playerid ] [ vehicleid ] [ E_SQL_ID ] ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ReplaceVehicleCustomComponents( ownerid, v, bool: recreate_obj = false ) {
|
||||||
|
|
||||||
|
for( new slotid; slotid < MAX_PIMPS; slotid++ ) if ( g_vehiclePimpData[ ownerid ] [ v ] [ E_CREATED ] [ slotid ] && !g_vehiclePimpData[ ownerid ] [ v ] [ E_DISABLED ] ) {
|
||||||
|
// Recreate object
|
||||||
|
if ( recreate_obj ) {
|
||||||
|
DestroyDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] );
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] = CreateDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_MODEL ] [ slotid ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach object to vehicle
|
||||||
|
AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], g_vehicleData[ ownerid ] [ v ] [ E_VEHICLE_ID ],
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_X ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_Y ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_Z ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_RX ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_RY ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_RZ ] [ slotid ] );
|
||||||
|
|
||||||
|
// Update virtual world
|
||||||
|
Streamer_SetIntData( STREAMER_TYPE_OBJECT, g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], E_STREAMER_WORLD_ID, GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ v ] [ E_VEHICLE_ID ] ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stock GetVehicleCustomComponents( playerid, vehicleid ) {
|
||||||
|
new
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
for( new i = 0; i < MAX_PIMPS; i++ )
|
||||||
|
if ( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ i ] )
|
||||||
|
count ++;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ShowPlayerVehicleComponentMenu( playerid, ownerid, vehicleid, i )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
pimpid;
|
||||||
|
|
||||||
|
for( ; pimpid < sizeof( g_vehicleComponentsData ); pimpid++ )
|
||||||
|
if ( g_vehicleComponentsData[ pimpid ] [ E_MODEL_ID ] == g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( !( 0 <= pimpid < sizeof( g_vehicleComponentsData ) ) || g_vehicleComponentsData[ pimpid ] [ E_MODEL_ID ] != g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ i ] )
|
||||||
|
return SendError( playerid, "You cannot sell this component as it no longer exists." );
|
||||||
|
|
||||||
|
new
|
||||||
|
sellPrice = floatround( g_vehicleComponentsData[ pimpid ] [ E_PRICE ] * 0.5 );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "components_editing", i );
|
||||||
|
return ShowPlayerDialog( playerid, DIALOG_COMPONENT_EDIT, DIALOG_STYLE_TABLIST, "Vehicle Components", sprintf( "%s Component\t\nEdit Component\t\nSell Component\t"COL_GOLD"%s", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ i ] ? ( "Enable" ) : ( "Disable" ), cash_format( sellPrice ) ), "Select", "Cancel" );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock ShowVehicleComponentCategories( playerid )
|
||||||
|
{
|
||||||
|
static
|
||||||
|
szCategory[ sizeof( g_vehicleComponentsCategories ) * 12 ];
|
||||||
|
|
||||||
|
if ( szCategory[ 0 ] == '\0') {
|
||||||
|
for( new i = 0; i < sizeof( g_vehicleComponentsCategories ); i++ ) {
|
||||||
|
format( szCategory, sizeof( szCategory ), "%s%s\n", szCategory, g_vehicleComponentsCategories[ i ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ShowPlayerDialog( playerid, DIALOG_COMPONENTS_CATEGORY, DIALOG_STYLE_LIST, "Pimp My Ride - Categories", szCategory, "Select", "Cancel" );
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
(p_IrresistibleCoins[%0] += %1)
|
(p_IrresistibleCoins[%0] += %1)
|
||||||
|
|
||||||
/* ** Definitions ** */
|
/* ** Definitions ** */
|
||||||
#define MAX_EXTRA_SLOTS 5
|
#define VIP_MAX_EXTRA_SLOTS 5
|
||||||
|
|
||||||
#define ICM_PAGE_DEFAULT ( 0 )
|
#define ICM_PAGE_DEFAULT ( 0 )
|
||||||
#define ICM_PAGE_CASHCARD ( 1 )
|
#define ICM_PAGE_CASHCARD ( 1 )
|
||||||
@ -276,8 +276,8 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
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" );
|
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 ) {
|
else if ( selectedItemID == ICM_VEH_SLOT ) {
|
||||||
if ( p_ExtraAssetSlots{ playerid } >= MAX_EXTRA_SLOTS ) {
|
if ( p_ExtraAssetSlots{ playerid } >= VIP_MAX_EXTRA_SLOTS ) {
|
||||||
SendError( playerid, "You have reached the limit of additional slots (limit " #MAX_EXTRA_SLOTS ")." );
|
SendError( playerid, "You have reached the limit of additional slots (limit " #VIP_MAX_EXTRA_SLOTS ")." );
|
||||||
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
|
return ShowPlayerCoinMarketDialog( playerid, ICM_PAGE_ASSETS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,19 @@
|
|||||||
* Purpose: all player related variables (cnr)
|
* Purpose: all player related variables (cnr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* ** Macros ** */
|
||||||
|
#define IsPlayerTied(%1) (p_Tied{%1})
|
||||||
|
#define IsPlayerTazed(%1) (p_Tazed{%1})
|
||||||
|
#define IsPlayerCuffed(%1) (p_Cuffed{%1})
|
||||||
|
#define IsPlayerKidnapped(%1) (p_Kidnapped{%1})
|
||||||
|
#define IsPlayerBlowingCock(%0) (p_GivingBlowjob{%0})
|
||||||
|
#define IsPlayerGettingBlowed(%0) (p_GettingBlowjob{%0})
|
||||||
|
#define IsPlayerMining(%0) (p_isMining{%0})
|
||||||
|
#define IsPlayerLoadingObjects(%0) (p_pausedToLoad{%0})
|
||||||
|
#define IsPlayerAdminJailed(%0) (p_AdminJailed{%0} && p_JailTime[%0])
|
||||||
|
#define GetPlayerXP(%1) (p_XP[%1])
|
||||||
|
#define IsPlayerLorenc(%0) (p_AccountID[%0] == 1)
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
new
|
new
|
||||||
bool: p_Spawned [ MAX_PLAYERS char ],
|
bool: p_Spawned [ MAX_PLAYERS char ],
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
/* ** Includes ** */
|
/* ** Includes ** */
|
||||||
#include "irresistible\gta\map.pwn"
|
#include "irresistible\gta\map.pwn"
|
||||||
#include "irresistible\gta\vehicles.pwn"
|
#include "irresistible\gta\vehicle_data.pwn"
|
||||||
#include "irresistible\gta\weapon_data.pwn"
|
#include "irresistible\gta\weapon_data.pwn"
|
||||||
#include "irresistible\gta\car_mod_data.pwn"
|
#include "irresistible\gta\car_mod_data.pwn"
|
||||||
|
2782
gamemodes/sf-cnr.pwn
2782
gamemodes/sf-cnr.pwn
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user