[bot] Implement n_SendChat(...)

* Implement `CNetGame::SendChat(...)`
This commit is contained in:
RD42 2024-06-29 22:45:28 +08:00
parent 5d75008e6d
commit db20065e56
3 changed files with 18 additions and 2 deletions

View File

@ -578,6 +578,17 @@ void CNetGame::SetVehicleAdded(VEHICLEID VehicleID, BOOL a2)
}
}
void CNetGame::SendChat(char *szText)
{
BYTE byteTextLen = strlen(szText);
RakNet::BitStream bsSend;
bsSend.Write(byteTextLen);
bsSend.Write(szText,byteTextLen);
GetRakClient()->RPC(RPC_Chat,&bsSend,HIGH_PRIORITY,RELIABLE,0,false);
}
void CNetGame::StopRecordingPlayback()
{
field_1DE = 0;

View File

@ -98,6 +98,8 @@ public:
void ResetPlayerPool();
void ShutdownForGameModeRestart();
void SendChat(char *szText);
BOOL IsPlayerAdded(PLAYERID playerId);
void SetMyZAngle(float fAngle);

View File

@ -115,8 +115,11 @@ static cell AMX_NATIVE_CALL n_ResumeRecordingPlayback(AMX *amx, cell *params)
// native SendChat(msg[])
static cell AMX_NATIVE_CALL n_SendChat(AMX *amx, cell *params)
{
// TODO: n_SendChat
return 0;
char* szMessage;
amx_StrParam(amx, params[1], szMessage);
if(pNetGame)
pNetGame->SendChat(szMessage);
return 1;
}
// native SendCommand(commandtext[])