2023-03-04 11:23:45 +00:00
|
|
|
#include "backend/player_command.hpp"
|
|
|
|
#include "natives.hpp"
|
|
|
|
#include "pointers.hpp"
|
|
|
|
#include "util/teleport.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
class lock_vehicle : player_command
|
|
|
|
{
|
|
|
|
using player_command::player_command;
|
|
|
|
|
|
|
|
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
|
|
|
{
|
|
|
|
int lockStatus = VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(player->id());
|
2023-06-06 07:40:40 +00:00
|
|
|
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
|
|
|
|
|
|
|
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
2023-03-04 11:23:45 +00:00
|
|
|
{
|
2023-06-06 07:40:40 +00:00
|
|
|
g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data());
|
2023-03-04 11:23:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-06 07:40:40 +00:00
|
|
|
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
|
|
|
|
|
|
|
if (entity::take_control_of(veh))
|
2023-03-04 11:23:45 +00:00
|
|
|
{
|
2023-06-06 07:40:40 +00:00
|
|
|
entity::take_control_of(veh);
|
|
|
|
VEHICLE::SET_VEHICLE_DOORS_LOCKED(veh, 4);
|
2023-03-04 11:23:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
lock_vehicle g_lock_vehicle("lockveh", "Lock Vehicle", "Locks vehicle doors", 0);
|
|
|
|
}
|