[bot] Implement n_SendCommand(...)

* Implement `CNetGame::SendCommand(...)`
This commit is contained in:
RD42 2024-06-29 22:47:25 +08:00
parent db20065e56
commit 08e445569c
3 changed files with 16 additions and 2 deletions

View File

@ -589,6 +589,16 @@ void CNetGame::SendChat(char *szText)
GetRakClient()->RPC(RPC_Chat,&bsSend,HIGH_PRIORITY,RELIABLE,0,false);
}
void CNetGame::SendCommand(char *szCommand)
{
RakNet::BitStream bsParams;
int iStrlen = strlen(szCommand);
bsParams.Write(iStrlen);
bsParams.Write(szCommand, iStrlen);
GetRakClient()->RPC(RPC_ServerCommand,&bsParams,HIGH_PRIORITY,RELIABLE,0,false);
}
void CNetGame::StopRecordingPlayback()
{
field_1DE = 0;

View File

@ -99,6 +99,7 @@ public:
void ShutdownForGameModeRestart();
void SendChat(char *szText);
void SendCommand(char *szCommand);
BOOL IsPlayerAdded(PLAYERID playerId);
void SetMyZAngle(float fAngle);

View File

@ -125,8 +125,11 @@ static cell AMX_NATIVE_CALL n_SendChat(AMX *amx, cell *params)
// native SendCommand(commandtext[])
static cell AMX_NATIVE_CALL n_SendCommand(AMX *amx, cell *params)
{
// TODO: n_SendCommand
return 0;
char* szCommand;
amx_StrParam(amx, params[1], szCommand);
if(pNetGame)
pNetGame->SendCommand(szCommand);
return 1;
}
// native GetPlayerState(playerid)