AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Proper way to cache user connection/alive state (https://forums.alliedmods.net/showthread.php?t=156949)

SonicSonedit 05-14-2011 07:59

Proper way to cache user connection/alive state
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new boolg_isalive[33], bool:g_isconnected[33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Killed"player""ham_PlayerKilled")
    
RegisterHam(Ham_Spawn"player""ham_PlayerSpawn_Post"1)
}

public 
client_putinserver(id)
    
g_isconnected[id]=true
    
public client_disconnect(id)
    
g_isconnected[id]=false
        
public ham_PlayerKilled(victimattackershouldgib)
    
g_isalive[victim]=false

public ham_PlayerSpawn_Post(id)
    
g_isalive[id]=true 

Is It this really enough? Will Ham detect if some other plugin will kill player some unusual way, DLLFunc_ClientKill, for example?


All times are GMT -4. The time now is 04:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.