2023-03-04 11:23:45 +00:00
|
|
|
#include "backend/player_command.hpp"
|
|
|
|
#include "natives.hpp"
|
2024-07-23 07:40:30 -04:00
|
|
|
#include "util/entity.hpp"
|
2023-03-04 11:23:45 +00:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
class open_doors : player_command
|
|
|
|
{
|
|
|
|
using player_command::player_command;
|
|
|
|
|
2023-08-01 11:10:14 +02:00
|
|
|
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
2023-03-04 11:23:45 +00:00
|
|
|
{
|
|
|
|
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
|
|
|
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
|
|
|
{
|
2024-03-23 00:04:49 +01: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
|
|
|
|
{
|
|
|
|
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
|
|
|
|
|
|
|
|
if (entity::take_control_of(vehicle))
|
|
|
|
{
|
2023-08-19 11:01:08 +00:00
|
|
|
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(vehicle); i++)
|
2023-03-04 11:23:45 +00:00
|
|
|
{
|
|
|
|
VEHICLE::SET_VEHICLE_DOOR_OPEN(vehicle, i, true, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-23 00:04:49 +01:00
|
|
|
g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data());
|
2023-03-04 11:23:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-20 12:24:44 -04:00
|
|
|
open_doors g_open_doors("opendoors", "BACKEND_OPEN_VEHICLE_DOORS", "BACKEND_OPEN_VEHICLE_DOORS_DESC", 0);
|
2024-03-23 00:04:49 +01:00
|
|
|
}
|