2022-12-22 21:23:32 +00:00
|
|
|
#include "backend/player_command.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "core/scr_globals.hpp"
|
2022-12-22 21:23:32 +00:00
|
|
|
#include "pointers.hpp"
|
|
|
|
|
2023-01-22 21:57:32 +00:00
|
|
|
#include <script/globals/GPBD_FM.hpp>
|
2023-03-01 21:27:15 +00:00
|
|
|
#include <script/globals/GlobalPlayerBD.hpp>
|
2023-01-22 21:57:32 +00:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
class enter_interior : 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
|
2022-12-22 21:23:32 +00:00
|
|
|
{
|
2023-01-22 21:57:32 +00:00
|
|
|
int id = player->id();
|
|
|
|
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index != -1)
|
2022-12-22 21:23:32 +00:00
|
|
|
{
|
2023-12-13 18:56:40 -05:00
|
|
|
const size_t arg_count = 10;
|
2023-03-01 21:27:15 +00:00
|
|
|
int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport,
|
|
|
|
self::id,
|
2023-12-13 18:56:40 -05:00
|
|
|
1 << self::id,
|
2023-03-01 21:27:15 +00:00
|
|
|
(int64_t)player->id(),
|
|
|
|
(int64_t)(int)-1,
|
|
|
|
1,
|
|
|
|
(int64_t)scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
1};
|
2022-12-22 21:23:32 +00:00
|
|
|
|
2023-12-13 13:32:26 -05:00
|
|
|
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << self::id, (int)eRemoteEvent::Teleport);
|
2023-01-22 21:57:32 +00:00
|
|
|
}
|
|
|
|
else if (scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID)
|
|
|
|
{
|
2024-12-13 23:52:31 +01:00
|
|
|
*scr_globals::interiors.at(3762).as<Player*>() =
|
2023-03-01 21:27:15 +00:00
|
|
|
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Owner;
|
2024-12-13 23:52:31 +01:00
|
|
|
*scr_globals::interiors.at(4111).as<eSimpleInteriorIndex*>() =
|
2023-03-01 21:27:15 +00:00
|
|
|
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index;
|
2024-12-13 23:52:31 +01:00
|
|
|
*scr_globals::interiors.at(4110).as<bool*>() = true;
|
2023-03-01 21:27:15 +00:00
|
|
|
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].SimpleInteriorData.InteriorSubtype =
|
|
|
|
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.InteriorSubtype;
|
2023-01-22 21:57:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-10-20 12:24:44 -04:00
|
|
|
ctx->report_error("BACKEND_ENTER_INTERIOR_NOT_IN_INTERIOR"_T.data());
|
2023-01-22 21:57:32 +00:00
|
|
|
}
|
2022-12-22 21:23:32 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-06-06 07:40:40 +00:00
|
|
|
enter_interior g_enter_interior("enterint", "ENTER_INTERIOR", "ENTER_INTERIOR_DESC", 0, false);
|
2022-12-22 21:23:32 +00:00
|
|
|
}
|