commit
773ea829d5
@ -1026,7 +1026,7 @@ CMD:giveboombox( playerid, params[ ] )
|
|||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/giveboombox [PLAYER_ID]" );
|
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/giveboombox [PLAYER_ID]" );
|
||||||
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
|
else if ( ! IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
|
||||||
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player already has boombox in his inventory." );
|
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player already has boombox in his inventory." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1045,8 +1045,8 @@ CMD:removeboombox( playerid, params[ ] )
|
|||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/removeboombox [PLAYER_ID]" );
|
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/removeboombox [PLAYER_ID]" );
|
||||||
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
|
else if ( ! IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
|
||||||
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player doesn't have boombox in his inventory." );
|
else if ( ! GetPlayerBoombox( pID ) ) return SendError( playerid, "Player doesn't have boombox in his inventory." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) has removed your boombox.", ReturnPlayerName( playerid ), playerid );
|
SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) has removed your boombox.", ReturnPlayerName( playerid ), playerid );
|
||||||
|
@ -214,6 +214,7 @@
|
|||||||
#define DIALOG_XPMARKET_SELL 1205
|
#define DIALOG_XPMARKET_SELL 1205
|
||||||
#define DIALOG_BUY_VIP_MAIN 1206
|
#define DIALOG_BUY_VIP_MAIN 1206
|
||||||
#define DIALOG_VEH_COLORS 1207
|
#define DIALOG_VEH_COLORS 1207
|
||||||
|
#define DIALOG_CASINO_POINTS_MARKET 1208
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
|
@ -366,7 +366,7 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo
|
|||||||
{
|
{
|
||||||
// event check
|
// event check
|
||||||
#if defined __cloudy_event_system
|
#if defined __cloudy_event_system
|
||||||
if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_KIDNAP ) )
|
if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_ANIM ) )
|
||||||
#else
|
#else
|
||||||
if ( IsPlayerInEvent( playerid ) )
|
if ( IsPlayerInEvent( playerid ) )
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,7 +122,7 @@ CMD:taze( playerid, params[ ] )
|
|||||||
|
|
||||||
// event check
|
// event check
|
||||||
#if defined __cloudy_event_system
|
#if defined __cloudy_event_system
|
||||||
if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_KIDNAP ) )
|
if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_ARREST ) )
|
||||||
#else
|
#else
|
||||||
if ( IsPlayerInEvent( playerid ) )
|
if ( IsPlayerInEvent( playerid ) )
|
||||||
#endif
|
#endif
|
||||||
|
@ -571,3 +571,7 @@ stock GetGaragePos( garageid, &Float: X, &Float: Y, &Float: Z ) {
|
|||||||
Y = g_garageData[ garageid ] [ E_Y ];
|
Y = g_garageData[ garageid ] [ E_Y ];
|
||||||
Z = g_garageData[ garageid ] [ E_Z ];
|
Z = g_garageData[ garageid ] [ E_Z ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock IsPlayerInGarage( playerid ) {
|
||||||
|
return p_InGarage[ playerid ] != -1;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Irresistible Gaming (c) 2018
|
* Irresistible Gaming (c) 2018
|
||||||
* Developed by Lorenc
|
* Developed by Lorenc, Cloudy
|
||||||
* Module: cnr\features\vehicles\vehicle_modifications.pwn
|
* Module: cnr\features\vehicles\vehicle_modifications.pwn
|
||||||
* Purpose: custom vehicle components (objects) for player vehicles
|
* Purpose: custom vehicle components (objects) for player vehicles
|
||||||
*/
|
*/
|
||||||
@ -30,6 +30,16 @@
|
|||||||
|
|
||||||
#define PREVIEW_MODEL_COMPONENT ( 10 ) // some random number
|
#define PREVIEW_MODEL_COMPONENT ( 10 ) // some random number
|
||||||
|
|
||||||
|
#define COMPONENT_EDIT_TYPE_X 0
|
||||||
|
#define COMPONENT_EDIT_TYPE_Y 1
|
||||||
|
#define COMPONENT_EDIT_TYPE_Z 2
|
||||||
|
#define COMPONENT_EDIT_TYPE_RX 3
|
||||||
|
#define COMPONENT_EDIT_TYPE_RY 4
|
||||||
|
#define COMPONENT_EDIT_TYPE_RZ 5
|
||||||
|
|
||||||
|
#define TIMER_UPDATE_RATE 50
|
||||||
|
#define MAX_COMPONENT_OFFSET 3.0
|
||||||
|
|
||||||
enum E_CAR_MODS
|
enum E_CAR_MODS
|
||||||
{
|
{
|
||||||
E_CATEGORY, E_LIMIT, E_MODEL_ID,
|
E_CATEGORY, E_LIMIT, E_MODEL_ID,
|
||||||
@ -227,102 +237,10 @@ new
|
|||||||
g_vehiclePimpData[ MAX_PLAYERS ] [ MAX_BUYABLE_VEHICLES ] [ E_PIMP_DATA ]
|
g_vehiclePimpData[ MAX_PLAYERS ] [ MAX_BUYABLE_VEHICLES ] [ E_PIMP_DATA ]
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* ** Forwards ** */
|
||||||
|
forward OnUpdateVehicleComponents( playerid );
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** 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[ ] )
|
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||||
{
|
{
|
||||||
if ( ( dialogid == DIALOG_COMPONENTS_CATEGORY ) && response ) {
|
if ( ( dialogid == DIALOG_COMPONENTS_CATEGORY ) && response ) {
|
||||||
@ -515,30 +433,35 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
}
|
}
|
||||||
case 1: // Edit
|
case 1: // Edit
|
||||||
{
|
{
|
||||||
new
|
if ( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ i ] )
|
||||||
Float: X, Float: Y, Float: Z, Float: Angle;
|
{
|
||||||
|
SendError( playerid, "This component is disabled, enable it first." );
|
||||||
GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z );
|
return ShowPlayerVehicleComponentMenu( playerid, ownerid, vehicleid, i );
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetPVarFloat( playerid, "component_pos_x", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ i ] );
|
||||||
|
SetPVarFloat( playerid, "component_pos_y", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ i ] );
|
||||||
|
SetPVarFloat( playerid, "component_pos_z", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ i ] );
|
||||||
|
SetPVarFloat( playerid, "component_rot_x", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ i ] );
|
||||||
|
SetPVarFloat( playerid, "component_rot_y", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ i ] );
|
||||||
|
SetPVarFloat( playerid, "component_rot_z", g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ i ] );
|
||||||
|
|
||||||
|
ShowPlayerHelpDialog(
|
||||||
|
playerid, 0,
|
||||||
|
"~g~A or D -~w~ Move object~n~"\
|
||||||
|
"~g~/px - ~w~X axis~n~\
|
||||||
|
~g~/py - ~w~Y axis~n~\
|
||||||
|
~g~/pz - ~w~Z axis~n~\
|
||||||
|
~g~/rx - ~w~X rotation~n~\
|
||||||
|
~g~/ry - ~w~Y rotation~n~\
|
||||||
|
~g~/rz - ~w~Z rotation~n~\
|
||||||
|
~g~Press Y - ~w~Save~n~\
|
||||||
|
~g~Press N - ~w~Cancel~n~\
|
||||||
|
~g~Hold SPACE - ~w~Faster edit"
|
||||||
|
);
|
||||||
|
|
||||||
|
SendClientMessage( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You have started editing the component." );
|
||||||
|
SetTimerEx( "OnUpdateVehicleComponents", TIMER_UPDATE_RATE, false, "d", playerid );
|
||||||
}
|
}
|
||||||
case 2: // sell
|
case 2: // sell
|
||||||
{
|
{
|
||||||
@ -667,7 +590,151 @@ thread OnPlayerCreateVehicleComponent( playerid, vehicleid, slotid )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ** Callbacks ** */
|
||||||
|
public OnUpdateVehicleComponents( playerid )
|
||||||
|
{
|
||||||
|
// just incase, to avoid bugs
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) || ! IsPlayerInGarage( playerid ) )
|
||||||
|
return EndPlayerEditComponent( playerid );
|
||||||
|
|
||||||
|
new
|
||||||
|
ownerid = INVALID_PLAYER_ID,
|
||||||
|
vehicleid = GetPlayerVehicleID( playerid ),
|
||||||
|
slotid = GetPVarInt( playerid, "components_editing" ),
|
||||||
|
v = getVehicleSlotFromID( vehicleid, ownerid )
|
||||||
|
;
|
||||||
|
if ( v == -1 || playerid != ownerid || ! g_vehiclePimpData[ ownerid ] [ v ] [ E_CREATED ] [ slotid ] || g_vehiclePimpData[ ownerid ] [ v ] [ E_DISABLED ] [ slotid ] )
|
||||||
|
return SendServerMessage( playerid, "Vehicle component editing was cancelled." ), EndPlayerEditComponent( playerid );
|
||||||
|
|
||||||
|
new
|
||||||
|
LR, KEYS, Float: VALUE = -1.0;
|
||||||
|
|
||||||
|
GetPlayerKeys( playerid, KEYS, tmpVariable, LR );
|
||||||
|
|
||||||
|
if ( KEYS & KEY_YES )
|
||||||
|
{
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You have saved the component you were editing." );
|
||||||
|
return EndPlayerEditComponent( ownerid, v, slotid, true );
|
||||||
|
}
|
||||||
|
else if ( KEYS & KEY_NO )
|
||||||
|
{
|
||||||
|
SendClientMessage( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You have cancelled editing the component." );
|
||||||
|
return EndPlayerEditComponent( ownerid, v, slotid );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( LR > 0 )
|
||||||
|
VALUE = 0.01;
|
||||||
|
|
||||||
|
else if ( LR < 0 )
|
||||||
|
VALUE = -0.01;
|
||||||
|
|
||||||
|
if ( VALUE != -1.0 )
|
||||||
|
{
|
||||||
|
// hold space to edit components faster
|
||||||
|
if ( KEYS & KEY_HANDBRAKE )
|
||||||
|
VALUE *= 3;
|
||||||
|
|
||||||
|
new Float: tmpPosX = GetPVarFloat( playerid, "component_pos_x" );
|
||||||
|
new Float: tmpPosY = GetPVarFloat( playerid, "component_pos_y" );
|
||||||
|
new Float: tmpPosZ = GetPVarFloat( playerid, "component_pos_z" );
|
||||||
|
new Float: tmpRotX = GetPVarFloat( playerid, "component_rot_x" );
|
||||||
|
new Float: tmpRotY = GetPVarFloat( playerid, "component_rot_y" );
|
||||||
|
new Float: tmpRotZ = GetPVarFloat( playerid, "component_rot_z" );
|
||||||
|
|
||||||
|
switch( GetPVarInt( playerid, "component_edit_type" ) )
|
||||||
|
{
|
||||||
|
case COMPONENT_EDIT_TYPE_X:
|
||||||
|
SetPVarFloat( playerid, "component_pos_x", ( tmpPosX += VALUE ) );
|
||||||
|
|
||||||
|
case COMPONENT_EDIT_TYPE_Y:
|
||||||
|
SetPVarFloat( playerid, "component_pos_y", ( tmpPosY += VALUE ) );
|
||||||
|
|
||||||
|
case COMPONENT_EDIT_TYPE_Z:
|
||||||
|
SetPVarFloat( playerid, "component_pos_z", ( tmpPosZ += VALUE ) );
|
||||||
|
|
||||||
|
case COMPONENT_EDIT_TYPE_RX:
|
||||||
|
SetPVarFloat( playerid, "component_rot_x", ( tmpRotX += ( ( VALUE * 360 ) / 100 ) * 10 ) );
|
||||||
|
|
||||||
|
case COMPONENT_EDIT_TYPE_RY:
|
||||||
|
SetPVarFloat( playerid, "component_rot_y", ( tmpRotY += ( ( VALUE * 360 ) / 100 ) * 10 ) );
|
||||||
|
|
||||||
|
case COMPONENT_EDIT_TYPE_RZ:
|
||||||
|
SetPVarFloat( playerid, "component_rot_z", ( tmpRotZ += ( ( VALUE * 360 ) / 100 ) * 10 ) );
|
||||||
|
|
||||||
|
default:
|
||||||
|
return EndPlayerEditComponent( playerid, v, slotid );
|
||||||
|
}
|
||||||
|
|
||||||
|
// add movement limit of MAX_COMPONENT_OFFSET units
|
||||||
|
if ( tmpPosX > MAX_COMPONENT_OFFSET ) tmpPosX = MAX_COMPONENT_OFFSET;
|
||||||
|
else if ( tmpPosX < -MAX_COMPONENT_OFFSET ) tmpPosX = -MAX_COMPONENT_OFFSET;
|
||||||
|
|
||||||
|
if ( tmpPosY > MAX_COMPONENT_OFFSET ) tmpPosY = MAX_COMPONENT_OFFSET;
|
||||||
|
else if ( tmpPosY < -MAX_COMPONENT_OFFSET ) tmpPosY = -MAX_COMPONENT_OFFSET;
|
||||||
|
|
||||||
|
if ( tmpPosZ > MAX_COMPONENT_OFFSET ) tmpPosZ = MAX_COMPONENT_OFFSET;
|
||||||
|
else if ( tmpPosZ < -MAX_COMPONENT_OFFSET ) tmpPosZ = -MAX_COMPONENT_OFFSET;
|
||||||
|
|
||||||
|
// attach object to vehicle
|
||||||
|
AttachDynamicObjectToVehicle(
|
||||||
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], g_vehicleData[ ownerid ] [ v ] [ E_VEHICLE_ID ],
|
||||||
|
tmpPosX, tmpPosY, tmpPosZ,
|
||||||
|
tmpRotX, tmpRotY, tmpRotZ
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return SetTimerEx( "OnUpdateVehicleComponents", TIMER_UPDATE_RATE, false, "d", playerid );
|
||||||
|
}
|
||||||
|
|
||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
|
stock EndPlayerEditComponent( playerid, vehicleid = -1, slotid = -1, bool: save = false )
|
||||||
|
{
|
||||||
|
if ( save )
|
||||||
|
{
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RX ] [ slotid ] = GetPVarFloat( playerid, "component_rot_x" );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RY ] [ slotid ] = GetPVarFloat( playerid, "component_rot_y" );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RZ ] [ slotid ] = GetPVarFloat( playerid, "component_rot_z" );
|
||||||
|
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_X ] [ slotid ] = GetPVarFloat( playerid, "component_pos_x" );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_Y ] [ slotid ] = GetPVarFloat( playerid, "component_pos_y" );
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_Z ] [ slotid ] = GetPVarFloat( playerid, "component_pos_z" );
|
||||||
|
|
||||||
|
format(
|
||||||
|
szNormalString, sizeof( szNormalString ),
|
||||||
|
"UPDATE `COMPONENTS` SET `X`=%f,`Y`=%f,`Z`=%f,`RX`=%f,`RY`=%f,`RZ`=%f WHERE `ID`=%d",
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_X ] [ slotid ], g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_Y ] [ slotid ], g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_Z ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RX ] [ slotid ], g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RY ] [ slotid ], g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RZ ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_SQL_ID ] [ slotid ]
|
||||||
|
);
|
||||||
|
mysql_single_query( szNormalString );
|
||||||
|
}
|
||||||
|
|
||||||
|
DeletePVar( playerid, "components_editing" );
|
||||||
|
DeletePVar( playerid, "component_edit_type" );
|
||||||
|
DeletePVar( playerid, "component_pos_x" );
|
||||||
|
DeletePVar( playerid, "component_pos_y" );
|
||||||
|
DeletePVar( playerid, "component_pos_z" );
|
||||||
|
DeletePVar( playerid, "component_rot_x" );
|
||||||
|
DeletePVar( playerid, "component_rot_y" );
|
||||||
|
DeletePVar( playerid, "component_rot_z" );
|
||||||
|
|
||||||
|
if ( vehicleid != -1 && slotid != -1 )
|
||||||
|
{
|
||||||
|
AttachDynamicObjectToVehicle(
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ],
|
||||||
|
g_vehicleData[ playerid ] [ vehicleid ] [ E_VEHICLE_ID ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_X ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_Y ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_Z ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RX ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RY ] [ slotid ],
|
||||||
|
g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_RZ ] [ slotid ]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
HidePlayerHelpDialog( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
stock GetVehicleComponentSlot( playerid, vehicleid ) {
|
stock GetVehicleComponentSlot( playerid, vehicleid ) {
|
||||||
|
|
||||||
for( new id = 0; id < MAX_PIMPS; id++ ) {
|
for( new id = 0; id < MAX_PIMPS; id++ ) {
|
||||||
@ -715,7 +782,8 @@ stock ReplaceVehicleCustomComponents( ownerid, v, bool: recreate_obj = false ) {
|
|||||||
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_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 ] );
|
g_vehiclePimpData[ ownerid ] [ v ] [ E_RX ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_RY ] [ slotid ], g_vehiclePimpData[ ownerid ] [ v ] [ E_RZ ] [ slotid ] );
|
||||||
|
|
||||||
// Update virtual world
|
// Update virtual world - There was an error appearing here, so make sure object is valid.
|
||||||
|
if ( IsValidDynamicObject( g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ] ) )
|
||||||
Streamer_SetIntData( STREAMER_TYPE_OBJECT, g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], E_STREAMER_WORLD_ID, GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ v ] [ E_VEHICLE_ID ] ) );
|
Streamer_SetIntData( STREAMER_TYPE_OBJECT, g_vehiclePimpData[ ownerid ] [ v ] [ E_OBJECT ] [ slotid ], E_STREAMER_WORLD_ID, GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ v ] [ E_VEHICLE_ID ] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -773,3 +841,56 @@ hook OnPlayerEndModelPreview( playerid, handleid )
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ** Commands ** */
|
||||||
|
CMD:px( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) ) return SendError( playerid, "You're not editing a vehicle." );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "component_edit_type", COMPONENT_EDIT_TYPE_X );
|
||||||
|
return SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You're now editing the X axis of the component." );
|
||||||
|
}
|
||||||
|
|
||||||
|
CMD:py( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) ) return SendError( playerid, "You're not editing a vehicle." );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "component_edit_type", COMPONENT_EDIT_TYPE_Y );
|
||||||
|
return SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You're now editing the Y axis of the component." );
|
||||||
|
}
|
||||||
|
|
||||||
|
CMD:pz( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) ) return SendError( playerid, "You're not editing a vehicle." );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "component_edit_type", COMPONENT_EDIT_TYPE_Z );
|
||||||
|
return SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You're now editing the Z axis of the component." );
|
||||||
|
}
|
||||||
|
|
||||||
|
CMD:rx( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) ) return SendError( playerid, "You're not editing a vehicle." );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "component_edit_type", COMPONENT_EDIT_TYPE_RX );
|
||||||
|
return SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You're now editing the X rotation of the component." );
|
||||||
|
}
|
||||||
|
|
||||||
|
CMD:ry( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) ) return SendError( playerid, "You're not editing a vehicle." );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "component_edit_type", COMPONENT_EDIT_TYPE_RY );
|
||||||
|
return SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You're now editing the Y rotation of the component." );
|
||||||
|
}
|
||||||
|
|
||||||
|
CMD:rz( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
if ( ! IsPlayerEditingVehicle( playerid ) ) return SendError( playerid, "You're not editing a vehicle." );
|
||||||
|
|
||||||
|
SetPVarInt( playerid, "component_edit_type", COMPONENT_EDIT_TYPE_RZ );
|
||||||
|
return SendClientMessageFormatted( playerid, -1, ""COL_GREY"[GARAGE]"COL_WHITE" You're now editing the Z rotation of the component." );
|
||||||
|
}
|
||||||
|
|
||||||
|
stock IsPlayerEditingVehicle( playerid ) {
|
||||||
|
return GetPVarType( playerid, "components_editing" ) != 0;
|
||||||
|
}
|
@ -13,6 +13,9 @@
|
|||||||
#define CASINO_REWARDS_DIVISOR 10.0 // 1000 points becomes 1 point
|
#define CASINO_REWARDS_DIVISOR 10.0 // 1000 points becomes 1 point
|
||||||
#define CASINO_REWARDS_COST_MP 1.0 // half of the price (since it costs (1/payout_percent) times more)
|
#define CASINO_REWARDS_COST_MP 1.0 // half of the price (since it costs (1/payout_percent) times more)
|
||||||
|
|
||||||
|
#define CASINO_POINTS_SELL_MINIMUM 10000
|
||||||
|
#define CASINO_POINTS_SELL_VALUE 10.0
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
enum E_REWARDS_DATA
|
enum E_REWARDS_DATA
|
||||||
{
|
{
|
||||||
@ -53,6 +56,11 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
if ( listitem >= sizeof( g_casinoRewardsShopItems ) )
|
if ( listitem >= sizeof( g_casinoRewardsShopItems ) )
|
||||||
{
|
{
|
||||||
new rewards_item = listitem - sizeof( g_casinoRewardsShopItems );
|
new rewards_item = listitem - sizeof( g_casinoRewardsShopItems );
|
||||||
|
|
||||||
|
if ( rewards_item >= sizeof( g_casinoRewardsItems ) ) {
|
||||||
|
return ShowPlayerSellMenu( playerid );
|
||||||
|
}
|
||||||
|
|
||||||
new Float: rewards_points = g_casinoRewardsItems[ rewards_item ] [ E_POINTS ];
|
new Float: rewards_points = g_casinoRewardsItems[ rewards_item ] [ E_POINTS ];
|
||||||
|
|
||||||
if ( p_CasinoRewardsPoints[ playerid ] < rewards_points )
|
if ( p_CasinoRewardsPoints[ playerid ] < rewards_points )
|
||||||
@ -142,6 +150,37 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
mysql_single_query( sprintf( "UPDATE `USERS` SET `CASINO_REWARDS` = %f WHERE `ID`=%d", p_CasinoRewardsPoints[ playerid ], p_AccountID[ playerid ] ) );
|
mysql_single_query( sprintf( "UPDATE `USERS` SET `CASINO_REWARDS` = %f WHERE `ID`=%d", p_CasinoRewardsPoints[ playerid ], p_AccountID[ playerid ] ) );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if ( dialogid == DIALOG_CASINO_POINTS_MARKET )
|
||||||
|
{
|
||||||
|
if ( ! response ) {
|
||||||
|
return ShowPlayerRewardsMenu( playerid );
|
||||||
|
}
|
||||||
|
|
||||||
|
new total_points = floatround( p_CasinoRewardsPoints[ playerid ], floatround_floor );
|
||||||
|
new sell_amount = strval( inputtext );
|
||||||
|
|
||||||
|
if ( sell_amount < CASINO_POINTS_SELL_MINIMUM )
|
||||||
|
{
|
||||||
|
SendError( playerid, "Minimum amount of Casino Points that you can sell is %s.", number_format( CASINO_POINTS_SELL_MINIMUM ) );
|
||||||
|
return ShowPlayerSellMenu( playerid );
|
||||||
|
}
|
||||||
|
else if ( sell_amount > total_points )
|
||||||
|
{
|
||||||
|
SendError( playerid, "You do not have this much Casino Points." );
|
||||||
|
return ShowPlayerSellMenu( playerid );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new
|
||||||
|
credit = floatround( float( sell_amount ) * CASINO_POINTS_SELL_VALUE, floatround_floor );
|
||||||
|
|
||||||
|
GivePlayerCash( playerid, credit );
|
||||||
|
p_CasinoRewardsPoints[ playerid ] -= float( sell_amount );
|
||||||
|
SendGlobalMessage( -1, ""COL_GREY"[CASINO]{FFFFFF} %s(%d) has sold %s casino points for "COL_GOLD"%s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, points_format( sell_amount ), cash_format( credit ) );
|
||||||
|
mysql_single_query( sprintf( "UPDATE `USERS` SET `CASINO_REWARDS` = %f WHERE `ID`=%d", p_CasinoRewardsPoints[ playerid ], p_AccountID[ playerid ] ) );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,10 +274,27 @@ stock ShowPlayerRewardsMenu( playerid )
|
|||||||
for ( new i = 0; i < sizeof( g_casinoRewardsItems ); i ++ ) {
|
for ( new i = 0; i < sizeof( g_casinoRewardsItems ); i ++ ) {
|
||||||
format( szString, sizeof( szString ), "%s%s\t \t"COL_GOLD"%s points\n", szString, g_casinoRewardsItems[ i ] [ E_NAME ], points_format( g_casinoRewardsItems[ i ] [ E_POINTS ] ) );
|
format( szString, sizeof( szString ), "%s%s\t \t"COL_GOLD"%s points\n", szString, g_casinoRewardsItems[ i ] [ E_NAME ], points_format( g_casinoRewardsItems[ i ] [ E_POINTS ] ) );
|
||||||
}
|
}
|
||||||
|
strcat( szString, ""COL_GREEN"Sell Your Points\t \t"COL_GREEN">>>" );
|
||||||
}
|
}
|
||||||
return ShowPlayerDialog( playerid, DIALOG_CASINO_REWARDS, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Casino Rewards Items", szString, "Buy", "Cancel" );
|
return ShowPlayerDialog( playerid, DIALOG_CASINO_REWARDS, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Casino Rewards Items", szString, "Buy", "Cancel" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock ShowPlayerSellMenu( playerid )
|
||||||
|
{
|
||||||
|
new value = floatround( p_CasinoRewardsPoints[ playerid ] * CASINO_POINTS_SELL_VALUE );
|
||||||
|
|
||||||
|
format( szBigString, sizeof( szBigString ),
|
||||||
|
""COL_WHITE"Please input how much Casino Points you want to sell.\n\n"\
|
||||||
|
"Exchange Rate is "COL_GOLD"1 "COL_WHITE"Casino Point for "COL_GOLD"%s\n\n"\
|
||||||
|
""COL_WHITE"You have "COL_GOLD"%s "COL_WHITE"Casino Points that can be sold for "COL_GOLD"%s",
|
||||||
|
cash_format( CASINO_POINTS_SELL_VALUE, .decimals = 0 ),
|
||||||
|
points_format( p_CasinoRewardsPoints[ playerid ] ),
|
||||||
|
cash_format( value, .decimals = 0 )
|
||||||
|
);
|
||||||
|
|
||||||
|
return ShowPlayerDialog( playerid, DIALOG_CASINO_POINTS_MARKET, DIALOG_STYLE_INPUT, "{FFFFFF}Casino Points Market", szBigString, "Sell", "Back" );
|
||||||
|
}
|
||||||
|
|
||||||
stock IsCasinoRewardsShopItem( E_SHOP_ITEMS: itemid ) {
|
stock IsCasinoRewardsShopItem( E_SHOP_ITEMS: itemid ) {
|
||||||
for ( new i = 0; i < sizeof( g_casinoRewardsShopItems ); i ++ ) if ( itemid == g_casinoRewardsShopItems[ i ] ) {
|
for ( new i = 0; i < sizeof( g_casinoRewardsShopItems ); i ++ ) if ( itemid == g_casinoRewardsShopItems[ i ] ) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
v11.66.204
|
||||||
v11.65.200
|
v11.65.200
|
||||||
v11.60.190
|
v11.60.190
|
||||||
v11.57.188
|
v11.57.188
|
||||||
|
6
scriptfiles/changelogs/cnr/v11.66.204.txt
Normal file
6
scriptfiles/changelogs/cnr/v11.66.204.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
(+) Typing "/boombox play" again while your boombox is active will update the stream.
|
||||||
|
(+) "/jackpots" added. Shows the current casino slot machine jackpots.
|
||||||
|
(+) "/colors" added for people curious about vehicle colors.
|
||||||
|
(+) You can now sell your casino points for in-game money.
|
||||||
|
(/) Vehicle component placement overhaul. Accurately and easily place vehicle components!
|
||||||
|
(*) Kill death ratio is unaffected now during events.
|
Loading…
Reference in New Issue
Block a user