Raised This Month: $ Target: $400
 0% 

[req] Edit a small thing in afk plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 11-25-2014 , 21:49   [req] Edit a small thing in afk plugin
Reply With Quote #1

The plugin is hobo afk, it is not supported anymore by It's author.
So if anyone wants to help, I would be glad

I need this plugin to stop analizing tt team, in order to avoid the tt from being kick or slayed to spec.
So, the tt wouldn't be touched by this plugin.

The rest of the functions stays untouched.

This is thought for deathrun mod.
Attached Files
File Type: sma Get Plugin or Get Source (hobo_afk_manager.sma - 409 views - 9.7 KB)

Last edited by sigerman; 11-25-2014 at 21:52.
sigerman is offline
Hepaa
Junior Member
Join Date: Apr 2011
Old 11-26-2014 , 02:33   Re: [req] Edit a small thing in afk plugin
Reply With Quote #2

From public round_start_event() delete || fm_get_user_team(i) == CS_TEAM_T.
Hepaa is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 11-26-2014 , 03:02   Re: [req] Edit a small thing in afk plugin
Reply With Quote #3

Quote:
Originally Posted by Hepaa View Post
From public round_start_event() delete || fm_get_user_team(i) == CS_TEAM_T.
I've already tried that, but It didn't worked.
sigerman is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 11-26-2014 , 04:46   Re: [req] Edit a small thing in afk plugin
Reply With Quote #4

Try this :

PHP Code:
/*
********************************************************************************
*  AMX Mod X script.
*
*   Hobo AFK Manager (hobo_AFK_manager.sma)
*   Copyright (C) 2008-2009 hoboman
*
*   This program is free software; you can redistribute it and/or
*   modify it under the terms of the GNU General Public License
*   as published by the Free Software Foundation; either version 2
*   of the License, or (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   when you downloaded AMX Mod X; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
*   In addition, as a special exception, the author gives permission to
*   link the code of this program with the Half-Life Game Engine ("HL
*   Engine") and Modified Game Libraries ("MODs") developed by Valve,
*   L.L.C ("Valve"). You must obey the GNU General Public License in all
*   respects for all of the code used other than the HL Engine and MODs
*   from Valve. If you modify this file, you may extend this exception
*   to your version of the file, but you are not obligated to do so. If
*   you do not wish to do so, delete this exception statement from your
*   version.
*
*********************************************************************************
*/

