Raised This Month: $51 Target: $400
 12% 

Afk TO Spectator !


Post New Thread Reply   
 
Thread Tools Display Modes
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 04-10-2014 , 22:01   Re: Afk TO Spectator !
Reply With Quote #11

Quote:
Originally Posted by Flick3rR View Post
Oooops! Really sorry, I've missed to kill the user, and then to transfer him to spectator, because now he goes to spectator, but still alive and killing both teams Sorry again, here is the fixed version! Oh, and I've changed the chat messages. Didn't find other bugs, if you do, share it!
It's really a good plugin at all and I am using it in my server with no problems.

CVARS:
mp_afktime 90 - This sets the time a player must be AFK (while alive) before he is transfered to Specatator team.
mp_afkminplayers 8 This is number of players required on the server before people will be transfered to Spectator team for being AFK.
I'm using the other one, it's working well for me thanks
AMeEeRo is offline
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 05-14-2014 , 09:32   Re: Afk TO Spectator !
Reply With Quote #12

Quote:
Originally Posted by Flick3rR View Post
Oooops! Really sorry, I've missed to kill the user, and then to transfer him to spectator, because now he goes to spectator, but still alive and killing both teams Sorry again, here is the fixed version! Oh, and I've changed the chat messages. Didn't find other bugs, if you do, share it!
It's really a good plugin at all and I am using it in my server with no problems.

CVARS:
mp_afktime 90 - This sets the time a player must be AFK (while alive) before he is transfered to Specatator team.
mp_afkminplayers 8 This is number of players required on the server before people will be transfered to Spectator team for being AFK.
Well i don't want log and i don't want message for him and cvars and all of that is i just one simple one, what i posted is working but some times it don't
AMeEeRo is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-14-2014 , 10:37   Re: Afk TO Spectator !
Reply With Quote #13

Later will remove the useless stuff. Aand, no reason for not working at all, but I'll take another look later.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 05-14-2014 , 12:16   Re: Afk TO Spectator !
Reply With Quote #14

Quote:
Originally Posted by Flick3rR View Post
Later will remove the useless stuff. Aand, no reason for not working at all, but I'll take another look later.
Well, i know you always help thanks for you !
You just gave me the base !
I mean i edited it
And removed that logs it's easy to edit a small things in a plugin, i just want know message for all like the one that i shared i mean
[AMXX] Flick3rR was put in spec for being afk more than 60 seconds..
Just this print for all i didn't know how tell me where to add it and big thanks
AMeEeRo is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-14-2014 , 14:00   Re: Afk TO Spectator !
Reply With Quote #15

Here is your simple one. I've removed the minplayers option, and just left a variable to change the afk time - it's maxafktime, and in the code, it is set to 90. You can change it. Here is the code:
PHP Code:
#include <amxmodx>
#include <cstrike>

#define WARNING_TIME 15        // Start warning the user this many seconds before they are about to be trasfered to spectator.
#define CHECK_FREQ 5        // This is also the warning message frequency.

new g_oldangles[33][3]
new 
g_afktime[33]
new 
bool:g_spawned[33] = {true, ...}

