adds a option to preview a garage component before buying

This commit is contained in:
Steven Howard 2018-10-08 22:41:29 +01:00
parent 41b8c22061
commit e33c2c3efb
2 changed files with 276 additions and 108 deletions

View File

@ -126,55 +126,56 @@
#define DIALOG_COMPONENT_EDIT 1115 #define DIALOG_COMPONENT_EDIT 1115
#define DIALOG_COMPONENT_EDIT_MENU 1116 #define DIALOG_COMPONENT_EDIT_MENU 1116
#define DIALOG_COMPONENT_MENU 1117 #define DIALOG_COMPONENT_MENU 1117
#define DIALOG_DONATED_DIAGOLD 1118 #define DIALOG_COMPONENTS_RESPONSE 1118
#define DIALOG_LATEST_DONOR 1119 #define DIALOG_DONATED_DIAGOLD 1119
#define DIALOG_FINISHED_DONATING 1120 #define DIALOG_LATEST_DONOR 1120
#define DIALOG_MODIFY_HITSOUND 1121 #define DIALOG_FINISHED_DONATING 1121
#define DIALOG_VIP_NOTE 1122 #define DIALOG_MODIFY_HITSOUND 1123
#define DIALOG_REGISTER_QUIT 1123 #define DIALOG_VIP_NOTE 1124
#define DIALOG_LOGIN_QUIT 1124 #define DIALOG_REGISTER_QUIT 1125
#define DIALOG_WEAPON_LOCKER 1125 #define DIALOG_LOGIN_QUIT 1126
#define DIALOG_WEAPON_LOCKER_BUY 1126 #define DIALOG_WEAPON_LOCKER 1127
#define DIALOG_FEEDBACK 1127 #define DIALOG_WEAPON_LOCKER_BUY 1128
#define DIALOG_IC_MARKET_2 1128 #define DIALOG_FEEDBACK 1129
#define DIALOG_BUSINESS_CAR 1129 #define DIALOG_IC_MARKET_2 1130
#define DIALOG_BUSINESS_HELI 1130 #define DIALOG_BUSINESS_CAR 1131
#define DIALOG_ACC_GUARD 1131 #define DIALOG_BUSINESS_HELI 1132
#define DIALOG_ACC_GUARD_EMAIL 1132 #define DIALOG_ACC_GUARD 1133
#define DIALOG_ACC_GUARD_MODE 1133 #define DIALOG_ACC_GUARD_EMAIL 1134
#define DIALOG_ACC_GUARD_CONFIRM 1134 #define DIALOG_ACC_GUARD_MODE 1135
#define DIALOG_ACC_GUARD_DEL_CANCEL 1135 #define DIALOG_ACC_GUARD_CONFIRM 1136
#define DIALOG_RACE 1136 #define DIALOG_ACC_GUARD_DEL_CANCEL 1137
#define DIALOG_RACE_MODE 1137 #define DIALOG_RACE 1138
#define DIALOG_RACE_FEE 1138 #define DIALOG_RACE_MODE 1139
#define DIALOG_RACE_POS 1139 #define DIALOG_RACE_FEE 1140
#define DIALOG_RACE_DISTANCE 1140 #define DIALOG_RACE_POS 1141
#define DIALOG_RACE_KICK 1141 #define DIALOG_RACE_DISTANCE 1142
#define DIALOG_RACE_DEST 1142 #define DIALOG_RACE_KICK 1143
#define DIALOG_RACE_PRESELECT 1143 #define DIALOG_RACE_DEST 1144
#define DIALOG_RACE_CUSTOM_DEST 1144 #define DIALOG_RACE_PRESELECT 1145
#define DIALOG_BUSINESS_SELL 1145 #define DIALOG_RACE_CUSTOM_DEST 1146
#define DIALOG_BUSINESS_NAME 1146 #define DIALOG_BUSINESS_SELL 1147
#define DIALOG_BUSINESS_ADD_MEMBER 1147 #define DIALOG_BUSINESS_NAME 1148
#define DIALOG_BUSINESS_MEMBERS 1148 #define DIALOG_BUSINESS_ADD_MEMBER 1149
#define DIALOG_BUSINESS_WITHDRAW 1149 #define DIALOG_BUSINESS_MEMBERS 1150
#define DIALOG_BUSINESS_UPGRADES 1150 #define DIALOG_BUSINESS_WITHDRAW 1151
#define DIALOG_BUSINESSES 1151 #define DIALOG_BUSINESS_UPGRADES 1152
#define DIALOG_CASINO_REWARDS 1152 #define DIALOG_BUSINESSES 1153
#define DIALOG_AIRPORT 1153 #define DIALOG_CASINO_REWARDS 1154
#define DIALOG_CASINO_BAR 1154 #define DIALOG_AIRPORT 1155
#define DIALOG_ACC_EMAIL 1155 #define DIALOG_CASINO_BAR 1156
#define DIALOG_BUSINESS_SECURITY 1156 #define DIALOG_ACC_EMAIL 1157
#define DIALOG_FACILITY_SPAWN 1157 #define DIALOG_BUSINESS_SECURITY 1158
#define DIALOG_IC_MARKET_3 1158 #define DIALOG_FACILITY_SPAWN 1159
#define DIALOG_BUY_VIP 1159 #define DIALOG_IC_MARKET_3 1160
#define DIALOG_TOYS_COLOR 1160 #define DIALOG_BUY_VIP 1161
#define DIALOG_HIGHSCORES 1161 #define DIALOG_TOYS_COLOR 1162
#define DIALOG_HIGHSCORES_BACK 1162 #define DIALOG_HIGHSCORES 1163
#define DIALOG_CROWDFUNDS 1163 #define DIALOG_HIGHSCORES_BACK 1164
#define DIALOG_CROWDFUND_OPTIONS 1164 #define DIALOG_CROWDFUNDS 1165
#define DIALOG_CROWDFUND_INFO 1165 #define DIALOG_CROWDFUND_OPTIONS 1166
#define DIALOG_CROWDFUND_DONATE 1166 #define DIALOG_CROWDFUND_INFO 1167
#define DIALOG_CROWDFUND_DONATE 1168
/* ** Hooks ** */ /* ** Hooks ** */
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )

