Mergesaurus Rex

This commit is contained in:
Matt Woodrow 2008-10-19 17:28:45 +13:00
commit c231375e19
3 changed files with 23 additions and 2 deletions

View File

@ -53,6 +53,7 @@ bool g_OnMapStarted = false;
IForward *PreAdminCheck = NULL; IForward *PreAdminCheck = NULL;
IForward *PostAdminCheck = NULL; IForward *PostAdminCheck = NULL;
IForward *PostAdminFilter = NULL; IForward *PostAdminFilter = NULL;
IForward *OnClientConnected = NULL;
const unsigned int *g_NumPlayersToAuth = NULL; const unsigned int *g_NumPlayersToAuth = NULL;
int lifestate_offset = -1; int lifestate_offset = -1;
List<ICommandTargetProcessor *> target_processors; List<ICommandTargetProcessor *> target_processors;
@ -139,6 +140,7 @@ void PlayerManager::OnSourceModAllInitialized()
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String); m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String);
m_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL); m_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL);
m_onActivate2 = g_Forwards.CreateForward("OnMapStart", ET_Ignore, 0, NULL); m_onActivate2 = g_Forwards.CreateForward("OnMapStart", ET_Ignore, 0, NULL);
OnClientConnected = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1); PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1); PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
@ -194,6 +196,7 @@ void PlayerManager::OnSourceModShutdown()
g_Forwards.ReleaseForward(m_clauth); g_Forwards.ReleaseForward(m_clauth);
g_Forwards.ReleaseForward(m_onActivate); g_Forwards.ReleaseForward(m_onActivate);
g_Forwards.ReleaseForward(m_onActivate2); g_Forwards.ReleaseForward(m_onActivate2);
g_Forwards.ReleaseForward(OnClientConnected);
g_Forwards.ReleaseForward(PreAdminCheck); g_Forwards.ReleaseForward(PreAdminCheck);
g_Forwards.ReleaseForward(PostAdminCheck); g_Forwards.ReleaseForward(PostAdminCheck);
@ -473,6 +476,10 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
{ {
m_ListenClient = client; m_ListenClient = client;
} }
cell_t res;
OnClientConnected->PushCell(client);
OnClientConnected->Execute(&res, NULL);
} }
else else
{ {

View File

@ -85,7 +85,11 @@ void TQueryOp::RunThreadPart()
if (!BindParamsAndRun()) if (!BindParamsAndRun())
{ {
g_pSM->LogError(myself, "Failed SQL Query, Error: \"%s\" (Query id %i - client %i)", m_database->GetError(), m_type, m_client); g_pSM->LogError(myself,
"Failed SQL Query, Error: \"%s\" (Query id %i - client %i)",
m_pQuery ? m_pQuery->GetError() : "NULL QUERY",
m_type,
m_client);
} }
m_insertId = m_database->GetInsertID(); m_insertId = m_database->GetInsertID();

View File

@ -59,7 +59,9 @@ enum NetFlow
public const MaxClients; /**< Maximum number of players the server supports (dynamic) */ public const MaxClients; /**< Maximum number of players the server supports (dynamic) */
/** /**
* Called on client connection. * Called on client connection. If you return true, the client will be allowed in the server.
* If you return false (or return nothing), the client will be rejected. If the client is
* rejected by this forward or any other, OnClientDisconnect will not be called.
* *
* @param client Client index. * @param client Client index.
* @param rejectmsg Buffer to store the rejection message when the connection is refused. * @param rejectmsg Buffer to store the rejection message when the connection is refused.
@ -68,6 +70,14 @@ public const MaxClients; /**< Maximum number of players the server supports (dyn
*/ */
forward bool:OnClientConnect(client, String:rejectmsg[], maxlen); forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
/**
* Called once a client successfully connects. This callback is paired with OnClientDisconnect.
*
* @param client Client index.
* @noreturn
*/
forward OnClientConnected(client);
/** /**
* Called when a client is entering the game. * Called when a client is entering the game.
* *