[server] Implement CGameMode functions

This commit is contained in:
RD42 2024-04-12 22:00:55 +08:00
parent ccaba5e18e
commit 5d5702b8c0
6 changed files with 1253 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,63 @@ public:
int CallPublic(char* szFuncName);
int OnPlayerConnect(cell playerid);
int OnPlayerDisconnect(cell playerid, cell reason);
int OnPlayerSpawn(cell playerid);
int OnPlayerDeath(cell playerid, cell killerid, cell reason);
int OnVehicleSpawn(cell vehicleid);
int OnVehicleDeath(cell vehicleid, cell killerid);
int OnPlayerText(cell playerid, unsigned char * szText);
int OnPlayerCommandText(cell playerid, unsigned char * szCommandText);
int OnPlayerInfoChange(cell playerid);
int OnPlayerRequestClass(cell playerid, cell classid);
int OnPlayerRequestSpawn(cell playerid);
int OnPlayerEnterVehicle(cell playerid, cell vehicleid, cell ispassenger);
int OnPlayerExitVehicle(cell playerid, cell vehicleid);
int OnPlayerStateChange(cell playerid, cell newstate, cell oldstate);
int OnPlayerEnterCheckpoint(cell playerid);
int OnPlayerLeaveCheckpoint(cell playerid);
int OnPlayerEnterRaceCheckpoint(cell playerid);
int OnPlayerLeaveRaceCheckpoint(cell playerid);
int OnRconCommand(char* szCommand);
int OnObjectMoved(cell objectid);
int OnPlayerObjectMoved(cell playerid, cell objectid);
int OnPlayerPickedUpPickup(cell playerid, cell pickupid);
int OnPlayerExitedMenu(cell playerid);
int OnPlayerSelectedMenuRow(cell playerid, cell row);
int OnVehicleRespray(cell playerid, cell vehicleid, cell color1, cell color2);
int OnVehicleMod(cell playerid, cell vehicleid, cell componentid);
int OnEnterExitModShop(cell playerid, cell enterexit, cell interiorid);
int OnVehiclePaintjob(cell playerid, cell vehicleid, cell paintjobid);
int OnPlayerInteriorChange(cell playerid, cell newid, cell oldid);
int OnPlayerKeyStateChange(cell playerid, cell newkeys, cell oldkeys);
int OnScriptCash(cell playerid, cell amount, cell type);
int OnRconLoginAttempt(char *szIP, char *szPassword, cell success);
int OnPlayerUpdate(cell playerid);
int OnPlayerStreamIn(cell playerid, cell forplayerid);
int OnPlayerStreamOut(cell playerid, cell forplayerid);
int OnVehicleStreamIn(cell vehicleid, cell forplayerid);
int OnVehicleStreamOut(cell vehicleid, cell forplayerid);
int OnActorStreamIn(cell actorid, cell forplayerid);
int OnActorStreamOut(cell actorid, cell forplayerid);
int OnDialogResponse(cell playerid, cell dialogid, cell response, cell listitem, char *szInputText);
int OnPlayerClickPlayer(cell playerid, cell clickedplayerid, cell source);
int OnPlayerTakeDamage(cell playerid, cell issuerid, float amount, cell weaponid, cell bodypart);
int OnPlayerGiveDamage(cell playerid, cell damagedid, float amount, cell weaponid, cell bodypart);
int OnPlayerGiveDamageActor(cell playerid, cell damaged_actorid, float amount, cell weaponid, cell bodypart);
int OnVehicleDamageStatusUpdate(cell vehicleid, cell playerid);
int OnUnoccupiedVehicleUpdate(cell vehicleid, cell playerid, cell passenger_seat, int a5, PVECTOR vecNew, PVECTOR vecVel);
int OnPlayerClickMap(cell playerid, float fX, float fY, float fZ);
int OnPlayerEditAttachedObject(cell playerid, cell index, cell response, struc_64 *pInfo);
int OnPlayerEditObject(cell playerid, cell playerobject, cell objectid, cell response, float fX, float fY, float fZ, float fRotX, float fRotY, float fRotZ);
int OnPlayerSelectObject(cell playerid, cell type, cell objectid, cell modelid, float fX, float fY, float fZ);
int OnPlayerClickTextDraw(cell playerid, cell clickedid);
int OnPlayerClickPlayerTextDraw(cell playerid, cell playertextid);
int OnClientCheckResponse(cell a2, cell a3, cell a4, cell a5); // unused
int OnPlayerWeaponShot(cell playerid, cell weaponid, cell hittype, cell hitid, PVECTOR vecPos);
int OnIncomingConnection(cell playerid, char *ip_address, cell port);
int OnTrailerUpdate(cell playerid, cell vehicleid);
int OnVehicleSirenStateChange(cell playerid, cell vehicleid, cell newstate);
};
//----------------------------------------------------------------------------------

View File

@ -71,6 +71,7 @@ public:
void Init(BOOL bFirst);
void ShutdownForGameModeRestart();
CPlayerPool * GetPlayerPool() { return m_pPlayerPool; };
RakServerInterface * GetRakServer() { return m_pRak; };
void LoadAllFilterscripts();

View File

@ -1,3 +1,12 @@
#include "main.h"
//----------------------------------------------------
void CPlayer::Say(unsigned char * szText, BYTE byteTextLen)
{
// TODO: CPlayer::Say
}
//----------------------------------------------------

View File

@ -9,6 +9,8 @@ private:
public:
void Say(unsigned char * szText, BYTE byteTextLength);
};
#endif

View File

@ -42,6 +42,18 @@ public:
BOOL Delete(PLAYERID playerId, BYTE byteReason);
// Retrieve a player
CPlayer* GetAt(PLAYERID playerId) {
if (playerId >= MAX_PLAYERS) { return NULL; }
return m_pPlayers[playerId];
};
// Find out if the slot is inuse.
BOOL GetSlotState(PLAYERID playerId) {
if(playerId >= MAX_PLAYERS) { return FALSE; }
return m_bPlayerSlotState[playerId];
};
void ResetPlayerScoresAndMoney() {
memset(&m_iPlayerScore[0],0,sizeof(int) * MAX_PLAYERS);
memset(&m_iPlayerMoney[0],0,sizeof(int) * MAX_PLAYERS);