/*
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69622
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN    "Hobo AFK Manager"
#define AUTHOR    "hoboman313"
#define VERSION    "1.2a"

#define MAX_PLAYERS 32
//Admins with this flag cannot be kicked
#define AFK_IMMUNITY ADMIN_LEVEL_A
#define AFK_MOVE_DIST 15

#define OFFSET_TEAM 114
#define OFFSET_INTERNALMODEL 126

#define PUNISH_UNASSIGNED 0
#define PUNISH_SPECTATOR 1
#define PUNISH_AFK_SPECTATOR 2
#define PUNISH_AFK_KICK 3
#define PUNISH_NOMODEL 4


enum CsInternalModel
{
    
CS_DONTCHANGE 0,
    
CS_CT_URBAN 1,
    
CS_T_TERROR 2,
    
CS_T_LEET 3,
    
CS_T_ARCTIC 4,
    
CS_CT_GSG9 5,
    
CS_CT_GIGN 6,
    
CS_CT_SAS 7,
    
CS_T_GUERILLA 8,
    
CS_CT_VIP 9,
    
CZ_T_MILITIA 10,
    
CZ_CT_SPETSNAZ 11
}

enum CsTeams 
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
}

new 
g_oldangles[MAX_PLAYERS+1][3], g_afktime[MAX_PLAYERS+1], saved_freqbool:freezetimeOver
new bool:player_spawned[MAX_PLAYERS+1],  msgSyncmaxplayersbool:selectedNoModel[MAX_PLAYERS+1]
//cvars
new maxAfkTimeaImmunitykickkickPlayersunassignedTimewarning_timecheck_frequency
    
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
check_frequencyregister_cvar("hobo_afk_frequency""1.0")
    
maxAfkTime register_cvar("hobo_afk_time""60")
    
aImmunity register_cvar("hobo_afk_immunity""1")
    
kick register_cvar("hobo_afk_kick""0")
    
kickPlayers register_cvar("hobo_afk_spectator_kick""16")
    
unassignedTime register_cvar("hobo_afk_unassigned_time""60")
    
warning_time register_cvar("hobo_afk_warning_time""10" )
 
    
msgSync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
    
register_logevent("round_start_event"2"1=Round_Start")

    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
    if( 
get_cvar_num("mp_freezetime") > )
        
register_event("HLTV""event_new_round""a""1=0""2=0"
    
    
saved_freq=get_pcvar_num(check_frequency)
    
set_task(get_pcvar_float(check_frequency), "checkPlayers"31337__"b")
}


public 
player_spawn(id)
{
    if( 
is_user_alive(id) && !is_user_bot(id) ) 
    {
        new 
arrId[1]
        
arrId[0]=id
        
//player isn't considered spawned until he drops to the ground
        
set_task0.5"playerSpawned"idarrId1  )
    }
}


public 
event_new_round()
    
freezetimeOver=false


public round_start_event()
{
    for( new 
1<= maxplayersi++ )
    {
        
player_spawned[i] = false
        
        
if( is_user_connected(i) && ( fm_get_user_team(i) != CS_TEAM_T ) && !is_user_alive(i) && checkImmunity(i) )
        {
            if( 
selectedNoModel[i] == true )
                
punish_playeriPUNISH_NOMODEL )
                
            
selectedNoModel[i]=true
        
}
        else
            
selectedNoModel[i]=false
    
}
    
    if( 
saved_freq != get_pcvar_num(check_frequency) )
    {
        
change_task31337get_pcvar_float(check_frequency) ) 
        
saved_freq get_pcvar_num(check_frequency)    
    }
    
    
freezetimeOver=true
}


public 
checkPlayers() 
{
    static 
newangle[3]
    
    if(
freezetimeOver)
    {
        for ( new 
1<= maxplayersi++ ) 
        {
            if ( 
is_user_alive(i) && player_spawned[i] && fm_get_user_team(i) != CS_TEAM_T )
            {
                
get_user_origininewangle )

                if ( 
abs(newangle[0]-g_oldangles[i][0]) < AFK_MOVE_DIST && abs(newangle[1]-g_oldangles[i][1]) < AFK_MOVE_DIST && abs(newangle[2]-g_oldangles[i][2]) < AFK_MOVE_DIST 
                {
                    
g_afktime[i] += get_pcvar_num(check_frequency)
                    
                    
check_afktime(i)
                } 
                else 
                {
                    
g_oldangles[i][0] = newangle[0]
                    
g_oldangles[i][1] = newangle[1]
                    
g_oldangles[i][2] = newangle[2]
                    
g_afktime[i] = 0
                
}
            }
        }
    }
}


public 
check_afktime(id
{
    new 
afkTimeTmp get_pcvar_nummaxAfkTime ), afkTimeLeftkickOrSpect
    
    
static punishName[17]
    
    
afkTimeLeft afkTimeTmp g_afktime[id]
    
    if ( 
afkTimeLeft <= get_pcvar_num(warning_time) ) 
    {    
        if( ( 
get_pcvar_num(kick) || get_playersnum() > get_pcvar_num(kickPlayers) ) && checkImmunity(id) )
        {
            
kickOrSpect=1
            punishName
="expulsado"
        
}
        else
        {
            
kickOrSpect=0
            punishName
="enviado a spec"
        
}
        
        if(
afkTimeLeft>0)
        {
            
set_hudmessage(0100200, -1.00.2510.13.00.050.05, -1)
            
ShowSyncHudMsgidmsgSync"Tenes %d segundos para moverte o seras %s por estar AFK"afkTimeLeftpunishName )
        }
    } 
    
    if( 
g_afktime[id] >= afkTimeTmp 
    {
        if( 
kickOrSpect==)
            
punish_player(idPUNISH_AFK_KICK )    
        else
            
punish_player(idPUNISH_AFK_SPECTATOR )
        
        
g_afktime[id]=0
    
}
}


public 
client_disconnect(id)
{    
    
g_afktime[id] = 0
    selectedNoModel
[id]= false    
}


//a player connected so we must find and kick a spectator if there are any
public client_putinserver(id
{
    if( 
is_user_bot(id) || is_user_hltv(id) )
        return
    
    if( 
checkImmunity(id) )
    {
        new 
arrId[1]
        
arrId[0] = id
        set_task
get_pcvar_floatunassignedTime ), "check_unassigned"id+40arrId)
    }
    
    if( 
get_playersnum() > get_pcvar_num(kickPlayers) )
    {
        for( new 
i=1i<=maxplayersi++ )
        {
            if( 
is_user_connected(i) && fm_get_user_team(i) == CS_TEAM_SPECTATOR && checkImmunity(i) )
            {
                
punish_playeriPUNISH_SPECTATOR )
                break
            }
        }
    }
}


public 
check_unassignedarrId[] )
{
    new 
id=arrId[0]
    
    
//if the player is unassigned after x seconds then kick him
    
if( is_user_connected(id) && fm_get_user_teamid ) == CS_TEAM_UNASSIGNED )
        
punish_playeridPUNISH_UNASSIGNED )
}


public 
playerSpawned(arrId[]) 
{
    new 
id=arrId[0]
    
get_user_originidg_oldangles[id] )
    
player_spawned[id] = true
}


stock punish_playeridpunishType )
{
    static 
name[32]
    
get_user_name(idname31)
    
    switch(
punishType)
    {
        case 
PUNISH_UNASSIGNED
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar sin team por mas de %d segundos"nameget_pcvar_num(unassignedTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar sin asignacion por mas de %d segundos.^""get_user_userid(id ), get_pcvar_num(unassignedTime) )    
        }
        case 
PUNISH_SPECTATOR
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar spec en el servidor con mas de %d jugadores en linea"nameget_pcvar_num(kickPlayers) )
            
server_cmd"kick #%d ^"El servidor esta muy lleno como para permitir espectadores.^""get_user_userid(id) )
        }
        case 
PUNISH_AFK_KICK:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar AFK mas de %d segundos.^""get_user_userid(id), get_pcvar_num(maxAfkTime) )
        }
        case 
PUNISH_AFK_SPECTATOR:
        {
            
client_print(0print_chat"[ SIG ] %s fue enviado a spec por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
user_silentkill(id)
            
fm_set_user_teamidCS_TEAM_SPECTATOR )
        }
        case 
PUNISH_NOMODEL:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por unirse a un team y quedarse AFK sin elegir modelo"name )
            
server_cmd("kick #%d ^"Fuiste expulsado por unirse a un team y quedarse AFK sin elegir modelo.^""get_user_userid(id) )
        }
    }
}


public 
checkImmunity(id)
{
    
//if immunity is disabled
    
if( get_pcvar_num(aImmunity)==)
        return 
true
    
//admin has AFK_IMMUNITY flag
    
else if( get_user_flags(id) & AFK_IMMUNITY )
        return 
false
    
    
return true    
}


stock fm_set_user_team(idCsTeams:team)
{
    
set_pdata_int(idOFFSET_TEAM_:team)

    
dllfunc(DLLFunc_ClientUserInfoChangedid)

    static 
teaminfo[12], iMsgid_TeamInfo
    
switch(team)
    {
        case 
CS_TEAM_UNASSIGNED
            
teaminfo="UNASSIGNED"
        
case CS_TEAM_T
            
teaminfo="TERRORIST"
        
case CS_TEAM_CT
            
teaminfo="CT"
        
case CS_TEAM_SPECTATOR
            
teaminfo="SPECTATOR"
    
}

    if(!
iMsgid_TeamInfo)
        
iMsgid_TeamInfo get_user_msgid("TeamInfo")
    
    
message_begin(MSG_ALLiMsgid_TeamInfo)
    
write_byte(id)
    
write_string(teaminfo)
    
message_end()
}


stock CsTeams:fm_get_user_team(id)
    return 
CsTeams:get_pdata_int(idOFFSET_TEAM
Or this one ( TS team define IMMUNITY )

PHP Code:
/*
********************************************************************************
*  AMX Mod X script.
*
*   Hobo AFK Manager (hobo_AFK_manager.sma)
*   Copyright (C) 2008-2009 hoboman
*
*   This program is free software; you can redistribute it and/or
*   modify it under the terms of the GNU General Public License
*   as published by the Free Software Foundation; either version 2
*   of the License, or (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   when you downloaded AMX Mod X; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
*   In addition, as a special exception, the author gives permission to
*   link the code of this program with the Half-Life Game Engine ("HL
*   Engine") and Modified Game Libraries ("MODs") developed by Valve,
*   L.L.C ("Valve"). You must obey the GNU General Public License in all
*   respects for all of the code used other than the HL Engine and MODs
*   from Valve. If you modify this file, you may extend this exception
*   to your version of the file, but you are not obligated to do so. If
*   you do not wish to do so, delete this exception statement from your
*   version.
*
*********************************************************************************
*/

