mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-24 01:22:23 +08:00
Commands (#725)
* feat(Commands): Prototype command system * feat(Commands): Chat commands * refactor(Toxic): convert most options into commands * feat(Protections): block breakup kicks on other players as host * refactor(Kicks): convert most options into commands * refactor(Commands): add labels and descriptions to all commands * feat(Commands): cleanup on unload * refactor(Troll): convert most options into commands * refactor(Misc): convert most options into commands * refactor(Teleport): convert most options into commands * feat(Commands): Variadic commands and toggleable bools * feat(Hotkeys): hotkeys now use commands * fix(Chat): fix the chat window locking up when a message is sent * fix(Commands): properly handle spoofed username * fix(Spam): update filter Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
This commit is contained in:
41
src/backend/commands/player/toxic/kick_from_vehicle.cpp
Normal file
41
src/backend/commands/player/toxic/kick_from_vehicle.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "gta/net_object_mgr.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class kick_from_vehicle : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
auto vehicle = player->get_current_vehicle();
|
||||
|
||||
if (!vehicle || !vehicle->m_net_object)
|
||||
{
|
||||
// vehicle hasn't synced yet, use TSE
|
||||
const size_t arg_count = 9;
|
||||
int64_t args[arg_count] = {
|
||||
(int64_t)eRemoteEvent::VehicleKick,
|
||||
self::id, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
else
|
||||
{
|
||||
// use a private method to kick player from vehicle
|
||||
(*g_pointers->m_network_object_mgr)->ChangeOwner(vehicle->m_net_object, g_player_service->get_self()->get_net_game_player(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kick_from_vehicle g_kick_from_vehicle("vehkick", "Vehicle Kick", "Kicks the player from their current vehicle", 0);
|
||||
}
|
Reference in New Issue
Block a user