PHP Code:
#include <amxmodx>
#include <nvault>
#define VERSION "0.1"
new g_TeamId[33];
new g_szAuthID[33][35];
new g_Vault;
public plugin_init()
{
register_plugin("Reconnect Blocker", VERSION, "Mr. Boopsy");
set_task(0.2, "team_check", 0, .flags="b");
}
public plugin_cfg()
{
g_Vault = nvault_open( "Reconnect_Blocker" );
if ( g_Vault == INVALID_HANDLE )
set_fail_state( "Error opening nVault" );
}
public client_authorized(id)
{
register_event("TextMsg", "EVENT_PlayerJoinCT", "a", "2&#Game_join_ct");
register_event("TextMsg", "EVENT_PlayerJoinTT", "a", "2&#Game_join_terrorist");
get_user_authid(id, g_szAuthID[id], charsmax(g_szAuthID[]));
}
public EVENT_PlayerJoinCT(id)
{
new szKey[40];
formatex(szKey, charsmax( szKey ), "%sTEAM", g_szAuthID[id]);
new iTeam = nvault_get(g_Vault, szKey );
if(iTeam == 2)
{
new ip[32];
get_user_ip(id,ip,31,1);
server_cmd("amx_addban %s 2", ip)
}
}
public EVENT_PlayerJoinTT(id)
{
new szKey[40];
formatex(szKey, charsmax( szKey ), "%sTEAM", g_szAuthID[id]);
new iTeam = nvault_get(g_Vault, szKey );
if(iTeam == 1)
{
new ip[32];
get_user_ip(id,ip,31,1);
server_cmd("amx_addban %s 2", ip)
}
}
public team_check()
{
new iPlayers[32], iPnum;
get_players(iPlayers, iPnum);
for(new i, ids; i < iPnum; i++)
{
ids = iPlayers[i];
g_TeamId[ids] = get_user_team(ids);
}
}
#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
new szTeam[20];
new szKey[40];
formatex(szKey, charsmax( szKey ), "%sTEAM", g_szAuthID[id]);
formatex(szTeam, charsmax( szTeam ), "%d", g_TeamId[id]);
g_TeamId[id] = 0;
server_print("reached")
}
public plugin_end()
{
nvault_close( g_Vault );
}
I know that it won't work as it is, it just a test code.
__________________