/*
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69622
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN    "Hobo AFK Manager"
#define AUTHOR    "hoboman313"
#define VERSION    "1.2a"

#define MAX_PLAYERS 32
//Admins with this flag cannot be kicked
#define AFK_IMMUNITY ADMIN_LEVEL_A
#define AFK_MOVE_DIST 15

#define TEAM_IMMUNITY CS_TEAM_T 

#define OFFSET_TEAM 114
#define OFFSET_INTERNALMODEL 126

#define PUNISH_UNASSIGNED 0
#define PUNISH_SPECTATOR 1
#define PUNISH_AFK_SPECTATOR 2
#define PUNISH_AFK_KICK 3
#define PUNISH_NOMODEL 4


enum CsInternalModel
{
    
CS_DONTCHANGE 0,
    
CS_CT_URBAN 1,
    
CS_T_TERROR 2,
    
CS_T_LEET 3,
    
CS_T_ARCTIC 4,
    
CS_CT_GSG9 5,
    
CS_CT_GIGN 6,
    
CS_CT_SAS 7,
    
CS_T_GUERILLA 8,
    
CS_CT_VIP 9,
    
CZ_T_MILITIA 10,
    
CZ_CT_SPETSNAZ 11
}

enum CsTeams 
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
}

new 
g_oldangles[MAX_PLAYERS+1][3], g_afktime[MAX_PLAYERS+1], saved_freqbool:freezetimeOver
new bool:player_spawned[MAX_PLAYERS+1],  msgSyncmaxplayersbool:selectedNoModel[MAX_PLAYERS+1]
//cvars
new maxAfkTimeaImmunitykickkickPlayersunassignedTimewarning_timecheck_frequency
    
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
check_frequencyregister_cvar("hobo_afk_frequency""1.0")
    
maxAfkTime register_cvar("hobo_afk_time""60")
    
aImmunity register_cvar("hobo_afk_immunity""1")
    
kick register_cvar("hobo_afk_kick""0")
    
kickPlayers register_cvar("hobo_afk_spectator_kick""16")
    
unassignedTime register_cvar("hobo_afk_unassigned_time""60")
    
warning_time register_cvar("hobo_afk_warning_time""10" )
 
    
msgSync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
    
register_logevent("round_start_event"2"1=Round_Start")

    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
    if( 
get_cvar_num("mp_freezetime") > )
        
register_event("HLTV""event_new_round""a""1=0""2=0"
    
    
saved_freq=get_pcvar_num(check_frequency)
    
set_task(get_pcvar_float(check_frequency), "checkPlayers"31337__"b")
}


public 
player_spawn(id)
{
    if( 
is_user_alive(id) && !is_user_bot(id) ) 
    {
        new 
arrId[1]
        
arrId[0]=id
        
//player isn't considered spawned until he drops to the ground
        
set_task0.5"playerSpawned"idarrId1  )
    }
}


public 
event_new_round()
    
freezetimeOver=false


public round_start_event()
{
    for( new 
1<= maxplayersi++ )
    {
        
player_spawned[i] = false
        
        
if( is_user_connected(i) && ( fm_get_user_team(i) == CS_TEAM_CT || fm_get_user_team(i) == CS_TEAM_T ) && !is_user_alive(i) && checkImmunity(i) )
        {
            if( 
selectedNoModel[i] == true )
                
punish_playeriPUNISH_NOMODEL )
                
            
selectedNoModel[i]=true
        
}
        else
            
selectedNoModel[i]=false
    
}
    
    if( 
saved_freq != get_pcvar_num(check_frequency) )
    {
        
change_task31337get_pcvar_float(check_frequency) ) 
        
saved_freq get_pcvar_num(check_frequency)    
    }
    
    
freezetimeOver=true
}


public 
checkPlayers() 
{
    static 
newangle[3]
    
    if(
freezetimeOver)
    {
        for ( new 
1<= maxplayersi++ ) 
        {
            if ( 
is_user_alive(i) && player_spawned[i] )
            {
                
get_user_origininewangle )

                if ( 
abs(newangle[0]-g_oldangles[i][0]) < AFK_MOVE_DIST && abs(newangle[1]-g_oldangles[i][1]) < AFK_MOVE_DIST && abs(newangle[2]-g_oldangles[i][2]) < AFK_MOVE_DIST 
                {
                    
g_afktime[i] += get_pcvar_num(check_frequency)
                    
                    
check_afktime(i)
                } 
                else 
                {
                    
g_oldangles[i][0] = newangle[0]
                    
g_oldangles[i][1] = newangle[1]
                    
g_oldangles[i][2] = newangle[2]
                    
g_afktime[i] = 0
                
}
            }
        }
    }
}


public 
check_afktime(id
{
    new 
afkTimeTmp get_pcvar_nummaxAfkTime ), afkTimeLeftkickOrSpect
    
    
static punishName[17]
    
    
afkTimeLeft afkTimeTmp g_afktime[id]
    
    if ( 
afkTimeLeft <= get_pcvar_num(warning_time) ) 
    {    
        if( ( 
get_pcvar_num(kick) || get_playersnum() > get_pcvar_num(kickPlayers) ) && checkImmunity(id) )
        {
            
kickOrSpect=1
            punishName
="expulsado"
        
}
        else
        {
            
kickOrSpect=0
            punishName
="enviado a spec"
        
}
        
        if(
afkTimeLeft>0)
        {
            
set_hudmessage(0100200, -1.00.2510.13.00.050.05, -1)
            
ShowSyncHudMsgidmsgSync"Tenes %d segundos para moverte o seras %s por estar AFK"afkTimeLeftpunishName )
        }
    } 
    
    if( 
g_afktime[id] >= afkTimeTmp 
    {
        if( 
kickOrSpect==)
            
punish_player(idPUNISH_AFK_KICK )    
        else
            
punish_player(idPUNISH_AFK_SPECTATOR )
        
        
g_afktime[id]=0
    
}
}


public 
client_disconnect(id)
{    
    
g_afktime[id] = 0
    selectedNoModel
[id]= false    
}


//a player connected so we must find and kick a spectator if there are any
public client_putinserver(id
{
    if( 
is_user_bot(id) || is_user_hltv(id) )
        return
    
    if( 
checkImmunity(id) )
    {
        new 
arrId[1]
        
arrId[0] = id
        set_task
get_pcvar_floatunassignedTime ), "check_unassigned"id+40arrId)
    }
    
    if( 
get_playersnum() > get_pcvar_num(kickPlayers) )
    {
        for( new 
i=1i<=maxplayersi++ )
        {
            if( 
is_user_connected(i) && fm_get_user_team(i) == CS_TEAM_SPECTATOR && checkImmunity(i) )
            {
                
punish_playeriPUNISH_SPECTATOR )
                break
            }
        }
    }
}


public 
check_unassignedarrId[] )
{
    new 
id=arrId[0]
    
    
//if the player is unassigned after x seconds then kick him
    
if( is_user_connected(id) && fm_get_user_teamid ) == CS_TEAM_UNASSIGNED )
        
punish_playeridPUNISH_UNASSIGNED )
}


public 
playerSpawned(arrId[]) 
{
    new 
id=arrId[0]
    
get_user_originidg_oldangles[id] )
    
player_spawned[id] = true
}


stock punish_playeridpunishType )
{
    static 
name[32]
    
get_user_name(idname31)
    
    switch(
punishType)
    {
        case 
PUNISH_UNASSIGNED
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar sin team por mas de %d segundos"nameget_pcvar_num(unassignedTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar sin asignacion por mas de %d segundos.^""get_user_userid(id ), get_pcvar_num(unassignedTime) )    
        }
        case 
PUNISH_SPECTATOR
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar spec en el servidor con mas de %d jugadores en linea"nameget_pcvar_num(kickPlayers) )
            
server_cmd"kick #%d ^"El servidor esta muy lleno como para permitir espectadores.^""get_user_userid(id) )
        }
        case 
PUNISH_AFK_KICK:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar AFK mas de %d segundos.^""get_user_userid(id), get_pcvar_num(maxAfkTime) )
        }
        case 
PUNISH_AFK_SPECTATOR:
        {
            
client_print(0print_chat"[ SIG ] %s fue enviado a spec por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
user_silentkill(id)
            
fm_set_user_teamidCS_TEAM_SPECTATOR )
        }
        case 
PUNISH_NOMODEL:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por unirse a un team y quedarse AFK sin elegir modelo"name )
            
server_cmd("kick #%d ^"Fuiste expulsado por unirse a un team y quedarse AFK sin elegir modelo.^""get_user_userid(id) )
        }
    }
}


public 
checkImmunity(id)
{
    
//if immunity is disabled
    
if( get_pcvar_num(aImmunity)==)
        return 
true
    
//admin has AFK_IMMUNITY flag
    
else if( get_user_flags(id) & AFK_IMMUNITY && TEAM_IMMUNITY
        return 
false
    
    
return true    
}


stock fm_set_user_team(idCsTeams:team)
{
    
set_pdata_int(idOFFSET_TEAM_:team)

    
dllfunc(DLLFunc_ClientUserInfoChangedid)

    static 
teaminfo[12], iMsgid_TeamInfo
    
switch(team)
    {
        case 
CS_TEAM_UNASSIGNED
            
teaminfo="UNASSIGNED"
        
case CS_TEAM_T
            
teaminfo="TERRORIST"
        
case CS_TEAM_CT
            
teaminfo="CT"
        
case CS_TEAM_SPECTATOR
            
teaminfo="SPECTATOR"
    
}

    if(!
iMsgid_TeamInfo)
        
iMsgid_TeamInfo get_user_msgid("TeamInfo")
    
    
message_begin(MSG_ALLiMsgid_TeamInfo)
    
write_byte(id)
    
write_string(teaminfo)
    
message_end()
}


stock CsTeams:fm_get_user_team(id)
    return 
CsTeams:get_pdata_int(idOFFSET_TEAM

Last edited by Krtola; 11-26-2014 at 04:57.
Krtola is offline
Send a message via Skype™ to Krtola
Hepaa
Junior Member
Join Date: Apr 2011
Old 11-26-2014 , 05:49   Re: [req] Edit a small thing in afk plugin
Reply With Quote #5

Into cases PUNISH_AFK_KICK and PUNISH_AFK_SPECTATOR add this (before kick or set team commands):

if (fm_get_user_team(i) == CS_TEAM_T)
{
g_afktime[id] = 0
return PLUGIN_HANDLED
}

Using immunity is not good way, because its checked only once - when player connect. This will check players team all times before kicking or moving to spect.

Last edited by Hepaa; 11-26-2014 at 05:58.
Hepaa is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 11-27-2014 , 09:34   Re: [req] Edit a small thing in afk plugin
Reply With Quote #6

Quote:
Originally Posted by Hepaa View Post
Into cases PUNISH_AFK_KICK and PUNISH_AFK_SPECTATOR add this (before kick or set team commands):

if (fm_get_user_team(i) == CS_TEAM_T)
{
g_afktime[id] = 0
return PLUGIN_HANDLED
}

Using immunity is not good way, because its checked only once - when player connect. This will check players team all times before kicking or moving to spect.
Can you tell me exactly where I have to put this? Because I don't understand nothing about this.
sigerman is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 11-27-2014 , 12:50   Re: [req] Edit a small thing in afk plugin
Reply With Quote #7

Quote:
Originally Posted by sigerman View Post
Can you tell me exactly where I have to put this? Because I don't understand nothing about this.
Quote:
Originally Posted by Hepaa View Post
Into cases PUNISH_AFK_KICK and PUNISH_AFK_SPECTATOR add this (before kick or set team commands):

if (fm_get_user_team(i) == CS_TEAM_T)
{
g_afktime[id] = 0
return PLUGIN_HANDLED
}
Lines:
PHP Code:
         case PUNISH_AFK_KICK:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar AFK mas de %d segundos.^""get_user_userid(id), get_pcvar_num(maxAfkTime) )
        }
        case 
PUNISH_AFK_SPECTATOR:
        {
            
client_print(0print_chat"[ SIG ] %s fue enviado a spec por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
user_silentkill(id)
            
fm_set_user_teamidCS_TEAM_SPECTATOR )
        } 
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 11-28-2014 , 00:16   Re: [req] Edit a small thing in afk plugin
Reply With Quote #8

Quote:
Originally Posted by Krtola View Post
Try this :

PHP Code:
/*
********************************************************************************
*  AMX Mod X script.
*
*   Hobo AFK Manager (hobo_AFK_manager.sma)
*   Copyright (C) 2008-2009 hoboman
*
*   This program is free software; you can redistribute it and/or
*   modify it under the terms of the GNU General Public License
*   as published by the Free Software Foundation; either version 2
*   of the License, or (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   when you downloaded AMX Mod X; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
*   In addition, as a special exception, the author gives permission to
*   link the code of this program with the Half-Life Game Engine ("HL
*   Engine") and Modified Game Libraries ("MODs") developed by Valve,
*   L.L.C ("Valve"). You must obey the GNU General Public License in all
*   respects for all of the code used other than the HL Engine and MODs
*   from Valve. If you modify this file, you may extend this exception
*   to your version of the file, but you are not obligated to do so. If
*   you do not wish to do so, delete this exception statement from your
*   version.
*
*********************************************************************************
*/

