2016-02-20 23:25:00 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-09-30 02:56:11 +02:00
|
|
|
#include "Entity/Player.hpp"
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "Entity/Vehicle.hpp"
|
2015-10-29 21:11:30 +01:00
|
|
|
#include "Base/Color3.hpp"
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "Base/Vector3.hpp"
|
|
|
|
#include "Core.hpp"
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-09 02:29:04 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include <sqstdstring.h>
|
|
|
|
|
2015-09-30 02:56:11 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
2015-10-29 21:11:30 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
Color3 CPlayer::s_Color3;
|
|
|
|
Vector3 CPlayer::s_Vector3;
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
SQChar CPlayer::s_Buffer[SQMOD_PLAYER_TMP_BUFFER];
|
2015-11-01 00:32:41 +01:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
const Int32 CPlayer::Max = SQMOD_PLAYER_POOL;
|
2015-11-07 11:17:39 +01:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
SQInteger CPlayer::Typename(HSQUIRRELVM vm)
|
|
|
|
{
|
|
|
|
static SQChar name[] = _SC("SqPlayer");
|
|
|
|
sq_pushstring(vm, name, sizeof(name));
|
|
|
|
return 1;
|
|
|
|
}
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2015-11-09 04:54:03 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CPlayer::CPlayer(Int32 id)
|
|
|
|
: m_ID(VALID_ENTITYGETEX(id, SQMOD_PLAYER_POOL))
|
2016-03-10 04:57:13 +01:00
|
|
|
, m_Tag(ToStrF("%d", id))
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
/* ... */
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CPlayer::~CPlayer()
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
/* ... */
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::Cmp(const CPlayer & o) const
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
if (m_ID == o.m_ID)
|
|
|
|
return 0;
|
|
|
|
else if (m_ID > o.m_ID)
|
|
|
|
return 1;
|
2015-11-09 04:54:03 +01:00
|
|
|
else
|
2016-02-20 23:25:00 +01:00
|
|
|
return -1;
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const String & CPlayer::ToString() const
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return m_Tag;
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
const String & CPlayer::GetTag() const
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return m_Tag;
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetTag(CSStr tag)
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
m_Tag.assign(tag);
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & CPlayer::GetData()
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return m_Data;
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetData(Object & data)
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Apply the specified value
|
|
|
|
m_Data = data;
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
void CPlayer::BindEvent(Int32 evid, Object & env, Function & func) const
|
2015-11-09 04:54:03 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Obtain the function instance called for this event
|
2016-02-20 23:25:00 +01:00
|
|
|
Function & event = _Core->GetPlayerEvent(m_ID, evid);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified callback function null?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (func.IsNull())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
event.Release(); // Then release the current callback
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Assign the specified environment and function
|
2015-11-09 04:54:03 +01:00
|
|
|
else
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
event = Function(env.GetVM(), env, func.GetFunc());
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
2015-10-29 21:11:30 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
bool CPlayer::IsStreamedFor(CPlayer & player) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("Invalid player argument: null");
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsPlayerStreamedForPlayer(m_ID, player.GetID());
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetClass() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerClass(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetAdmin() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsPlayerAdmin(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetAdmin(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerAdmin(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr CPlayer::GetIP() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear any previous string
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Buffer[0] = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// The server doesn't include the null terminator in the string (yet)
|
|
|
|
memset(s_Buffer, 0, sizeof(s_Buffer));
|
|
|
|
// Query the server for the ip of the managed player
|
|
|
|
_Func->GetPlayerIP(m_ID, s_Buffer, sizeof(s_Buffer));
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Buffer;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::Kick() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->KickPlayer(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::Ban() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->BanPlayer(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsConnected() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Func->IsPlayerConnected(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsSpawned() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsPlayerSpawned(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint32 CPlayer::GetKey() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerKey(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetWorld() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerWorld(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetWorld(Int32 world) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerWorld(m_ID, world);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetSecWorld() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerSecWorld(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetSecWorld(Int32 world) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerSecWorld(m_ID, world);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetUniqueWorld() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerUniqueWorld(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
bool CPlayer::IsWorldCompatible(Int32 world) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsPlayerWorldCompatible(m_ID, world);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr CPlayer::GetName() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear any previous string
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Buffer[0] = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// The server doesn't include the null terminator in the string (yet)
|
|
|
|
memset(s_Buffer, 0, sizeof(s_Buffer));
|
|
|
|
// Query the server for the name of the managed player
|
|
|
|
_Func->GetPlayerName(m_ID, s_Buffer, sizeof(s_Buffer));
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Buffer;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetName(CSStr name) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerName(m_ID, static_cast< CCStr >(name));
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetTeam() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerTeam(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetTeam(Int32 team) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerTeam(m_ID, team);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetSkin() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerSkin(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetSkin(Int32 skin) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerSkin(m_ID, skin);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const Color3 & CPlayer::GetColor() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous color information, if any
|
2015-10-29 21:11:30 +01:00
|
|
|
s_Color3.Clear();
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the color values
|
|
|
|
s_Color3.SetRGB(_Func->GetPlayerColour(m_ID));
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Color3;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetColor(const Color3 & color) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerColour(m_ID, color.GetRGB());
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetColorEx(Uint8 r, Uint8 g, Uint8 b) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerColour(m_ID, SQMOD_PACK_RGB(r, g, b));
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::ForceSpawn() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->ForcePlayerSpawn(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::ForceSelect() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->ForcePlayerSelect(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetMoney() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerMoney(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetMoney(Int32 amount) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerMoney(m_ID, amount);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::GiveMoney(Int32 amount) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->GivePlayerMoney(m_ID, amount);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetScore() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerScore(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetScore(Int32 score) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerScore(m_ID, score);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetPing() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerPing(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Float32 CPlayer::GetFPS() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerFPS(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsTyping() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsPlayerTyping(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr CPlayer::GetUID() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear any previous string
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Buffer[0] = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// The server doesn't include the null terminator in the string (yet)
|
|
|
|
memset(s_Buffer, 0, sizeof(s_Buffer));
|
|
|
|
// Query the server for the uid of the managed player
|
|
|
|
_Func->GetPlayerUID(m_ID, s_Buffer, sizeof(s_Buffer));
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Buffer;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr CPlayer::GetUID2() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear any previous string
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Buffer[0] = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// The server doesn't include the null terminator in the string (yet)
|
|
|
|
memset(s_Buffer, 0, sizeof(s_Buffer));
|
|
|
|
// Query the server for the uid2 of the managed player
|
|
|
|
_Func->GetPlayerUID2(m_ID, s_Buffer, sizeof(s_Buffer));
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Buffer;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Float32 CPlayer::GetHealth() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerHealth(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetHealth(Float32 amount) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerHealth(m_ID, amount);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Float32 CPlayer::GetArmor() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerArmour(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetArmor(Float32 amount) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerArmour(m_ID, amount);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetImmunity() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerImmunityFlags(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetImmunity(Int32 flags) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerImmunityFlags(m_ID, flags);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const Vector3 & CPlayer::GetPosition() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous position information, if any
|
2015-10-29 21:11:30 +01:00
|
|
|
s_Vector3.Clear();
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the position values
|
|
|
|
_Func->GetPlayerPos(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z);
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Vector3;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetPosition(const Vector3 & pos) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerPos(m_ID, pos.x, pos.y, pos.z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetPositionEx(Float32 x, Float32 y, Float32 z) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerPos(m_ID, x, y, z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const Vector3 & CPlayer::GetSpeed() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous speed information, if any
|
2015-10-29 21:11:30 +01:00
|
|
|
s_Vector3.Clear();
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the speed values
|
|
|
|
_Func->GetPlayerSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z);
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Vector3;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetSpeed(const Vector3 & vel) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerSpeed(m_ID, vel.x, vel.y, vel.z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetSpeedEx(Float32 x, Float32 y, Float32 z) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerSpeed(m_ID, x, y, z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::AddSpeed(const Vector3 & vel) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->AddPlayerSpeed(m_ID, vel.x, vel.y, vel.z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::AddSpeedEx(Float32 x, Float32 y, Float32 z) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->AddPlayerSpeed(m_ID, x, y, z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Float32 CPlayer::GetHeading() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerHeading(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetHeading(Float32 angle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerHeading(m_ID, angle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetAlpha() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerAlpha(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetAlpha(Int32 alpha, Int32 fade) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerAlpha(m_ID, alpha, fade);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetVehicleStatus() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerInVehicleStatus(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetOccupiedSlot() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerInVehicleSlot(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & CPlayer::GetVehicle() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetVehicle(_Func->GetPlayerVehicleID(m_ID)).mObj;
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetVehicleID() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerVehicleID(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetControllable() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerControllable(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetControllable(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerControllable(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetDriveby() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerDriveby(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetDriveby(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerDriveby(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetWhiteScanlines() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerWhiteScanlines(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetWhiteScanlines(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerWhiteScanlines(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetGreenScanlines() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerGreenScanlines(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetGreenScanlines(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerGreenScanlines(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetWidescreen() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerWidescreen(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetWidescreen(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerWidescreen(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetShowMarkers() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerShowMarkers(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetShowMarkers(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerShowMarkers(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetAttackPriv() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerAttackPriv(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetAttackPriv(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerAttackPriv(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetHasMarker() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerHasMarker(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetHasMarker(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerHasMarker(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetChatTags() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerChatTags(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetChatTags(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerChatTagsEnabled(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::GetDrunkEffects() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->EnabledPlayerDrunkEffects(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetDrunkEffects(bool toggle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->TogglePlayerDrunkEffects(m_ID, toggle);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetWeapon() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerWeapon(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetWeapon(Int32 wep, Int32 ammo) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerWeapon(m_ID, wep, ammo);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::GiveWeapon(Int32 wep, Int32 ammo) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->GivePlayerWeapon(m_ID, wep, ammo);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::StripWeapons() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->RemoveAllWeapons(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::SetCameraPosition(const Vector3 & pos, const Vector3 & aim) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetCameraPosition(m_ID, pos.x, pos.y, pos.z, aim.x, aim.y, aim.z);
|
2015-11-11 08:02:42 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetCameraPosition(Float32 xp, Float32 yp, Float32 zp, Float32 xa, Float32 ya, Float32 za) const
|
2015-11-11 08:02:42 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetCameraPosition(m_ID, xp, yp, zp, xa, ya, za);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::RestoreCamera() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->RestoreCamera(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsCameraLocked() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsCameraLocked(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetAnimation(Int32 group, Int32 anim) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerAnimation(m_ID, group, anim);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetWantedLevel() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerWantedLevel(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetWantedLevel(Int32 level) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerWantedLevel(m_ID, level);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & CPlayer::StandingOnVehicle() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetVehicle(_Func->GetPlayerStandingOnVehicle(m_ID)).mObj;
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & CPlayer::StandingOnObject() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetObject(_Func->GetPlayerStandingOnObject(m_ID)).mObj;
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsAway() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->IsPlayerAway(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & CPlayer::GetSpectator() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetPlayer(_Func->GetPlayerSpectateTarget(m_ID)).mObj;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetSpectator(CPlayer & target) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!target.IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("Invalid player argument: null");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerSpectateTarget(m_ID, target.GetID());
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsBurning() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerOnFireStatus(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CPlayer::IsCrouched() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerCrouchStatus(m_ID);
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
2015-10-29 21:11:30 +01:00
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetState() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerState(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetAction() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerAction(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetGameKeys() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->GetPlayerGameKeys(m_ID);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const Vector3 & CPlayer::GetAimPos() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous position information, if any
|
2015-10-29 21:11:30 +01:00
|
|
|
s_Vector3.Clear();
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the position values
|
|
|
|
_Func->GetPlayerAimPos(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z);
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Vector3;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const Vector3 & CPlayer::GetAimDir() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous direction information, if any
|
2015-10-29 21:11:30 +01:00
|
|
|
s_Vector3.Clear();
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the direction values
|
|
|
|
_Func->GetPlayerAimDir(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z);
|
|
|
|
// Return the requested information
|
2015-10-29 21:11:30 +01:00
|
|
|
return s_Vector3;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::Embark(CVehicle & vehicle) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified vehicle even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!vehicle.IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("Invalid vehicle argument: null");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->PutPlayerInVehicle(m_ID, vehicle.GetID(), 0, true, true);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::Embark(CVehicle & vehicle, Int32 slot, bool allocate, bool warp) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified vehicle even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!vehicle.IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("Invalid vehicle argument: null");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->PutPlayerInVehicle(m_ID, vehicle.GetID(), slot, allocate, warp);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void CPlayer::Disembark() const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->RemovePlayerFromVehicle(m_ID);
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
bool CPlayer::Redirect(CSStr ip, Uint32 port, CSStr nick, CSStr pass, CSStr user)
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Func->RedirectPlayerToServer(m_ID, ip, port, nick, pass, user);
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetAuthority() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetPlayer(m_ID).mAuthority;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetAuthority(Int32 level) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Core->GetPlayer(m_ID).mAuthority = level;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr CPlayer::GetMessagePrefix(Uint32 index) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Perform a range check on the specified prefix index
|
2016-02-20 23:25:00 +01:00
|
|
|
if (index >= SQMOD_PLAYER_MSG_PREFIXES)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("Prefix index is out of range: %u >= %d", index, SQMOD_PLAYER_MSG_PREFIXES);
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetPlayer(m_ID).mPrefixes[index].c_str();
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetMessagePrefix(Uint32 index, CSStr prefix) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Perform a range check on the specified prefix index
|
2016-02-20 23:25:00 +01:00
|
|
|
if (index >= SQMOD_PLAYER_MSG_PREFIXES)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("Prefix index is out of range: %u >= %d", index, SQMOD_PLAYER_MSG_PREFIXES);
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Core->GetPlayer(m_ID).mPrefixes[index].assign(prefix);
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint32 CPlayer::GetMessageColor() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetPlayer(m_ID).mMessageColor;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetMessageColor(Uint32 color) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Core->GetPlayer(m_ID).mMessageColor = color;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CPlayer::GetAnnounceStyle() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetPlayer(m_ID).mAnnounceStyle;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetAnnounceStyle(Int32 style) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Core->GetPlayer(m_ID).mAnnounceStyle = style;
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
Float32 CPlayer::GetPosX() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous position information, if any
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Vector3.x = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the requested component value
|
|
|
|
_Func->GetPlayerPos(m_ID, &s_Vector3.x, NULL, NULL);
|
|
|
|
// Return the requested information
|
2016-02-20 23:25:00 +01:00
|
|
|
return s_Vector3.x;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Float32 CPlayer::GetPosY() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous position information, if any
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Vector3.y = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the requested component value
|
|
|
|
_Func->GetPlayerPos(m_ID, NULL, &s_Vector3.y, NULL);
|
|
|
|
// Return the requested information
|
2016-02-20 23:25:00 +01:00
|
|
|
return s_Vector3.y;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Float32 CPlayer::GetPosZ() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Clear previous position information, if any
|
2016-02-20 23:25:00 +01:00
|
|
|
s_Vector3.z = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Query the server for the requested component value
|
|
|
|
_Func->GetPlayerPos(m_ID, NULL, NULL, &s_Vector3.z);
|
|
|
|
// Return the requested information
|
2016-02-20 23:25:00 +01:00
|
|
|
return s_Vector3.z;
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetPosX(Float32 x) const
|
2015-10-29 21:11:30 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Retrieve the current values for unchanged components
|
|
|
|
_Func->GetPlayerPos(m_ID, NULL, &s_Vector3.y, &s_Vector3.z);
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerPos(m_ID, x, s_Vector3.y, s_Vector3.z);
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetPosY(Float32 y) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Retrieve the current values for unchanged components
|
|
|
|
_Func->GetPlayerPos(m_ID, &s_Vector3.x, NULL, &s_Vector3.z);
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerPos(m_ID, s_Vector3.x, y, s_Vector3.z);
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
2015-10-29 21:11:30 +01:00
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CPlayer::SetPosZ(Float32 z) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Retrieve the current values for unchanged components
|
|
|
|
_Func->GetPlayerPos(m_ID, &s_Vector3.x, &s_Vector3.y, NULL);
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetPlayerPos(m_ID, s_Vector3.z, s_Vector3.y, z);
|
2015-10-29 21:11:30 +01:00
|
|
|
}
|
|
|
|
|
2015-11-09 02:29:04 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CPlayer::Msg(HSQUIRRELVM vm)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
const Int32 top = sq_gettop(vm);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the message color specified?
|
2015-11-09 02:29:04 +01:00
|
|
|
if (top <= 1)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing message color");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the message value specified?
|
|
|
|
else if (top <= 2)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing message value");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// The player instance
|
|
|
|
CPlayer * player = nullptr;
|
|
|
|
// The message color
|
|
|
|
Color3 color;
|
|
|
|
// Attempt to extract the argument values
|
|
|
|
try
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
player = Var< CPlayer * >(vm, 1).value;
|
|
|
|
color = Var< Color3 >(vm, 2).value;
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
catch (const Sqrat::Exception & e)
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Propagate the error
|
|
|
|
return sq_throwerror(vm, e.Message().c_str());
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player instance?
|
|
|
|
if (!player)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player instance");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player identifier?
|
|
|
|
else if (!player->IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player reference");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have enough values to call the format function?
|
2015-11-09 02:29:04 +01:00
|
|
|
else if (top > 3)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
SStr msg = NULL;
|
2015-11-09 02:29:04 +01:00
|
|
|
SQInteger len = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Attempt to generate the specified string format
|
|
|
|
SQRESULT ret = sqstd_format(vm, 3, &len, &msg);
|
|
|
|
// Did the format failed?
|
|
|
|
if (SQ_FAILED(ret))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return ret; // Propagate the exception
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(), color.GetRGBA(), "%s", msg);
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
|
|
|
else
|
2016-03-10 04:57:13 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the value from the stack as a string
|
|
|
|
Var< CSStr > msg(vm, 3);
|
|
|
|
// See if the obtained value is a valid message
|
|
|
|
if (!msg.value)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Unable to retrieve the message");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(), color.GetRGBA(), "%s", msg.value);
|
|
|
|
}
|
|
|
|
// This function does not return a value
|
2015-11-09 02:29:04 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-11-09 03:32:32 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CPlayer::MsgP(HSQUIRRELVM vm)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
const Int32 top = sq_gettop(vm);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the index of the message prefix specified?
|
2015-11-09 03:32:32 +01:00
|
|
|
if (top <= 1)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing prefix index");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the message value specified?
|
|
|
|
else if (top <= 2)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing message value");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// The player instance
|
|
|
|
CPlayer * player = nullptr;
|
|
|
|
// The prefix index
|
|
|
|
Uint32 index;
|
|
|
|
// Attempt to extract the argument values
|
|
|
|
try
|
2015-11-09 03:32:32 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
player = Var< CPlayer * >(vm, 1).value;
|
|
|
|
index = Var< Uint32 >(vm, 2).value;
|
2015-11-09 03:32:32 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
catch (const Sqrat::Exception & e)
|
2015-11-09 03:32:32 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Propagate the error
|
|
|
|
return sq_throwerror(vm, e.Message().c_str());
|
2015-11-09 03:32:32 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player instance?
|
|
|
|
if (!player)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player instance");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player identifier?
|
|
|
|
else if (!player->IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player reference");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Perform a range check on the specified prefix index
|
|
|
|
else if (index > SQMOD_PLAYER_MSG_PREFIXES)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, ToStrF("Prefix index is out of range: %u > %u",
|
|
|
|
index, SQMOD_PLAYER_MSG_PREFIXES));
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have enough values to call the format function?
|
2015-11-09 03:32:32 +01:00
|
|
|
else if (top > 3)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
SStr msg = NULL;
|
2015-11-09 03:32:32 +01:00
|
|
|
SQInteger len = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Attempt to generate the specified string format
|
|
|
|
SQRESULT ret = sqstd_format(vm, 3, &len, &msg);
|
|
|
|
// Did the format failed?
|
|
|
|
if (SQ_FAILED(ret))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return ret; // Propagate the exception
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Retrieve the associated player structure
|
|
|
|
const auto & splayer = _Core->GetPlayer(player->GetID());
|
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(), splayer.mMessageColor, "%s%s",
|
|
|
|
splayer.mPrefixes[index].c_str(), msg);
|
2015-11-09 03:32:32 +01:00
|
|
|
}
|
|
|
|
else
|
2016-03-10 04:57:13 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the value from the stack as a string
|
|
|
|
Var< CSStr > msg(vm, 3);
|
|
|
|
// See if the obtained value is a valid message
|
|
|
|
if (!msg.value)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Unable to retrieve the message");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Retrieve the associated player structure
|
|
|
|
const auto & splayer = _Core->GetPlayer(player->GetID());
|
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(), splayer.mMessageColor, "%s%s",
|
|
|
|
splayer.mPrefixes[index].c_str(), msg.value);
|
|
|
|
}
|
|
|
|
// This function does not return a value
|
2015-11-09 03:32:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-11-09 02:29:04 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CPlayer::MsgEx(HSQUIRRELVM vm)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
const Int32 top = sq_gettop(vm);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the message color specified?
|
|
|
|
if (top <= 3)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing message color");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the message value specified?
|
2015-11-09 02:29:04 +01:00
|
|
|
else if (top <= 4)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing message value");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// The player instance
|
|
|
|
CPlayer * player = nullptr;
|
|
|
|
// The message color
|
|
|
|
Uint8 r, g, b;
|
|
|
|
// Attempt to extract the argument values
|
|
|
|
try
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
player = Var< CPlayer * >(vm, 1).value;
|
|
|
|
r = Var< Uint8 >(vm, 2).value;
|
|
|
|
g = Var< Uint8 >(vm, 3).value;
|
|
|
|
b = Var< Uint8 >(vm, 4).value;
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
catch (const Sqrat::Exception & e)
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Propagate the error
|
|
|
|
return sq_throwerror(vm, e.Message().c_str());
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player instance?
|
|
|
|
if (!player)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player instance");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player identifier?
|
|
|
|
else if (!player->IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player reference");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have enough values to call the format function?
|
2015-11-09 02:29:04 +01:00
|
|
|
else if (top > 5)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
SStr msg = NULL;
|
2015-11-09 02:29:04 +01:00
|
|
|
SQInteger len = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Attempt to generate the specified string format
|
|
|
|
SQRESULT ret = sqstd_format(vm, 5, &len, &msg);
|
|
|
|
// Did the format failed?
|
|
|
|
if (SQ_FAILED(ret))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return ret; // Propagate the exception
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(), SQMOD_PACK_RGBA(r, g, b, 0), "%s", msg);
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
|
|
|
else
|
2016-03-10 04:57:13 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the value from the stack as a string
|
|
|
|
Var< CSStr > msg(vm, 5);
|
|
|
|
// See if the obtained value is a valid message
|
|
|
|
if (!msg.value)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Unable to retrieve the message");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(), SQMOD_PACK_RGBA(r, g, b, 0), "%s", msg.value);
|
|
|
|
}
|
|
|
|
// This function does not return a value
|
2015-11-09 02:29:04 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CPlayer::Message(HSQUIRRELVM vm)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
const Int32 top = sq_gettop(vm);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the message value specified?
|
2015-11-09 02:29:04 +01:00
|
|
|
if (top <= 1)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing message value");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// The player instance
|
|
|
|
CPlayer * player = nullptr;
|
|
|
|
// Attempt to extract the argument values
|
|
|
|
try
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
player = Var< CPlayer * >(vm, 1).value;
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
catch (const Sqrat::Exception & e)
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Propagate the error
|
|
|
|
return sq_throwerror(vm, e.Message().c_str());
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player instance?
|
|
|
|
if (!player)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player instance");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player identifier?
|
|
|
|
else if (!player->IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player reference");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have enough values to call the format function?
|
2015-11-09 02:29:04 +01:00
|
|
|
else if (top > 2)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
SStr msg = NULL;
|
2015-11-09 02:29:04 +01:00
|
|
|
SQInteger len = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Attempt to generate the specified string format
|
|
|
|
SQRESULT ret = sqstd_format(vm, 2, &len, &msg);
|
|
|
|
// Did the format failed?
|
|
|
|
if (SQ_FAILED(ret))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return ret; // Propagate the exception
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(),
|
|
|
|
_Core->GetPlayer(player->GetID()).mMessageColor, "%s", msg);
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
|
|
|
else
|
2016-03-10 04:57:13 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the value from the stack as a string
|
|
|
|
Var< CSStr > msg(vm, 2);
|
|
|
|
// See if the obtained value is a valid message
|
|
|
|
if (!msg.value)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Unable to retrieve the message");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted message string
|
|
|
|
_Func->SendClientMessage(player->GetID(),
|
|
|
|
_Core->GetPlayer(player->GetID()).mMessageColor, "%s", msg.value);
|
|
|
|
}
|
|
|
|
// This function does not return a value
|
2015-11-09 02:29:04 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CPlayer::Announce(HSQUIRRELVM vm)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
const Int32 top = sq_gettop(vm);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the announcement value specified?
|
2015-11-09 02:29:04 +01:00
|
|
|
if (top <= 1)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing announcement value");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// The player instance
|
|
|
|
CPlayer * player = nullptr;
|
|
|
|
// Attempt to extract the argument values
|
|
|
|
try
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
player = Var< CPlayer * >(vm, 1).value;
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
catch (const Sqrat::Exception & e)
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Propagate the error
|
|
|
|
return sq_throwerror(vm, e.Message().c_str());
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player instance?
|
|
|
|
if (!player)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player instance");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player identifier?
|
|
|
|
else if (!player->IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player reference");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have enough values to call the format function?
|
2015-11-09 02:29:04 +01:00
|
|
|
else if (top > 2)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
SStr msg = NULL;
|
2015-11-09 02:29:04 +01:00
|
|
|
SQInteger len = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Attempt to generate the specified string format
|
|
|
|
SQRESULT ret = sqstd_format(vm, 2, &len, &msg);
|
|
|
|
// Did the format failed?
|
|
|
|
if (SQ_FAILED(ret))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return ret; // Propagate the exception
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted announcement string
|
|
|
|
_Func->SendGameMessage(player->GetID(),
|
|
|
|
_Core->GetPlayer(player->GetID()).mAnnounceStyle, "%s", msg);
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
|
|
|
else
|
2016-03-10 04:57:13 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the value from the stack as a string
|
|
|
|
Var< CSStr > msg(vm, 2);
|
|
|
|
// See if the obtained value is a valid announcement
|
|
|
|
if (!msg.value)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Unable to retrieve the announcement");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted announcement string
|
|
|
|
_Func->SendGameMessage(player->GetID(),
|
|
|
|
_Core->GetPlayer(player->GetID()).mAnnounceStyle, "%s", msg.value);
|
|
|
|
}
|
|
|
|
// This function does not return a value
|
2015-11-09 02:29:04 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CPlayer::AnnounceEx(HSQUIRRELVM vm)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
const Int32 top = sq_gettop(vm);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the announcement style specified?
|
2015-11-09 02:29:04 +01:00
|
|
|
if (top <= 1)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing announcement style");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Was the announcement value specified?
|
|
|
|
else if (top <= 2)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Missing announcement value");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// The player instance
|
|
|
|
CPlayer * player = nullptr;
|
|
|
|
// The announcement style
|
|
|
|
Int32 style;
|
|
|
|
// style to extract the argument values
|
|
|
|
try
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
player = Var< CPlayer * >(vm, 1).value;
|
|
|
|
style = Var< Int32 >(vm, 2).value;
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
catch (const Sqrat::Exception & e)
|
2015-11-09 02:29:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Propagate the error
|
|
|
|
return sq_throwerror(vm, e.Message().c_str());
|
2015-11-09 02:29:04 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player instance?
|
|
|
|
if (!player)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player instance");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have a valid player identifier?
|
|
|
|
else if (!player->IsActive())
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Invalid player reference");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Do we have enough values to call the format function?
|
2015-11-09 02:29:04 +01:00
|
|
|
else if (top > 3)
|
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
SStr msg = NULL;
|
2015-11-09 02:29:04 +01:00
|
|
|
SQInteger len = 0;
|
2016-03-10 04:57:13 +01:00
|
|
|
// Attempt to generate the specified string format
|
|
|
|
SQRESULT ret = sqstd_format(vm, 3, &len, &msg);
|
|
|
|
// Did the format failed?
|
|
|
|
if (SQ_FAILED(ret))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return ret; // Propagate the exception
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted announcement string
|
|
|
|
_Func->SendGameMessage(player->GetID(), style, "%s", msg);
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
else
|
2016-03-10 04:57:13 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the value from the stack as a string
|
|
|
|
Var< CSStr > msg(vm, 3);
|
|
|
|
// See if the obtained value is a valid announcement
|
|
|
|
if (!msg.value)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return sq_throwerror(vm, "Unable to retrieve the announcement");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 04:57:13 +01:00
|
|
|
// Send the resulted announcement string
|
|
|
|
_Func->SendGameMessage(player->GetID(), style, "%s", msg.value);
|
|
|
|
}
|
|
|
|
// This function does not return a value
|
2016-02-20 23:25:00 +01:00
|
|
|
return 0;
|
2015-11-09 04:54:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 05:18:39 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
static const Object & Player_FindByID(Int32 id)
|
|
|
|
{
|
|
|
|
// Perform a range check on the specified identifier
|
|
|
|
if (INVALID_ENTITYEX(id, SQMOD_PLAYER_POOL))
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("The specified player identifier is invalid: %d", id);
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 05:18:39 +01:00
|
|
|
// Obtain the ends of the entity pool
|
|
|
|
Core::Players::const_iterator itr = _Core->GetPlayers().cbegin();
|
|
|
|
Core::Players::const_iterator end = _Core->GetPlayers().cend();
|
|
|
|
// Process each entity in the pool
|
|
|
|
for (; itr != end; ++itr)
|
|
|
|
{
|
|
|
|
// Does the identifier match the specified one?
|
|
|
|
if (itr->mID == id)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 05:18:39 +01:00
|
|
|
return itr->mObj; // Stop searching and return this entity
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 05:18:39 +01:00
|
|
|
}
|
|
|
|
// Unable to locate a player matching the specified identifier
|
|
|
|
return NullObject();
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Object & Player_FindByTag(CSStr tag)
|
|
|
|
{
|
|
|
|
// Perform a validity check on the specified tag
|
2016-03-12 21:51:44 +01:00
|
|
|
if (!tag || *tag == '\0')
|
|
|
|
{
|
2016-03-21 21:37:58 +01:00
|
|
|
STHROWF("The specified player tag is invalid: null/empty");
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 05:18:39 +01:00
|
|
|
// Obtain the ends of the entity pool
|
|
|
|
Core::Players::const_iterator itr = _Core->GetPlayers().cbegin();
|
|
|
|
Core::Players::const_iterator end = _Core->GetPlayers().cend();
|
|
|
|
// Process each entity in the pool
|
|
|
|
for (; itr != end; ++itr)
|
|
|
|
{
|
|
|
|
// Does this entity even exist and does the tag match the specified one?
|
|
|
|
if (itr->mInst != nullptr && itr->mInst->GetTag().compare(tag) == 0)
|
2016-03-12 21:51:44 +01:00
|
|
|
{
|
2016-03-10 05:18:39 +01:00
|
|
|
return itr->mObj; // Stop searching and return this entity
|
2016-03-12 21:51:44 +01:00
|
|
|
}
|
2016-03-10 05:18:39 +01:00
|
|
|
}
|
|
|
|
// Unable to locate a player matching the specified tag
|
|
|
|
return NullObject();
|
|
|
|
}
|
|
|
|
|
2015-10-29 21:11:30 +01:00
|
|
|
// ================================================================================================
|
2016-02-20 23:25:00 +01:00
|
|
|
void Register_CPlayer(HSQUIRRELVM vm)
|
|
|
|
{
|
|
|
|
RootTable(vm).Bind(_SC("SqPlayer"),
|
|
|
|
Class< CPlayer, NoConstructor< CPlayer > >(vm, _SC("SqPlayer"))
|
2016-03-10 04:57:13 +01:00
|
|
|
// Metamethods
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("_cmp"), &CPlayer::Cmp)
|
2016-03-10 04:57:13 +01:00
|
|
|
.SquirrelFunc(_SC("_typename"), &CPlayer::Typename)
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("_tostring"), &CPlayer::ToString)
|
2016-03-10 05:18:39 +01:00
|
|
|
// Static Values
|
2016-03-10 04:57:13 +01:00
|
|
|
.SetStaticValue(_SC("MaxID"), CPlayer::Max)
|
|
|
|
// Core Properties
|
2016-02-20 23:25:00 +01:00
|
|
|
.Prop(_SC("ID"), &CPlayer::GetID)
|
|
|
|
.Prop(_SC("Tag"), &CPlayer::GetTag, &CPlayer::SetTag)
|
|
|
|
.Prop(_SC("Data"), &CPlayer::GetData, &CPlayer::SetData)
|
|
|
|
.Prop(_SC("Active"), &CPlayer::IsActive)
|
2016-03-10 05:18:39 +01:00
|
|
|
// Core Methods
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("Bind"), &CPlayer::BindEvent)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Properties
|
|
|
|
.Prop(_SC("Class"), &CPlayer::GetClass)
|
2016-02-20 23:25:00 +01:00
|
|
|
.Prop(_SC("Admin"), &CPlayer::GetAdmin, &CPlayer::SetAdmin)
|
|
|
|
.Prop(_SC("IP"), &CPlayer::GetIP)
|
|
|
|
.Prop(_SC("Connected"), &CPlayer::IsConnected)
|
|
|
|
.Prop(_SC("Spawned"), &CPlayer::IsSpawned)
|
|
|
|
.Prop(_SC("Key"), &CPlayer::GetKey)
|
|
|
|
.Prop(_SC("World"), &CPlayer::GetWorld, &CPlayer::SetWorld)
|
|
|
|
.Prop(_SC("SecWorld"), &CPlayer::GetSecWorld, &CPlayer::SetSecWorld)
|
|
|
|
.Prop(_SC("UniqueWorld"), &CPlayer::GetUniqueWorld)
|
|
|
|
.Prop(_SC("State"), &CPlayer::GetState)
|
|
|
|
.Prop(_SC("Action"), &CPlayer::GetAction)
|
|
|
|
.Prop(_SC("Name"), &CPlayer::GetName, &CPlayer::SetName)
|
|
|
|
.Prop(_SC("Team"), &CPlayer::GetTeam, &CPlayer::SetTeam)
|
|
|
|
.Prop(_SC("Skin"), &CPlayer::GetSkin, &CPlayer::SetSkin)
|
|
|
|
.Prop(_SC("Color"), &CPlayer::GetColor, &CPlayer::SetColor)
|
|
|
|
.Prop(_SC("Money"), &CPlayer::GetMoney, &CPlayer::SetMoney)
|
|
|
|
.Prop(_SC("Score"), &CPlayer::GetScore, &CPlayer::SetScore)
|
|
|
|
.Prop(_SC("Ping"), &CPlayer::GetPing)
|
|
|
|
.Prop(_SC("FPS"), &CPlayer::GetFPS)
|
|
|
|
.Prop(_SC("Typing"), &CPlayer::IsTyping)
|
|
|
|
.Prop(_SC("UID"), &CPlayer::GetUID)
|
|
|
|
.Prop(_SC("UID2"), &CPlayer::GetUID2)
|
|
|
|
.Prop(_SC("Health"), &CPlayer::GetHealth, &CPlayer::SetHealth)
|
2016-03-10 04:57:13 +01:00
|
|
|
.Prop(_SC("Armor"), &CPlayer::GetArmor, &CPlayer::SetArmor)
|
2016-02-20 23:25:00 +01:00
|
|
|
.Prop(_SC("Immunity"), &CPlayer::GetImmunity, &CPlayer::SetImmunity)
|
|
|
|
.Prop(_SC("Pos"), &CPlayer::GetPosition, &CPlayer::SetPosition)
|
|
|
|
.Prop(_SC("Position"), &CPlayer::GetPosition, &CPlayer::SetPosition)
|
|
|
|
.Prop(_SC("Speed"), &CPlayer::GetSpeed, &CPlayer::SetSpeed)
|
|
|
|
.Prop(_SC("Angle"), &CPlayer::GetHeading, &CPlayer::SetHeading)
|
|
|
|
.Prop(_SC("Heading"), &CPlayer::GetHeading, &CPlayer::SetHeading)
|
|
|
|
.Prop(_SC("Alpha"), &CPlayer::GetAlpha, &CPlayer::SetAlpha)
|
|
|
|
.Prop(_SC("VehicleStatus"), &CPlayer::GetVehicleStatus)
|
|
|
|
.Prop(_SC("Slot"), &CPlayer::GetOccupiedSlot)
|
|
|
|
.Prop(_SC("Vehicle"), &CPlayer::GetVehicle)
|
|
|
|
.Prop(_SC("VehicleID"), &CPlayer::GetVehicleID)
|
|
|
|
.Prop(_SC("Controllable"), &CPlayer::GetControllable, &CPlayer::SetControllable)
|
|
|
|
.Prop(_SC("Driveby"), &CPlayer::GetDriveby, &CPlayer::SetDriveby)
|
|
|
|
.Prop(_SC("WhiteScanlines"), &CPlayer::GetWhiteScanlines, &CPlayer::SetWhiteScanlines)
|
|
|
|
.Prop(_SC("GreenScanlines"), &CPlayer::GetGreenScanlines, &CPlayer::SetGreenScanlines)
|
|
|
|
.Prop(_SC("Widescreen"), &CPlayer::GetWidescreen, &CPlayer::SetWidescreen)
|
|
|
|
.Prop(_SC("ShowMarkers"), &CPlayer::GetShowMarkers, &CPlayer::SetShowMarkers)
|
|
|
|
.Prop(_SC("AttackPriv"), &CPlayer::GetAttackPriv, &CPlayer::SetAttackPriv)
|
|
|
|
.Prop(_SC("HasMarker"), &CPlayer::GetHasMarker, &CPlayer::SetHasMarker)
|
|
|
|
.Prop(_SC("ChatTags"), &CPlayer::GetChatTags, &CPlayer::SetChatTags)
|
|
|
|
.Prop(_SC("DrunkEffects"), &CPlayer::GetDrunkEffects, &CPlayer::SetDrunkEffects)
|
|
|
|
.Prop(_SC("Weapon"), &CPlayer::GetWeapon, &CPlayer::SetWeapon)
|
|
|
|
.Prop(_SC("CameraLocked"), &CPlayer::IsCameraLocked)
|
|
|
|
.Prop(_SC("WantedLevel"), &CPlayer::GetWantedLevel, &CPlayer::SetWantedLevel)
|
|
|
|
.Prop(_SC("TouchedVehicle"), &CPlayer::StandingOnVehicle)
|
|
|
|
.Prop(_SC("TouchedObject"), &CPlayer::StandingOnObject)
|
|
|
|
.Prop(_SC("Away"), &CPlayer::IsAway)
|
|
|
|
.Prop(_SC("Spectating"), &CPlayer::GetSpectator)
|
|
|
|
.Prop(_SC("Spec"), &CPlayer::GetSpectator, &CPlayer::SetSpectator)
|
|
|
|
.Prop(_SC("Crouched"), &CPlayer::IsCrouched)
|
|
|
|
.Prop(_SC("GameKeys"), &CPlayer::GetGameKeys)
|
|
|
|
.Prop(_SC("AimPos"), &CPlayer::GetAimPos)
|
|
|
|
.Prop(_SC("AimPosition"), &CPlayer::GetAimPos)
|
|
|
|
.Prop(_SC("AimDir"), &CPlayer::GetAimDir)
|
|
|
|
.Prop(_SC("AimDirection"), &CPlayer::GetAimDir)
|
|
|
|
.Prop(_SC("Authority"), &CPlayer::GetAuthority, &CPlayer::SetAuthority)
|
|
|
|
.Prop(_SC("MessageColor"), &CPlayer::GetMessageColor, &CPlayer::SetMessageColor)
|
|
|
|
.Prop(_SC("AnnounceStyle"), &CPlayer::GetAnnounceStyle, &CPlayer::SetAnnounceStyle)
|
|
|
|
.Prop(_SC("X"), &CPlayer::GetPosX, &CPlayer::SetPosX)
|
|
|
|
.Prop(_SC("Y"), &CPlayer::GetPosY, &CPlayer::SetPosY)
|
|
|
|
.Prop(_SC("Z"), &CPlayer::GetPosZ, &CPlayer::SetPosZ)
|
2016-03-10 05:18:39 +01:00
|
|
|
// Member Methods
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("StreamedFor"), &CPlayer::IsStreamedFor)
|
|
|
|
.Func(_SC("Kick"), &CPlayer::Kick)
|
|
|
|
.Func(_SC("Ban"), &CPlayer::Ban)
|
|
|
|
.Func(_SC("WorldCompatible"), &CPlayer::IsWorldCompatible)
|
|
|
|
.Func(_SC("SetColor"), &CPlayer::SetColorEx)
|
|
|
|
.Func(_SC("Spawn"), &CPlayer::ForceSpawn)
|
|
|
|
.Func(_SC("Select"), &CPlayer::ForceSelect)
|
|
|
|
.Func(_SC("GiveMoney"), &CPlayer::GiveMoney)
|
|
|
|
.Func(_SC("SetPosition"), &CPlayer::SetPositionEx)
|
|
|
|
.Func(_SC("SetPos"), &CPlayer::SetPositionEx)
|
|
|
|
.Func(_SC("SetSpeed"), &CPlayer::SetSpeedEx)
|
|
|
|
.Func(_SC("SetWeapon"), &CPlayer::SetWeapon)
|
|
|
|
.Func(_SC("GiveWeapon"), &CPlayer::GiveWeapon)
|
|
|
|
.Func(_SC("StripWeapons"), &CPlayer::StripWeapons)
|
|
|
|
.Func(_SC("RestoreCamera"), &CPlayer::RestoreCamera)
|
|
|
|
.Func(_SC("SetAnim"), &CPlayer::SetAnimation)
|
|
|
|
.Func(_SC("Animation"), &CPlayer::SetAnimation)
|
|
|
|
.Func(_SC("Spectate"), &CPlayer::SetSpectator)
|
|
|
|
.Func(_SC("Disembark"), &CPlayer::Disembark)
|
|
|
|
.Func(_SC("Redirect"), &CPlayer::Redirect)
|
|
|
|
.Func(_SC("GetMsgPrefix"), &CPlayer::GetMessagePrefix)
|
|
|
|
.Func(_SC("SetMsgPrefix"), &CPlayer::SetMessagePrefix)
|
2016-03-10 05:18:39 +01:00
|
|
|
// Raw Methods
|
2016-02-20 23:25:00 +01:00
|
|
|
.SquirrelFunc(_SC("Msg"), &CPlayer::Msg)
|
|
|
|
.SquirrelFunc(_SC("MsgP"), &CPlayer::MsgP)
|
|
|
|
.SquirrelFunc(_SC("MsgEx"), &CPlayer::MsgEx)
|
|
|
|
.SquirrelFunc(_SC("Message"), &CPlayer::Message)
|
|
|
|
.SquirrelFunc(_SC("Announce"), &CPlayer::Announce)
|
|
|
|
.SquirrelFunc(_SC("AnnounceEx"), &CPlayer::AnnounceEx)
|
|
|
|
.SquirrelFunc(_SC("Text"), &CPlayer::Announce)
|
|
|
|
.SquirrelFunc(_SC("TextEx"), &CPlayer::AnnounceEx)
|
2016-03-10 05:18:39 +01:00
|
|
|
// Member Overloads
|
2015-10-29 21:11:30 +01:00
|
|
|
.Overload< void (CPlayer::*)(const Vector3 &) const >
|
2016-02-20 23:25:00 +01:00
|
|
|
(_SC("AddSpeed"), &CPlayer::AddSpeed)
|
|
|
|
.Overload< void (CPlayer::*)(Float32, Float32, Float32) const >
|
|
|
|
(_SC("AddSpeed"), &CPlayer::AddSpeedEx)
|
2015-11-11 08:02:42 +01:00
|
|
|
.Overload< void (CPlayer::*)(const Vector3 &, const Vector3 &) const >
|
2016-02-20 23:25:00 +01:00
|
|
|
(_SC("CameraPosition"), &CPlayer::SetCameraPosition)
|
|
|
|
.Overload< void (CPlayer::*)(Float32, Float32, Float32, Float32, Float32, Float32) const >
|
|
|
|
(_SC("CameraPosition"), &CPlayer::SetCameraPosition)
|
|
|
|
.Overload< void (CPlayer::*)(CVehicle &) const >
|
|
|
|
(_SC("Embark"), &CPlayer::Embark)
|
|
|
|
.Overload< void (CPlayer::*)(CVehicle &, SQInt32, bool, bool) const >
|
|
|
|
(_SC("Embark"), &CPlayer::Embark)
|
2016-03-10 05:18:39 +01:00
|
|
|
// Static Functions
|
|
|
|
.StaticFunc(_SC("FindByID"), &Player_FindByID)
|
|
|
|
.StaticFunc(_SC("FindByTag"), &Player_FindByTag)
|
2015-09-30 02:56:11 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|