View File

@ -328,83 +328,217 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
return ShowPlayerVehicleComponents( playerid, listitem ); return ShowPlayerVehicleComponents( playerid, listitem );
} }
else if ( dialogid == DIALOG_COMPONENTS ) else if ( dialogid == DIALOG_COMPONENTS )
{
SetPVarInt( playerid, "components_item", listitem );
if ( response )
{
ShowPlayerDialog(playerid, DIALOG_COMPONENTS_RESPONSE, DIALOG_STYLE_LIST, ""COL_WHITE"Pimp My Ride", "Purchase Component\nPreview Component", "Select", "Back" );
}
else
{
return cmd_garage( playerid, "vehicle pimp" );
}
}
else if ( dialogid == DIALOG_COMPONENTS_RESPONSE )
{ {
new new
iItem = GetPVarInt( playerid, "components_item" ),
iComponent = GetPVarInt( playerid, "components_category" ); iComponent = GetPVarInt( playerid, "components_category" );
if ( response ) if ( response )
{ {
for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent ) switch( listitem )
{ {
if ( listitem == x++ ) case 0:
{ {
if ( !IsPlayerInAnyVehicle( playerid ) ) for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent )
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 if ( iItem == x++ )
instances = 0; {
if ( !IsPlayerInAnyVehicle( playerid ) )
return SendError( playerid, "You need to be in a vehicle to use this command." );
for( new p = 0; p < MAX_PIMPS; p++ ) if ( GetPlayerCash( playerid ) < g_vehicleComponentsData[ i ] [ E_PRICE ] )
if ( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ p ] && g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_MODEL ] [ p ] == g_vehicleComponentsData[ i ] [ E_MODEL_ID ] ) return SendError( playerid, "You need %s to purchase this vehicle component.", cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) );
instances ++;
if ( instances >= g_vehicleComponentsData[ i ] [ E_LIMIT ] ) if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER )
return SendError( playerid, "You can place a %s a maximum of %d time(s).", g_vehicleComponentsData[ i ] [ E_NAME ], g_vehicleComponentsData[ i ] [ E_LIMIT ] ); 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 ] ) );
}
}
}
case 1:
{
new model = -1;
for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent )
{
if ( iItem == x++ )
{
model = g_vehicleComponentsData[ i ] [ E_MODEL_ID ];
}
} }
new p_VehiclePreviewTD[ 0 ] = CreatePlayerTextDraw(playerid,289.000000, 230.000000, "preview 2");
Float: X, Float: Y, Float: Z; 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);
GivePlayerCash( playerid, -g_vehicleComponentsData[ i ] [ E_PRICE ] ); 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);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ slotid ] = true; p_VehiclePreviewTD[ 2 ] = CreatePlayerTextDraw(playerid,358.000000, 230.000000, "preview 4");
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ slotid ] = false; PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 2 ], 112);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ slotid ] = g_vehicleComponentsData[ i ] [ E_MODEL_ID ]; PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 2 ], 5);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ slotid ] = 0.0; PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 2 ], 0.500000, 4.400000);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ slotid ] = 0.0; PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 2 ], -1);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ slotid ] = 1.0; PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 2 ], 1);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ slotid ] = 0.0; PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 2 ], 0);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ slotid ] = 0.0; PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 2 ], 60.000000, 60.000000);
g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ slotid ] = 0.0; 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);
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 ] ); p_VehiclePreviewTD[ 3 ] = CreatePlayerTextDraw(playerid,428.000000, 160.000000, "preview 4");
mysql_function_query( dbHandle, szNormalString, true, "OnPlayerCreateVehicleComponent", "ddd", playerid, vehicleid, slotid ); 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);
GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z ); p_VehiclePreviewTD[ 4 ] = CreatePlayerTextDraw(playerid,428.000000, 230.000000, "preview 5");
SetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z + 0.05 ); 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);
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 ]) ); p_VehiclePreviewTD[ 5 ] = CreatePlayerTextDraw(playerid,150.000000, 160.000000, "big preview");
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 ); PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 5 ], 112);
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 ] ) ); 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 );
TextDrawSetString( g_VehiclePreviewTxtTD, "Component Preview" );
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_component", 1 );
} }
} }
} }
@ -690,3 +824,36 @@ stock ShowVehicleComponentCategories( playerid )
} }
return ShowPlayerDialog( playerid, DIALOG_COMPONENTS_CATEGORY, DIALOG_STYLE_LIST, "Pimp My Ride - Categories", szCategory, "Select", "Cancel" ); return ShowPlayerDialog( playerid, DIALOG_COMPONENTS_CATEGORY, DIALOG_STYLE_LIST, "Pimp My Ride - Categories", szCategory, "Select", "Cancel" );
} }
hook OnPlayerClickTextDraw(playerid, Text: clickedid)
{
// Pressed ESC
if ( clickedid == Text: INVALID_TEXT_DRAW ) {
if ( GetPVarInt( playerid, "recently_previewed" ) < GetTickCount( ) && GetPVarInt( playerid, "viewing_component" ) )
return CancelComponentView( playerid, 0 );
}
return 1;
}
stock CancelComponentView( playerid, cancel = 1 )
{
if ( cancel )
CancelSelectTextDraw( playerid );
TextDrawHideForPlayer( playerid, g_VehiclePreviewBoxTD );
TextDrawHideForPlayer( playerid, g_VehiclePreviewTxtTD );
TextDrawHideForPlayer( playerid, p_VehiclePreviewCloseTD );
for( new i; i < sizeof p_VehiclePreviewTD; i++ )
PlayerTextDrawDestroy( playerid, p_VehiclePreviewTD[ i ] );
cmd_moviemode( playerid, "" ); // Show textdraws :3
DeletePVar( playerid, "viewing_component" );
SetPVarInt( playerid, "recently_previewed", GetTickCount( ) + 100 );
SendServerMessage( playerid, "You have finished looking at this vehicle modification preview." );
return ShowPlayerDialog(playerid, DIALOG_COMPONENTS_RESPONSE, DIALOG_STYLE_LIST, ""COL_WHITE"Pimp My Ride", "Purchase Component\nPreview Component", "Select", "Back" );
}