/*
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69622
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN    "Hobo AFK Manager"
#define AUTHOR    "hoboman313"
#define VERSION    "1.2a"

#define MAX_PLAYERS 32
//Admins with this flag cannot be kicked
#define AFK_IMMUNITY ADMIN_LEVEL_A
#define AFK_MOVE_DIST 15

#define OFFSET_TEAM 114
#define OFFSET_INTERNALMODEL 126

#define PUNISH_UNASSIGNED 0
#define PUNISH_SPECTATOR 1
#define PUNISH_AFK_SPECTATOR 2
#define PUNISH_AFK_KICK 3
#define PUNISH_NOMODEL 4


enum CsInternalModel
{
    
CS_DONTCHANGE 0,
    
CS_CT_URBAN 1,
    
CS_T_TERROR 2,
    
CS_T_LEET 3,
    
CS_T_ARCTIC 4,
    
CS_CT_GSG9 5,
    
CS_CT_GIGN 6,
    
CS_CT_SAS 7,
    
CS_T_GUERILLA 8,
    
CS_CT_VIP 9,
    
CZ_T_MILITIA 10,
    
CZ_CT_SPETSNAZ 11
}

enum CsTeams 
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
}

new 
g_oldangles[MAX_PLAYERS+1][3], g_afktime[MAX_PLAYERS+1], saved_freqbool:freezetimeOver
new bool:player_spawned[MAX_PLAYERS+1],  msgSyncmaxplayersbool:selectedNoModel[MAX_PLAYERS+1]
//cvars
new maxAfkTimeaImmunitykickkickPlayersunassignedTimewarning_timecheck_frequency
    
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
check_frequencyregister_cvar("hobo_afk_frequency""1.0")
    
maxAfkTime register_cvar("hobo_afk_time""60")
    
aImmunity register_cvar("hobo_afk_immunity""1")
    
kick register_cvar("hobo_afk_kick""0")
    
kickPlayers register_cvar("hobo_afk_spectator_kick""16")
    
unassignedTime register_cvar("hobo_afk_unassigned_time""60")
    
warning_time register_cvar("hobo_afk_warning_time""10" )
 
    
msgSync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
    
register_logevent("round_start_event"2"1=Round_Start")

    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
    if( 
get_cvar_num("mp_freezetime") > )
        
register_event("HLTV""event_new_round""a""1=0""2=0"
    
    
saved_freq=get_pcvar_num(check_frequency)
    
set_task(get_pcvar_float(check_frequency), "checkPlayers"31337__"b")
}


public 
player_spawn(id)
{
    if( 
is_user_alive(id) && !is_user_bot(id) ) 
    {
        new 
arrId[1]
        
arrId[0]=id
        
//player isn't considered spawned until he drops to the ground
        
set_task0.5"playerSpawned"idarrId1  )
    }
}


public 
event_new_round()
    
freezetimeOver=false


public round_start_event()
{
    for( new 
1<= maxplayersi++ )
    {
        
player_spawned[i] = false
        
        
if( is_user_connected(i) && ( fm_get_user_team(i) != CS_TEAM_T ) && !is_user_alive(i) && checkImmunity(i) )
        {
            if( 
selectedNoModel[i] == true )
                
punish_playeriPUNISH_NOMODEL )
                
            
selectedNoModel[i]=true
        
}
        else
            
selectedNoModel[i]=false
    
}
    
    if( 
saved_freq != get_pcvar_num(check_frequency) )
    {
        
change_task31337get_pcvar_float(check_frequency) ) 
        
saved_freq get_pcvar_num(check_frequency)    
    }
    
    
freezetimeOver=true
}


public 
checkPlayers() 
{
    static 
newangle[3]
    
    if(
freezetimeOver)
    {
        for ( new 
1<= maxplayersi++ ) 
        {
            if ( 
is_user_alive(i) && player_spawned[i] && fm_get_user_team(i) != CS_TEAM_T )
            {
                
get_user_origininewangle )

                if ( 
abs(newangle[0]-g_oldangles[i][0]) < AFK_MOVE_DIST && abs(newangle[1]-g_oldangles[i][1]) < AFK_MOVE_DIST && abs(newangle[2]-g_oldangles[i][2]) < AFK_MOVE_DIST 
                {
                    
g_afktime[i] += get_pcvar_num(check_frequency)
                    
                    
check_afktime(i)
                } 
                else 
                {
                    
g_oldangles[i][0] = newangle[0]
                    
g_oldangles[i][1] = newangle[1]
                    
g_oldangles[i][2] = newangle[2]
                    
g_afktime[i] = 0
                
}
            }
        }
    }
}


public 
check_afktime(id
{
    new 
afkTimeTmp get_pcvar_nummaxAfkTime ), afkTimeLeftkickOrSpect
    
    
static punishName[17]
    
    
afkTimeLeft afkTimeTmp g_afktime[id]
    
    if ( 
afkTimeLeft <= get_pcvar_num(warning_time) ) 
    {    
        if( ( 
get_pcvar_num(kick) || get_playersnum() > get_pcvar_num(kickPlayers) ) && checkImmunity(id) )
        {
            
kickOrSpect=1
            punishName
="expulsado"
        
}
        else
        {
            
kickOrSpect=0
            punishName
="enviado a spec"
        
}
        
        if(
afkTimeLeft>0)
        {
            
set_hudmessage(0100200, -1.00.2510.13.00.050.05, -1)
            
ShowSyncHudMsgidmsgSync"Tenes %d segundos para moverte o seras %s por estar AFK"afkTimeLeftpunishName )
        }
    } 
    
    if( 
g_afktime[id] >= afkTimeTmp 
    {
        if( 
kickOrSpect==)
            
punish_player(idPUNISH_AFK_KICK )    
        else
            
punish_player(idPUNISH_AFK_SPECTATOR )
        
        
g_afktime[id]=0
    
}
}


public 
client_disconnect(id)
{    
    
g_afktime[id] = 0
    selectedNoModel
[id]= false    
}


//a player connected so we must find and kick a spectator if there are any
public client_putinserver(id
{
    if( 
is_user_bot(id) || is_user_hltv(id) )
        return
    
    if( 
checkImmunity(id) )
    {
        new 
arrId[1]
        
arrId[0] = id
        set_task
get_pcvar_floatunassignedTime ), "check_unassigned"id+40arrId)
    }
    
    if( 
get_playersnum() > get_pcvar_num(kickPlayers) )
    {
        for( new 
i=1i<=maxplayersi++ )
        {
            if( 
is_user_connected(i) && fm_get_user_team(i) == CS_TEAM_SPECTATOR && checkImmunity(i) )
            {
                
punish_playeriPUNISH_SPECTATOR )
                break
            }
        }
    }
}


public 
check_unassignedarrId[] )
{
    new 
id=arrId[0]
    
    
//if the player is unassigned after x seconds then kick him
    
if( is_user_connected(id) && fm_get_user_teamid ) == CS_TEAM_UNASSIGNED )
        
punish_playeridPUNISH_UNASSIGNED )
}


public 
playerSpawned(arrId[]) 
{
    new 
id=arrId[0]
    
get_user_originidg_oldangles[id] )
    
player_spawned[id] = true
}


stock punish_playeridpunishType )
{
    static 
name[32]
    
get_user_name(idname31)
    
    switch(
punishType)
    {
        case 
PUNISH_UNASSIGNED
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar sin team por mas de %d segundos"nameget_pcvar_num(unassignedTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar sin asignacion por mas de %d segundos.^""get_user_userid(id ), get_pcvar_num(unassignedTime) )    
        }
        case 
PUNISH_SPECTATOR
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar spec en el servidor con mas de %d jugadores en linea"nameget_pcvar_num(kickPlayers) )
            
server_cmd"kick #%d ^"El servidor esta muy lleno como para permitir espectadores.^""get_user_userid(id) )
        }
        case 
PUNISH_AFK_KICK:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar AFK mas de %d segundos.^""get_user_userid(id), get_pcvar_num(maxAfkTime) )
        }
        case 
PUNISH_AFK_SPECTATOR:
        {
            
client_print(0print_chat"[ SIG ] %s fue enviado a spec por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
user_silentkill(id)
            
fm_set_user_teamidCS_TEAM_SPECTATOR )
        }
        case 
PUNISH_NOMODEL:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por unirse a un team y quedarse AFK sin elegir modelo"name )
            
server_cmd("kick #%d ^"Fuiste expulsado por unirse a un team y quedarse AFK sin elegir modelo.^""get_user_userid(id) )
        }
    }
}


public 
checkImmunity(id)
{
    
//if immunity is disabled
    
if( get_pcvar_num(aImmunity)==)
        return 
true
    
//admin has AFK_IMMUNITY flag
    
else if( get_user_flags(id) & AFK_IMMUNITY )
        return 
false
    
    
return true    
}


stock fm_set_user_team(idCsTeams:team)
{
    
set_pdata_int(idOFFSET_TEAM_:team)

    
dllfunc(DLLFunc_ClientUserInfoChangedid)

    static 
teaminfo[12], iMsgid_TeamInfo
    
switch(team)
    {
        case 
CS_TEAM_UNASSIGNED
            
teaminfo="UNASSIGNED"
        
case CS_TEAM_T
            
teaminfo="TERRORIST"
        
case CS_TEAM_CT
            
teaminfo="CT"
        
case CS_TEAM_SPECTATOR
            
teaminfo="SPECTATOR"
    
}

    if(!
iMsgid_TeamInfo)
        
iMsgid_TeamInfo get_user_msgid("TeamInfo")
    
    
message_begin(MSG_ALLiMsgid_TeamInfo)
    
write_byte(id)
    
write_string(teaminfo)
    
message_end()
}


stock CsTeams:fm_get_user_team(id)
    return 
CsTeams:get_pdata_int(idOFFSET_TEAM
Or this one ( TS team define IMMUNITY )

PHP Code:
/*
********************************************************************************
*  AMX Mod X script.
*
*   Hobo AFK Manager (hobo_AFK_manager.sma)
*   Copyright (C) 2008-2009 hoboman
*
*   This program is free software; you can redistribute it and/or
*   modify it under the terms of the GNU General Public License
*   as published by the Free Software Foundation; either version 2
*   of the License, or (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   when you downloaded AMX Mod X; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
*   In addition, as a special exception, the author gives permission to
*   link the code of this program with the Half-Life Game Engine ("HL
*   Engine") and Modified Game Libraries ("MODs") developed by Valve,
*   L.L.C ("Valve"). You must obey the GNU General Public License in all
*   respects for all of the code used other than the HL Engine and MODs
*   from Valve. If you modify this file, you may extend this exception
*   to your version of the file, but you are not obligated to do so. If
*   you do not wish to do so, delete this exception statement from your
*   version.
*
*********************************************************************************
*/

