[server] Implement/match n_SetSpawnInfo(...)

This commit is contained in:
RD42 2024-09-15 23:22:20 +08:00
parent 0b15ccfb87
commit 50997f9f03
2 changed files with 41 additions and 4 deletions

View File

@ -5,7 +5,13 @@
#pragma pack(1)
typedef struct _PLAYER_SPAWN_INFO
{
char _pad0[46];
BYTE byteTeam;
int iSkin;
BYTE field_5;
VECTOR vecPos;
float fRotation;
int iSpawnWeapons[3];
int iSpawnWeaponsAmmo[3];
} PLAYER_SPAWN_INFO;
//----------------------------------------------------
@ -16,7 +22,11 @@ class CPlayer
public:
// Size: 11486
char _pad0[11261];
char _pad0[10509];
BOOL field_290D;
char _pad2911[748];
PLAYER_SPAWN_INFO m_SpawnInfo;
BOOL m_bHasSpawnInfo;

View File

@ -826,9 +826,36 @@ static cell AMX_NATIVE_CALL n_NetStats_GetIpPort(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL n_SetSpawnInfo(AMX *amx, cell *params)
{
// TODO: SetSpawnInfo
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
if(!pPlayerPool) return 0;
CPlayer *pPlayer = pPlayerPool->GetAt((PLAYERID)params[1]);
if (pPlayer)
{
PLAYER_SPAWN_INFO SpawnInfo;
SpawnInfo.byteTeam = (BYTE)params[2];
SpawnInfo.iSkin = (int)params[3];
SpawnInfo.vecPos.X = amx_ctof(params[4]);
SpawnInfo.vecPos.Y = amx_ctof(params[5]);
SpawnInfo.vecPos.Z = amx_ctof(params[6]);
SpawnInfo.fRotation = amx_ctof(params[7]);
SpawnInfo.iSpawnWeapons[0] = (int)params[8];
SpawnInfo.iSpawnWeaponsAmmo[0] = (int)params[9];
SpawnInfo.iSpawnWeapons[1] = (int)params[10];
SpawnInfo.iSpawnWeaponsAmmo[1] = (int)params[11];
SpawnInfo.iSpawnWeapons[2] = (int)params[12];
SpawnInfo.iSpawnWeaponsAmmo[2] = (int)params[13];
pPlayer->SetSpawnInfo(&SpawnInfo);
pPlayer->field_290D = TRUE;
RakNet::BitStream bsData;
bsData.Write((PCHAR)&SpawnInfo, sizeof(PLAYER_SPAWN_INFO));
pNetGame->SendToPlayer(RPC_ScrSetSpawnInfo, &bsData, (PLAYERID)params[1], 2);
return 1;
} else {
return 0;
}
}
static cell AMX_NATIVE_CALL n_SpawnPlayer(AMX *amx, cell *params)
{