Fixed unlockveh using the player id instead of ped (#2591)
* Fixed unlockveh command using the Player ID for the arguments instead of the Player Ped. * Fixed lock/unlock vehicle door calls to use the eVehicleLockState enum.
This commit is contained in:
parent
c1a49635eb
commit
e9fdc86239
@ -11,9 +11,7 @@ namespace big
|
|||||||
|
|
||||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||||
{
|
{
|
||||||
int lockStatus = VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(player->id());
|
|
||||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||||
|
|
||||||
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||||
{
|
{
|
||||||
g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data());
|
g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data());
|
||||||
@ -23,10 +21,7 @@ namespace big
|
|||||||
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
||||||
|
|
||||||
if (entity::take_control_of(veh))
|
if (entity::take_control_of(veh))
|
||||||
{
|
VEHICLE::SET_VEHICLE_DOORS_LOCKED(veh, (int)eVehicleLockState::VEHICLELOCK_LOCKOUT_PLAYER_ONLY);
|
||||||
entity::take_control_of(veh);
|
|
||||||
VEHICLE::SET_VEHICLE_DOORS_LOCKED(veh, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "pointers.hpp"
|
#include "pointers.hpp"
|
||||||
#include "util/teleport.hpp"
|
#include "util/teleport.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
class unlock_vehicle : player_command
|
class unlock_vehicle : player_command
|
||||||
@ -10,10 +11,17 @@ namespace big
|
|||||||
|
|
||||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||||
{
|
{
|
||||||
if (PED::IS_PED_IN_ANY_VEHICLE(player->id(), false))
|
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||||
|
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||||
{
|
{
|
||||||
if (entity::take_control_of(PED::GET_VEHICLE_PED_IS_USING(player->id())))
|
g_notification_service->push_warning("VEHICLE"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data());
|
||||||
VEHICLE::SET_VEHICLE_DOORS_LOCKED(PED::GET_VEHICLE_PED_IS_USING(player->id()), 0);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
||||||
|
|
||||||
|
if (entity::take_control_of(veh))
|
||||||
|
VEHICLE::SET_VEHICLE_DOORS_LOCKED(veh, (int)eVehicleLockState::VEHICLELOCK_UNLOCKED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user