/*
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69622
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN    "Hobo AFK Manager"
#define AUTHOR    "hoboman313"
#define VERSION    "1.2a"

#define MAX_PLAYERS 32
//Admins with this flag cannot be kicked
#define AFK_IMMUNITY ADMIN_LEVEL_A
#define AFK_MOVE_DIST 15

#define TEAM_IMMUNITY CS_TEAM_T 

#define OFFSET_TEAM 114
#define OFFSET_INTERNALMODEL 126

#define PUNISH_UNASSIGNED 0
#define PUNISH_SPECTATOR 1
#define PUNISH_AFK_SPECTATOR 2
#define PUNISH_AFK_KICK 3
#define PUNISH_NOMODEL 4


enum CsInternalModel
{
    
CS_DONTCHANGE 0,
    
CS_CT_URBAN 1,
    
CS_T_TERROR 2,
    
CS_T_LEET 3,
    
CS_T_ARCTIC 4,
    
CS_CT_GSG9 5,
    
CS_CT_GIGN 6,
    
CS_CT_SAS 7,
    
CS_T_GUERILLA 8,
    
CS_CT_VIP 9,
    
CZ_T_MILITIA 10,
    
CZ_CT_SPETSNAZ 11
}

enum CsTeams 
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
}

new 
g_oldangles[MAX_PLAYERS+1][3], g_afktime[MAX_PLAYERS+1], saved_freqbool:freezetimeOver
new bool:player_spawned[MAX_PLAYERS+1],  msgSyncmaxplayersbool:selectedNoModel[MAX_PLAYERS+1]
//cvars
new maxAfkTimeaImmunitykickkickPlayersunassignedTimewarning_timecheck_frequency
    
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
check_frequencyregister_cvar("hobo_afk_frequency""1.0")
    
maxAfkTime register_cvar("hobo_afk_time""60")
    
aImmunity register_cvar("hobo_afk_immunity""1")
    
kick register_cvar("hobo_afk_kick""0")
    
kickPlayers register_cvar("hobo_afk_spectator_kick""16")
    
unassignedTime register_cvar("hobo_afk_unassigned_time""60")
    
warning_time register_cvar("hobo_afk_warning_time""10" )
 
    
msgSync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
    
register_logevent("round_start_event"2"1=Round_Start")

    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
    if( 
get_cvar_num("mp_freezetime") > )
        
register_event("HLTV""event_new_round""a""1=0""2=0"
    
    
saved_freq=get_pcvar_num(check_frequency)
    
set_task(get_pcvar_float(check_frequency), "checkPlayers"31337__"b")
}


public 
player_spawn(id)
{
    if( 
is_user_alive(id) && !is_user_bot(id) ) 
    {
        new 
arrId[1]
        
arrId[0]=id
        
//player isn't considered spawned until he drops to the ground
        
set_task0.5"playerSpawned"idarrId1  )
    }
}


public 
event_new_round()
    
freezetimeOver=false


public round_start_event()
{
    for( new 
1<= maxplayersi++ )
    {
        
player_spawned[i] = false
        
        
if( is_user_connected(i) && ( fm_get_user_team(i) == CS_TEAM_CT || fm_get_user_team(i) == CS_TEAM_T ) && !is_user_alive(i) && checkImmunity(i) )
        {
            if( 
selectedNoModel[i] == true )
                
punish_playeriPUNISH_NOMODEL )
                
            
selectedNoModel[i]=true
        
}
        else
            
selectedNoModel[i]=false
    
}
    
    if( 
saved_freq != get_pcvar_num(check_frequency) )
    {
        
change_task31337get_pcvar_float(check_frequency) ) 
        
saved_freq get_pcvar_num(check_frequency)    
    }
    
    
freezetimeOver=true
}


public 
checkPlayers() 
{
    static 
newangle[3]
    
    if(
freezetimeOver)
    {
        for ( new 
1<= maxplayersi++ ) 
        {
            if ( 
is_user_alive(i) && player_spawned[i] )
            {
                
get_user_origininewangle )

                if ( 
abs(newangle[0]-g_oldangles[i][0]) < AFK_MOVE_DIST && abs(newangle[1]-g_oldangles[i][1]) < AFK_MOVE_DIST && abs(newangle[2]-g_oldangles[i][2]) < AFK_MOVE_DIST 
                {
                    
g_afktime[i] += get_pcvar_num(check_frequency)
                    
                    
check_afktime(i)
                } 
                else 
                {
                    
g_oldangles[i][0] = newangle[0]
                    
g_oldangles[i][1] = newangle[1]
                    
g_oldangles[i][2] = newangle[2]
                    
g_afktime[i] = 0
                
}
            }
        }
    }
}


public 
check_afktime(id
{
    new 
afkTimeTmp get_pcvar_nummaxAfkTime ), afkTimeLeftkickOrSpect
    
    
static punishName[17]
    
    
afkTimeLeft afkTimeTmp g_afktime[id]
    
    if ( 
afkTimeLeft <= get_pcvar_num(warning_time) ) 
    {    
        if( ( 
get_pcvar_num(kick) || get_playersnum() > get_pcvar_num(kickPlayers) ) && checkImmunity(id) )
        {
            
kickOrSpect=1
            punishName
="expulsado"
        
}
        else
        {
            
kickOrSpect=0
            punishName
="enviado a spec"
        
}
        
        if(
afkTimeLeft>0)
        {
            
set_hudmessage(0100200, -1.00.2510.13.00.050.05, -1)
            
ShowSyncHudMsgidmsgSync"Tenes %d segundos para moverte o seras %s por estar AFK"afkTimeLeftpunishName )
        }
    } 
    
    if( 
g_afktime[id] >= afkTimeTmp 
    {
        if( 
kickOrSpect==)
            
punish_player(idPUNISH_AFK_KICK )    
        else
            
punish_player(idPUNISH_AFK_SPECTATOR )
        
        
g_afktime[id]=0
    
}
}


public 
client_disconnect(id)
{    
    
g_afktime[id] = 0
    selectedNoModel
[id]= false    
}


//a player connected so we must find and kick a spectator if there are any
public client_putinserver(id
{
    if( 
is_user_bot(id) || is_user_hltv(id) )
        return
    
    if( 
checkImmunity(id) )
    {
        new 
arrId[1]
        
arrId[0] = id
        set_task
get_pcvar_floatunassignedTime ), "check_unassigned"id+40arrId)
    }
    
    if( 
get_playersnum() > get_pcvar_num(kickPlayers) )
    {
        for( new 
i=1i<=maxplayersi++ )
        {
            if( 
is_user_connected(i) && fm_get_user_team(i) == CS_TEAM_SPECTATOR && checkImmunity(i) )
            {
                
punish_playeriPUNISH_SPECTATOR )
                break
            }
        }
    }
}


public 
check_unassignedarrId[] )
{
    new 
id=arrId[0]
    
    
//if the player is unassigned after x seconds then kick him
    
if( is_user_connected(id) && fm_get_user_teamid ) == CS_TEAM_UNASSIGNED )
        
punish_playeridPUNISH_UNASSIGNED )
}


public 
playerSpawned(arrId[]) 
{
    new 
id=arrId[0]
    
get_user_originidg_oldangles[id] )
    
player_spawned[id] = true
}


stock punish_playeridpunishType )
{
    static 
name[32]
    
get_user_name(idname31)
    
    switch(
punishType)
    {
        case 
PUNISH_UNASSIGNED
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar sin team por mas de %d segundos"nameget_pcvar_num(unassignedTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar sin asignacion por mas de %d segundos.^""get_user_userid(id ), get_pcvar_num(unassignedTime) )    
        }
        case 
PUNISH_SPECTATOR
        {
            
client_print0print_chat"[ SIG ] %s fue expulsado por estar spec en el servidor con mas de %d jugadores en linea"nameget_pcvar_num(kickPlayers) )
            
server_cmd"kick #%d ^"El servidor esta muy lleno como para permitir espectadores.^""get_user_userid(id) )
        }
        case 
PUNISH_AFK_KICK:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar AFK mas de %d segundos.^""get_user_userid(id), get_pcvar_num(maxAfkTime) )
        }
        case 
PUNISH_AFK_SPECTATOR:
        {
            
client_print(0print_chat"[ SIG ] %s fue enviado a spec por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
user_silentkill(id)
            
fm_set_user_teamidCS_TEAM_SPECTATOR )
        }
        case 
PUNISH_NOMODEL:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por unirse a un team y quedarse AFK sin elegir modelo"name )
            
server_cmd("kick #%d ^"Fuiste expulsado por unirse a un team y quedarse AFK sin elegir modelo.^""get_user_userid(id) )
        }
    }
}


public 
checkImmunity(id)
{
    
//if immunity is disabled
    
if( get_pcvar_num(aImmunity)==)
        return 
true
    
//admin has AFK_IMMUNITY flag
    
else if( get_user_flags(id) & AFK_IMMUNITY && TEAM_IMMUNITY
        return 
false
    
    
return true    
}


stock fm_set_user_team(idCsTeams:team)
{
    
set_pdata_int(idOFFSET_TEAM_:team)

    
dllfunc(DLLFunc_ClientUserInfoChangedid)

    static 
teaminfo[12], iMsgid_TeamInfo
    
switch(team)
    {
        case 
CS_TEAM_UNASSIGNED
            
teaminfo="UNASSIGNED"
        
case CS_TEAM_T
            
teaminfo="TERRORIST"
        
case CS_TEAM_CT
            
teaminfo="CT"
        
case CS_TEAM_SPECTATOR
            
teaminfo="SPECTATOR"
    
}

    if(!
iMsgid_TeamInfo)
        
iMsgid_TeamInfo get_user_msgid("TeamInfo")
    
    
message_begin(MSG_ALLiMsgid_TeamInfo)
    
write_byte(id)
    
write_string(teaminfo)
    
message_end()
}


stock CsTeams:fm_get_user_team(id)
    return 
CsTeams:get_pdata_int(idOFFSET_TEAM
WORKED, thanks!
sigerman is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 11-28-2014 , 00:17   Re: [req] Edit a small thing in afk plugin
Reply With Quote #9

Quote:
Originally Posted by Fuck For Fun View Post
Lines:
PHP Code:
         case PUNISH_AFK_KICK:
        {
            
client_print(0print_chat"[ SIG ] %s fue expulsado por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
server_cmd("kick #%d ^"Fuiste expulsado por estar AFK mas de %d segundos.^""get_user_userid(id), get_pcvar_num(maxAfkTime) )
        }
        case 
PUNISH_AFK_SPECTATOR:
        {
            
client_print(0print_chat"[ SIG ] %s fue enviado a spec por estar AFK mas de %d segundos"nameget_pcvar_num(maxAfkTime) )
            
user_silentkill(id)
            
fm_set_user_teamidCS_TEAM_SPECTATOR )
        } 

Thanks for your help!
sigerman is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-02-2014 , 21:26   Re: [req] Edit a small thing in afk plugin
Reply With Quote #10

Is it posible to remove the function : punish_nomodel
So the people who didn't choose a model won't be kicked.
Please
sigerman is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:50.


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