This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathLuaCheckpoint.cpp
More file actions
140 lines (120 loc) · 2.83 KB
/
Copy pathLuaCheckpoint.cpp
File metadata and controls
140 lines (120 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <sstream>
#include <limits>
#include <stdexcept>
#include <cstdint>
#include <vector>
#include <map>
#include "api.h"
// Math
#include "sdk/CVector2.h"
#include "sdk/CVector3.h"
#include "sdk/CVector4.h"
#include "sdk/Plane.h"
#include "sdk/Quaternion.h"
#include "sdk/util.h"
#include "sdk/CMaths.h"
#include "sdk/Structs.h"
// API Function Imports
#include "sdk/APICef.h"
#include "sdk/APIVisual.h"
#include "sdk/APIWorld.h"
#include "sdk/APIEntity.h"
#include "sdk/APICheckpoint.h"
#include "sdk/APINpc.h"
#include "sdk/APIObject.h"
#include "sdk/APIPlayer.h"
#include "sdk/APIServer.h"
#include "sdk/APIVehicle.h"
#include "sdk/APIBlip.h"
#include "sdk/APICamera.h"
#include "sdk/APILog.h"
extern "C" {
#include "inc_lua/lua.h"
#include "inc_lua/lualib.h"
#include "inc_lua/lauxlib.h"
}
#include "LuaBridge/LuaBridge.h"
#include "LuaBridge/RefCountedPtr.h"
#include "LuaBridge/RefCountedObject.h"
using namespace luabridge;
// API Lua Functions
#include "LuaVector3.h"
#include "LuaPlayer.h"
#include "LuaNpc.h"
#include "LuaVehicle.h"
#include "LuaCheckpoint.h"
int Checkpoint::Show(lua_State* L)
{
const int args = lua_gettop(L);
if (args == 2)
{
Checkpoint* ent = luabridge::Userdata::get<Checkpoint>(L, 1, false);
Player* player = luabridge::Userdata::get<Player>(L, 2, false);
API::Checkpoint::Show(ent->entity, player->entity);
ent = nullptr;
player = nullptr;
}
else
{
API::Log::Warning("Checkpoint:Show requires args (Player player).");
}
lua_pop(L, args);
return 0;
}
int Checkpoint::Hide(lua_State* L)
{
const int args = lua_gettop(L);
if (args == 2)
{
Checkpoint* ent = luabridge::Userdata::get<Checkpoint>(L, 1, false);
Player* player = luabridge::Userdata::get<Player>(L, 2, false);
API::Checkpoint::Hide(ent->entity, player->entity);
ent = nullptr;
player = nullptr;
}
else
{
API::Log::Warning("Checkpoint:Hide requires args (Player player).");
}
lua_pop(L, args);
return 0;
}
int Checkpoint::ShowBlip(lua_State* L)
{
const int args = lua_gettop(L);
if (args == 2)
{
Checkpoint* ent = luabridge::Userdata::get<Checkpoint>(L, 1, false);
Player* player = luabridge::Userdata::get<Player>(L, 2, false);
API::Blip::Show(ent->entity, player->entity);
ent = nullptr;
player = nullptr;
}
else
{
API::Log::Warning("Checkpoint:ShowBlip requires arg (Player player).");
}
lua_pop(L, args);
return 0;
}
int Checkpoint::HideBlip(lua_State* L)
{
const int args = lua_gettop(L);
if (args == 2)
{
Checkpoint* ent = luabridge::Userdata::get<Checkpoint>(L, 1, false);
Player* player = luabridge::Userdata::get<Player>(L, 2, false);
API::Blip::Hide(ent->entity, player->entity);
ent = nullptr;
player = nullptr;
}
else
{
API::Log::Warning("Checkpoint:HideBlip requires arg (Player player).");
}
lua_pop(L, args);
return 0;
}