This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
2024-07-23 13:40:30 +02:00

36 lines
1008 B
C++

#include "backend/player_command.hpp"
#include "natives.hpp"
#include "util\entity.hpp"
namespace big
{
class boost_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
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());
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, VEHICLE::GET_VEHICLE_ESTIMATED_MAX_SPEED(vehicle));
}
else
{
g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data());
}
}
}
};
boost_vehicle g_boost_vehicle("boostveh", "BACKEND_BOOST_VEHICLE", "BACKEND_BOOST_VEHICLE_DESC", 0);
}