public 
plugin_init() {
    
register_plugin("AFK Kicker","1.0b","Cheesy Peteza"
    
register_cvar("afk_version""1.0b"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

    
set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
    
register_event("ResetHUD""playerSpawned""be")
}

public 
checkPlayers() {
    for (new 
1<= get_maxplayers(); i++) {
        if (
is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) {
            new 
newangle[3]
            
get_user_origin(inewangle)

            if ( 
newangle[0] == g_oldangles[i][0] && newangle[1] == g_oldangles[i][1] && newangle[2] == g_oldangles[i][2] ) {
                
g_afktime[i] += CHECK_FREQ
                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
            
}
        }
    }
    return 
PLUGIN_HANDLED
}

check_afktime(id) {
    new 
maxafktime 90

    
if (g_afktime[id] > maxafktime) {
        new 
name[32]
        
get_user_name(idname31)
        
client_print(0print_chat,"%s was trasfered to spectator for being AFK longer than %i seconds"namemaxafktime)
        
user_kill(id1)
        
cs_set_user_team(idCS_TEAM_SPECTATOR
    }
    
}

public 
client_connect(id
    
g_afktime[id] = 0

public client_putinserver(id)
    
g_afktime[id] = 0

public playerSpawned(id) {
    
g_spawned[id] = false
    
new sid[1]
    
sid[0] = id
    set_task
(0.75"delayedSpawn",_sid1)    // Give the player time to drop to the floor when spawning
    
return PLUGIN_HANDLED
}

public 
delayedSpawn(sid[]) {
    
get_user_origin(sid[0], g_oldangles[sid[0]])
    
g_spawned[sid[0]] = true
    
return PLUGIN_HANDLED

__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 05-15-2014 , 02:45   Re: Afk TO Spectator !
Reply With Quote #16

Quote:
Originally Posted by Flick3rR View Post
Here is your simple one. I've removed the minplayers option, and just left a variable to change the afk time - it's maxafktime, and in the code, it is set to 90. You can change it. Here is the code:
PHP Code:
#include <amxmodx>
#include <cstrike>

#define WARNING_TIME 15        // Start warning the user this many seconds before they are about to be trasfered to spectator.
#define CHECK_FREQ 5        // This is also the warning message frequency.

new g_oldangles[33][3]
new 
g_afktime[33]
new 
bool:g_spawned[33] = {true, ...}

public 
plugin_init() {
    
register_plugin("AFK Kicker","1.0b","Cheesy Peteza"
    
register_cvar("afk_version""1.0b"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

    
set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
    
register_event("ResetHUD""playerSpawned""be")
}

public 
checkPlayers() {
    for (new 
1<= get_maxplayers(); i++) {
        if (
is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) {
            new 
newangle[3]
            
get_user_origin(inewangle)

            if ( 
newangle[0] == g_oldangles[i][0] && newangle[1] == g_oldangles[i][1] && newangle[2] == g_oldangles[i][2] ) {
                
g_afktime[i] += CHECK_FREQ
                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
            
}
        }
    }
    return 
PLUGIN_HANDLED
}

check_afktime(id) {
    new 
maxafktime 90

    
if (g_afktime[id] > maxafktime) {
        new 
name[32]
        
get_user_name(idname31)
        
client_print(0print_chat,"%s was trasfered to spectator for being AFK longer than %i seconds"namemaxafktime)
        
user_kill(id1)
        
cs_set_user_team(idCS_TEAM_SPECTATOR
    }
    
}

public 
client_connect(id
    
g_afktime[id] = 0

public client_putinserver(id)
    
g_afktime[id] = 0

public playerSpawned(id) {
    
g_spawned[id] = false
    
new sid[1]
    
sid[0] = id
    set_task
(0.75"delayedSpawn",_sid1)    // Give the player time to drop to the floor when spawning
    
return PLUGIN_HANDLED
}

public 
delayedSpawn(sid[]) {
    
get_user_origin(sid[0], g_oldangles[sid[0]])
    
g_spawned[sid[0]] = true
    
return PLUGIN_HANDLED

Thanks a lot !
Any bug found i will post thanks a lot i hope if all here like you, it's rare to find a helper good ppl for free here xD
AMeEeRo is offline
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 05-19-2014 , 05:43   Re: Afk TO Spectator !
Reply With Quote #17

Quote:
Originally Posted by Flick3rR View Post
Here is your simple one. I've removed the minplayers option, and just left a variable to change the afk time - it's maxafktime, and in the code, it is set to 90. You can change it. Here is the code:
PHP Code:
#include <amxmodx>
#include <cstrike>

#define WARNING_TIME 15        // Start warning the user this many seconds before they are about to be trasfered to spectator.
#define CHECK_FREQ 5        // This is also the warning message frequency.

new g_oldangles[33][3]
new 
g_afktime[33]
new 
bool:g_spawned[33] = {true, ...}

public 
plugin_init() {
    
register_plugin("AFK Kicker","1.0b","Cheesy Peteza"
    
register_cvar("afk_version""1.0b"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

    
set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
    
register_event("ResetHUD""playerSpawned""be")
}

public 
checkPlayers() {
    for (new 
1<= get_maxplayers(); i++) {
        if (
is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) {
            new 
newangle[3]
            
get_user_origin(inewangle)

            if ( 
newangle[0] == g_oldangles[i][0] && newangle[1] == g_oldangles[i][1] && newangle[2] == g_oldangles[i][2] ) {
                
g_afktime[i] += CHECK_FREQ
                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
            
}
        }
    }
    return 
PLUGIN_HANDLED
}

check_afktime(id) {
    new 
maxafktime 90

    
if (g_afktime[id] > maxafktime) {
        new 
name[32]
        
get_user_name(idname31)
        
client_print(0print_chat,"%s was trasfered to spectator for being AFK longer than %i seconds"namemaxafktime)
        
user_kill(id1)
        
cs_set_user_team(idCS_TEAM_SPECTATOR
    }
    
}

public 
client_connect(id
    
g_afktime[id] = 0

public client_putinserver(id)
    
g_afktime[id] = 0

public playerSpawned(id) {
    
g_spawned[id] = false
    
new sid[1]
    
sid[0] = id
    set_task
(0.75"delayedSpawn",_sid1)    // Give the player time to drop to the floor when spawning
    
return PLUGIN_HANDLED
}

public 
delayedSpawn(sid[]) {
    
get_user_origin(sid[0], g_oldangles[sid[0]])
    
g_spawned[sid[0]] = true
    
return PLUGIN_HANDLED

Found a bug !
Cuz this plugin made for kick not transfer maybe...
My bug, after player get transferred for being afk, and after he rejoin team, when he spawn, the plugin transfer him again
Please fix this only bug and thanks
AMeEeRo is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-19-2014 , 13:11   Re: Afk TO Spectator !
Reply With Quote #18

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich>

#define WARNING_TIME 15        // Start warning the user this many seconds before they are about to be trasfered to spectator. 
#define CHECK_FREQ 5        // This is also the warning message frequency. 

new g_oldangles[33][3
new 
g_afktime[33
new 
bool:g_spawned[33] = {true, ...} 
new 
bool:Transferred[33]

public 
plugin_init() { 
    
register_plugin("AFK Kicker","1.0b","Cheesy Peteza")  
    
register_cvar("afk_version""1.0b"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY

    
set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b"
    
RegisterHam(Ham_Spawn,"player""playerSpawned"1
    
register_clcmd("chooseteam""TeamChoose")


public 
TeamChoose(id)    Transferred[id] = false

public checkPlayers() { 
    for (new 
1<= get_maxplayers(); i++) { 
        if (
is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) { 
            new 
newangle[3
            
get_user_origin(inewangle

            if ( 
newangle[0] == g_oldangles[i][0] && newangle[1] == g_oldangles[i][1] && newangle[2] == g_oldangles[i][2] ) { 
                
g_afktime[i] += CHECK_FREQ 
                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] = 
            

        } 
    } 
    return 
PLUGIN_HANDLED 


check_afktime(id) { 
    new 
maxafktime 90 

    
if (g_afktime[id] > maxafktime && g_spawned[id] && !Transferred[id]) { 
        new 
name[32
        
get_user_name(idname31
        
client_print(0print_chat,"%s was trasfered to spectator for being AFK longer than %i seconds"namemaxafktime
        
user_kill(id1
        
Transferred[id] = true
        cs_set_user_team
(idCS_TEAM_SPECTATOR)  
    } 
     


public 
client_connect(id)  
    
g_afktime[id] = 

public client_putinserver(id
    
g_afktime[id] = 

public playerSpawned(id) { 
    
g_spawned[id] = false 
    Transferred
[id] = false
    
new sid[1
    
sid[0] = id 
    set_task
(0.75"delayedSpawn",_sid1)    // Give the player time to drop to the floor when spawning 
    
return PLUGIN_HANDLED 


public 
delayedSpawn(sid[]) { 
    
get_user_origin(sid[0], g_oldangles[sid[0]]) 
    
g_spawned[sid[0]] = true 
    
return PLUGIN_HANDLED 

Try this one. I've also changed the ResetHud with Ham_Spawn, idk why.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 05-20-2014 , 05:14   Re: Afk TO Spectator !
Reply With Quote #19

Quote:
Originally Posted by Flick3rR View Post
PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich>

#define WARNING_TIME 15        // Start warning the user this many seconds before they are about to be trasfered to spectator. 
#define CHECK_FREQ 5        // This is also the warning message frequency. 

new g_oldangles[33][3
new 
g_afktime[33
new 
bool:g_spawned[33] = {true, ...} 
new 
bool:Transferred[33]

public 
plugin_init() { 
    
register_plugin("AFK Kicker","1.0b","Cheesy Peteza")  
    
register_cvar("afk_version""1.0b"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY

    
set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b"
    
RegisterHam(Ham_Spawn,"player""playerSpawned"1
    
register_clcmd("chooseteam""TeamChoose")


public 
TeamChoose(id)    Transferred[id] = false

public checkPlayers() { 
    for (new 
1<= get_maxplayers(); i++) { 
        if (
is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) { 
            new 
newangle[3
            
get_user_origin(inewangle

            if ( 
newangle[0] == g_oldangles[i][0] && newangle[1] == g_oldangles[i][1] && newangle[2] == g_oldangles[i][2] ) { 
                
g_afktime[i] += CHECK_FREQ 
                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] = 
            

        } 
    } 
    return 
PLUGIN_HANDLED 


check_afktime(id) { 
    new 
maxafktime 90 

    
if (g_afktime[id] > maxafktime && g_spawned[id] && !Transferred[id]) { 
        new 
name[32
        
get_user_name(idname31
        
client_print(0print_chat,"%s was trasfered to spectator for being AFK longer than %i seconds"namemaxafktime
        
user_kill(id1
        
Transferred[id] = true
        cs_set_user_team
(idCS_TEAM_SPECTATOR)  
    } 
     


public 
client_connect(id)  
    
g_afktime[id] = 

public client_putinserver(id
    
g_afktime[id] = 

public playerSpawned(id) { 
    
g_spawned[id] = false 
    Transferred
[id] = false
    
new sid[1
    
sid[0] = id 
    set_task
(0.75"delayedSpawn",_sid1)    // Give the player time to drop to the floor when spawning 
    
return PLUGIN_HANDLED 


public 
delayedSpawn(sid[]) { 
    
get_user_origin(sid[0], g_oldangles[sid[0]]) 
    
g_spawned[sid[0]] = true 
    
return PLUGIN_HANDLED 

Try this one. I've also changed the ResetHud with Ham_Spawn, idk why.
LoL you are going to bang my server xDD
Thanks added i will test and tell you like last time thanks a lot <3
AMeEeRo is offline
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 05-20-2014 , 05:53   Re: Afk TO Spectator !
Reply With Quote #20

Quote:
Originally Posted by Flick3rR View Post
PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich>

#define WARNING_TIME 15        // Start warning the user this many seconds before they are about to be trasfered to spectator. 
#define CHECK_FREQ 5        // This is also the warning message frequency. 

new g_oldangles[33][3
new 
g_afktime[33
new 
bool:g_spawned[33] = {true, ...} 
new 
bool:Transferred[33]

public 
plugin_init() { 
    
register_plugin("AFK Kicker","1.0b","Cheesy Peteza")  
    
register_cvar("afk_version""1.0b"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY

    
set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b"
    
RegisterHam(Ham_Spawn,"player""playerSpawned"1
    
register_clcmd("chooseteam""TeamChoose")


public 
TeamChoose(id)    Transferred[id] = false

public checkPlayers() { 
    for (new 
1<= get_maxplayers(); i++) { 
        if (
is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) { 
            new 
newangle[3
            
get_user_origin(inewangle

            if ( 
newangle[0] == g_oldangles[i][0] && newangle[1] == g_oldangles[i][1] && newangle[2] == g_oldangles[i][2] ) { 
                
g_afktime[i] += CHECK_FREQ 
                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] = 
            

        } 
    } 
    return 
PLUGIN_HANDLED 


check_afktime(id) { 
    new 
maxafktime 90 

    
if (g_afktime[id] > maxafktime && g_spawned[id] && !Transferred[id]) { 
        new 
name[32
        
get_user_name(idname31
        
client_print(0print_chat,"%s was trasfered to spectator for being AFK longer than %i seconds"namemaxafktime
        
user_kill(id1
        
Transferred[id] = true
        cs_set_user_team
(idCS_TEAM_SPECTATOR)  
    } 
     


public 
client_connect(id)  
    
g_afktime[id] = 

public client_putinserver(id
    
g_afktime[id] = 

public playerSpawned(id) { 
    
g_spawned[id] = false 
    Transferred
[id] = false
    
new sid[1
    
sid[0] = id 
    set_task
(0.75"delayedSpawn",_sid1)    // Give the player time to drop to the floor when spawning 
    
return PLUGIN_HANDLED 


public 
delayedSpawn(sid[]) { 
    
get_user_origin(sid[0], g_oldangles[sid[0]]) 
    
g_spawned[sid[0]] = true 
    
return PLUGIN_HANDLED 

Try this one. I've also changed the ResetHud with Ham_Spawn, idk why.
No same
No need for ham, just ask for help or think, after transfer, and rejoin get transfered before 60 seconds
AMeEeRo 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 18:09.


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