mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[bot] Implement WorldVehicleAdd(...)
This commit is contained in:
parent
a94fbc924b
commit
d9976bb678
@ -247,9 +247,25 @@ void WorldPlayerRemove(RPCParameters *rpcParams)
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void UnkA4(RPCParameters *rpcParams)
|
||||
void WorldVehicleAdd(RPCParameters *rpcParams)
|
||||
{
|
||||
// TODO: UnkA4
|
||||
PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
|
||||
int iBitLength = rpcParams->numberOfBitsOfData;
|
||||
PlayerID sender = rpcParams->sender;
|
||||
|
||||
RakNet::BitStream bsData(Data,(iBitLength/8)+1,false);
|
||||
CVehiclePool *pVehiclePool = pNetGame->GetVehiclePool();
|
||||
if(!pVehiclePool) return;
|
||||
|
||||
NEW_VEHICLE NewVehicle;
|
||||
|
||||
bsData.Read((char *)&NewVehicle,sizeof(NEW_VEHICLE));
|
||||
|
||||
pNetGame->GetVehiclePool()->New(&NewVehicle);
|
||||
|
||||
if(pNetGame->GetBotMode()) {
|
||||
pNetGame->GetBotMode()->OnVehicleStreamIn(NewVehicle.VehicleId);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
@ -513,9 +529,9 @@ void RegisterRPCs(RakClientInterface * pRakClient)
|
||||
REGISTER_STATIC_RPC(pRakClient,RequestClass);
|
||||
REGISTER_STATIC_RPC(pRakClient,RequestSpawn);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
|
||||
REGISTER_STATIC_RPC(pRakClient,UnkA4);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldPlayerDeath);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldPlayerRemove);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldVehicleAdd);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldVehicleRemove);
|
||||
}
|
||||
|
||||
@ -543,9 +559,9 @@ void UnRegisterRPCs(RakClientInterface * pRakClient)
|
||||
UNREGISTER_STATIC_RPC(pRakClient,Unk1D);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,Unk1E);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,UnkA4);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerDeath);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerRemove);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldVehicleAdd);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldVehicleRemove);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,ServerJoin);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,ServerQuit);
|
||||
|
@ -23,6 +23,33 @@ CVehiclePool::~CVehiclePool()
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
BOOL CVehiclePool::New(NEW_VEHICLE *pNewVehicle)
|
||||
{
|
||||
if(pNewVehicle->VehicleId < MAX_VEHICLES)
|
||||
{
|
||||
memset(&m_SpawnInfo[pNewVehicle->VehicleId],0,sizeof(VEHICLE_SPAWN_INFO));
|
||||
|
||||
// Setup the spawninfo for the next respawn.
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_0 = pNewVehicle->field_2;
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_4 = pNewVehicle->field_6;
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_8 = pNewVehicle->field_6;
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_C = pNewVehicle->field_6;
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_10 = pNewVehicle->field_12;
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_14 = pNewVehicle->field_16;
|
||||
m_SpawnInfo[pNewVehicle->VehicleId].field_18 = pNewVehicle->field_17;
|
||||
|
||||
pNetGame->SetVehicleAdded(pNewVehicle->VehicleId, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
BOOL CVehiclePool::Delete(VEHICLEID VehicleID)
|
||||
{
|
||||
pNetGame->SetVehicleAdded(VehicleID, FALSE);
|
||||
|
@ -1,14 +1,52 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NEW_VEHICLE {
|
||||
VEHICLEID VehicleId;
|
||||
int field_2;
|
||||
int field_6;
|
||||
|
||||
char _gapA[8];
|
||||
|
||||
int field_12;
|
||||
char field_16;
|
||||
char field_17;
|
||||
|
||||
char _gap18[16];
|
||||
|
||||
} NEW_VEHICLE;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _VEHICLE_SPAWN_INFO
|
||||
{
|
||||
int field_0;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int field_14;
|
||||
int field_18;
|
||||
|
||||
char _gap1C[8];
|
||||
|
||||
} VEHICLE_SPAWN_INFO;
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
class CVehiclePool // size: 114000
|
||||
{
|
||||
private:
|
||||
char _gap0[34000];
|
||||
int field_84D0[2000];
|
||||
char _gapA410[72000];
|
||||
VEHICLE_SPAWN_INFO m_SpawnInfo[MAX_VEHICLES];
|
||||
|
||||
public:
|
||||
|
||||
CVehiclePool();
|
||||
~CVehiclePool();
|
||||
|
||||
BOOL New(NEW_VEHICLE *pNewVehicle);
|
||||
|
||||
BOOL Delete(VEHICLEID VehicleID);
|
||||
};
|
||||
|
@ -36,10 +36,10 @@
|
||||
#define RPC_Unk1D "\x1D"
|
||||
#define RPC_Unk1E "\x1E"
|
||||
#define RPC_Unk3C "\x3C"
|
||||
#define RPC_UnkA4 "\xA4"
|
||||
#define RPC_WorldPlayerAdd "\x20"
|
||||
#define RPC_WorldPlayerDeath "\xA6"
|
||||
#define RPC_WorldPlayerRemove "\xA3"
|
||||
#define RPC_WorldVehicleAdd "\xA4"
|
||||
#define RPC_WorldVehicleRemove "\xA5"
|
||||
#define RPC_DamageVehicle "\x6A"
|
||||
#define RPC_Unk18 "\x18"
|
||||
|
@ -25,10 +25,10 @@ void Weather(RPCParameters *rpcParams) {}
|
||||
void Unk1D(RPCParameters *rpcParams) {}
|
||||
void Unk1E(RPCParameters *rpcParams) {}
|
||||
void Unk3C(RPCParameters *rpcParams) {}
|
||||
void UnkA4(RPCParameters *rpcParams) {}
|
||||
void WorldPlayerAdd(RPCParameters *rpcParams) {}
|
||||
void WorldPlayerDeath(RPCParameters *rpcParams) {}
|
||||
void WorldPlayerRemove(RPCParameters *rpcParams) {}
|
||||
void WorldVehicleAdd(RPCParameters *rpcParams) {}
|
||||
void WorldVehicleRemove(RPCParameters *rpcParams) {}
|
||||
void DamageVehicle(RPCParameters *rpcParams) {}
|
||||
void Unk18(RPCParameters *rpcParams) {}
|
||||
@ -76,10 +76,10 @@ void RegisterRPCs(RakClientInterface * pRakClient)
|
||||
REGISTER_STATIC_RPC(pRakClient,Unk1D);
|
||||
REGISTER_STATIC_RPC(pRakClient,Unk1E);
|
||||
REGISTER_STATIC_RPC(pRakClient,Unk3C);
|
||||
REGISTER_STATIC_RPC(pRakClient,UnkA4);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldPlayerDeath);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldPlayerRemove);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldVehicleAdd);
|
||||
REGISTER_STATIC_RPC(pRakClient,WorldVehicleRemove);
|
||||
REGISTER_STATIC_RPC(pRakClient,DamageVehicle);
|
||||
REGISTER_STATIC_RPC(pRakClient,Unk18);
|
||||
@ -106,10 +106,10 @@ void RegisterRPCs(RakClientInterface * pRakClient)
|
||||
void UnRegisterRPCs(RakClientInterface * pRakClient)
|
||||
{
|
||||
UNREGISTER_STATIC_RPC(pRakClient,Unk3C);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,UnkA4);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerDeath);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerRemove);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldVehicleAdd);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,WorldVehicleRemove);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,Unk18);
|
||||
UNREGISTER_STATIC_RPC(pRakClient,RequestClass);
|
||||
|
Loading…
Reference in New Issue
Block a user