Add client_remove() forward and fix a bug with client not internally disconnected (#414)

* Rename client_disconnected to client_disconnecting

* Add client_disconnected as post forward

* Fix client not properly disconnected internally

Introduced in #264.
Edict is reset once SV_DropClient is called, so that second check would be always false.

* Reflect changes on the concerned plugins

* Revert renaming, let's add only client_remove as post forward
This commit is contained in:
Vincent Herbet
2017-02-25 11:50:52 +01:00
committed by GitHub
parent b973d24081
commit 3568fb8747
3 changed files with 43 additions and 13 deletions

View File

@ -56,11 +56,11 @@ public client_authorized(id)
server_cmd("kick #%d ^"%L^"", get_user_userid(id), id, "DROPPED_RES")
}
public client_disconnected(id)
public client_remove(id)
{
if (get_pcvar_num(g_HidePtr))
{
setVisibleSlots(get_playersnum(1) - 1, MaxClients - get_pcvar_num(g_ResPtr))
setVisibleSlots(get_playersnum(1), MaxClients - get_pcvar_num(g_ResPtr))
}
}

View File

@ -178,24 +178,39 @@ forward client_authorized(id, const authid[]);
#pragma deprecated Use client_disconnected() instead.
forward client_disconnect(id);
/**
/**
* Called when a client is disconnected from the server.
*
* @note This will be called in some additional cases that client_disconnect doesn't cover,
* most notably when a client aborts the connection process. It is guaranteed to pair
* with the client_connect() forward.
* @note By this point it is already too late to do anything that directly
* affects the client.
* @note When this fires the player entity is still valid (e.g. is_user_connected(id) will
* return true), but no networked commands will reach the client.
*
* @param id Client index
* @param drop If true, client has been explicitly dropped by game
* @param message If drop is true, a disconnected message or buffer to copy a new message to
* @param drop If true, the game has explicitly dropped the client
* @param message If drop is true, a writable buffer containing the disconnect info message
* @param maxlen Maximum size of buffer
*
* @noreturn
*/
forward client_disconnected(id, bool:drop, message[], maxlen);
/**
* Called when a client entity has been removed from the server.
*
* @note This fires after the client_disconnected() forward, when the player entity has been
* removed (e.g. is_user_connected(id) will return false).
*
* @param id Client index
* @param drop If true, the game has explicitly dropped the client
* @param message If drop is true, contains the disconnect info message
*
* @noreturn
*/
forward client_remove(id, bool:drop, const message[]);
/**
* Called when a client attempts to execute a command.
*