Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/CCallbackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,20 @@ void CCallbackManager::OnPlayerClientGameInit(WORD playerid, bool* usecjwalk, bo
}
}
}

void CCallbackManager::OnClientCheckResponse(WORD playerid, BYTE type, DWORD arg, BYTE response)
{
int idx = -1;
cell ret = 1;
for (std::vector<AMX*>::const_iterator iter = m_vecAMX.begin(); iter != m_vecAMX.end(); ++iter) {
if (!amx_FindPublic(*iter, "OnClientCheckResponse", &idx)) {
amx_Push(*iter, static_cast<cell>(response));
amx_Push(*iter, static_cast<cell>(arg));
amx_Push(*iter, static_cast<cell>(type));
amx_Push(*iter, static_cast<cell>(playerid));

amx_Exec(*iter, &ret, idx);
if (ret) break;
}
}
}
1 change: 1 addition & 0 deletions src/CCallbackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CCallbackManager
static void OnVehicleSpawn(WORD vehicleid);
static void OnPlayerPickedUpPickup(WORD playerid, WORD pickupid);
static void OnPlayerPickedUpPlayerPickup(WORD playerid, WORD pickupid);
static void OnClientCheckResponse(WORD playerid, WORD pickupid);


static std::vector<AMX *> m_vecAMX;
Expand Down
18 changes: 18 additions & 0 deletions src/RPCs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ int RPC_ScrApplyAnimation = 0x56;
int RPC_ClientMessage = 0x5D;
int RPC_ScrDisplayGameText = 0x49;
int RPC_Chat = 0x65;
int RPC_ClientCheck = 103;

int RPC_UpdateScoresPingsIPs = 0x9B;
int RPC_PickedUpPickup = 0x83;
Expand Down Expand Up @@ -212,6 +213,20 @@ void PickedUpPickup(RPCParameters* rpcParams)
#endif
}

void ClientCheck(RPCParameters* rpcParams)
{
WORD playerid = static_cast<WORD>(pRakServer->GetIndexFromPlayerID(rpcParams->sender));
DWORD arg;
BYTE type, response;

RakNet::BitStream bsData(rpcParams->input, rpcParams->numberOfBitsOfData / 8, false);
bsData.Read(type);
bsData.Read(arg);
bsData.Read(response);

CCallbackManager::OnClientCheckResponse(playerid, type, arg, response);
}

void InitRPCs()
{
pRakServer->UnregisterAsRemoteProcedureCall(&RPC_UpdateScoresPingsIPs);
Expand All @@ -225,4 +240,7 @@ void InitRPCs()

pRakServer->UnregisterAsRemoteProcedureCall(&RPC_PickedUpPickup);
pRakServer->RegisterAsRemoteProcedureCall(&RPC_PickedUpPickup, PickedUpPickup);

pRakServer->UnregisterAsRemoteProcedureCall(&RPC_ClientCheck);
pRakServer->RegisterAsRemoteProcedureCall(&RPC_ClientCheck, ClientCheck);
}
1 change: 1 addition & 0 deletions src/RPCs.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extern int RPC_ScrApplyAnimation;
extern int RPC_ClientMessage;
extern int RPC_ScrDisplayGameText;
extern int RPC_Chat;
extern int RPC_ClientCheck;

extern int RPC_UpdateScoresPingsIPs;
extern int RPC_PickedUpPickup;
Expand Down