Raised This Month: $ Target: $400
 0% 

Afk TO Spectator !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 04-04-2014 , 16:05   Afk TO Spectator !
Reply With Quote #1

Hello, i always wanted to have this plugin
https://forums.alliedmods.net/showpo...52&postcount=2
PHP Code:
#include <amxmodx>
#include <cstrike>

// AFK Task offset
const afk_task 4000

// pcvars
new cvar_afktime
new cvar_afkimmunity

// player origins
new last_origins[33]

public 
plugin_init()
{   
    
register_plugin("AFK to Spectator""0.1""MeRcyLeZZ")
    
    
// AFK time in seconds, before player is transferred
    
cvar_afktime register_cvar("amx_afktime""40")
    
// Admin immunity?
    
cvar_afkimmunity register_cvar("amx_afkimmunity""1")
}

public 
client_putinserver(id)
{
    
remove_task(id+afk_task)
    
set_task(get_pcvar_float(cvar_afktime), "check_afk"id+afk_task)
}

public 
client_disconnect(id)
{
    
remove_task(id+afk_task)
}

public 
check_afk(taskid)
{   
    new 
id taskid afk_task;
    
    if (!
is_user_alive(id))
    {
        
set_task(get_pcvar_float(cvar_afktime), "check_afk"taskid)
        return;
    }
    
    new 
origin[3// get origin
    
get_user_origin(idorigin)
    
    if (
origin[0] == last_origins[id][0] && origin[1] == last_origins[id][1] && origin[2] == last_origins[id][2])
    {
        if (
get_user_flags(id) & ADMIN_IMMUNITY && get_pcvar_num(cvar_afkimmunity))
        {
            
client_print(idprint_chat"[AMXX AFK] You have immunity. You won't be transferred.")
        }
        else
        {
            new 
name[32]
            
get_user_nameid name sizeof name 1)
            
client_print(0print_chat"[AMXX AFK] %s has been transferred to the Spectator Team.",name)
            
user_kill(id1)
            
cs_set_user_team(idCS_TEAM_SPECTATOR)
        }
    }
    
    
// save new origin
    
last_origins[id][0] = origin[0]
    
last_origins[id][1] = origin[1]
    
last_origins[id][2] = origin[2]
    
    
set_task(get_pcvar_float(cvar_afktime), "check_afk"taskid// keep checking

Error when compile
I hate hobo_afk cuz it has many things i don't need !
I need simple afk never find approved plugin for it..
So i posted in this forum
To fix this code or to help me with better one...
Simple afk to spec after 60 secs i don't care for immunity
Thanks

Last edited by YamiKaitou; 04-04-2014 at 16:19.
AMeEeRo is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-04-2014 , 16:11   Re: Afk TO Spectator !
Reply With Quote #2

This is not the request forum.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 04-04-2014 , 16:16   Re: Afk TO Spectator !
Reply With Quote #3

Quote:
Originally Posted by wickedd View Post
This is not the request forum.
Thought it's not req hh ok ty.
AMeEeRo is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-04-2014 , 16:18   Re: Afk TO Spectator !
Reply With Quote #4

Quote:
Originally Posted by AMeEeRo View Post
Thought it's not req hh ok ty.
But it is, you are requesting someone to fix it for you
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 04-05-2014 , 05:54   Re: Afk TO Spectator !
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
But it is, you are requesting someone to fix it for you
Yeah, not me who made it but it didn't work
And i told you i want very simple plugin no cvars just afk to spec even if other code and thanks
AMeEeRo is offline
wTf.
Senior Member
Join Date: Aug 2011
Location: This important?
Old 04-05-2014 , 17:47   Re: Afk TO Spectator !
Reply With Quote #6

PHP Code:
// player origins
new last_origins[33
->

PHP Code:
// player origins
new last_origins[33][33
wTf. is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-05-2014 , 19:41   Re: Afk TO Spectator !
Reply With Quote #7

Hey! I think that this will help you! I got the code from this topic: https://forums.alliedmods.net/showth...light=afk+spec
and simply changed:
PHP Code:
server_cmd("kick #%d ^"You were kicked for being AFK longer than %i seconds^""get_user_userid(id), maxafktime
with
PHP Code:
cs_set_user_team(idCS_TEAM_SPECTATOR
If there are some bugs, share!
CVAR:
PHP Code:
mp_afktime <num> [default: 90] (The time for being AFK
Attached Files
File Type: sma Get Plugin or Get Source (AFKtoSpec.sma - 843 views - 3.5 KB)

Last edited by Flick3rR; 04-05-2014 at 19:41.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 04-06-2014 , 05:48   Re: Afk TO Spectator !
Reply With Quote #8

Quote:
Originally Posted by wTf. View Post
PHP Code:
// player origins
new last_origins[33
->

PHP Code:
// player origins
new last_origins[33][33
Thanks ♥
AMeEeRo is offline
AMeEeRo
BANNED
Join Date: Dec 2013
Location: Who care ?
Old 04-06-2014 , 05:51   Re: Afk TO Spectator !
Reply With Quote #9

Quote:
Originally Posted by Flick3rR View Post
Hey! I think that this will help you! I got the code from this topic: https://forums.alliedmods.net/showth...light=afk+spec
and simply changed:
PHP Code:
server_cmd("kick #%d ^"You were kicked for being AFK longer than %i seconds^""get_user_userid(id), maxafktime
with
PHP Code:
cs_set_user_team(idCS_TEAM_SPECTATOR
If there are some bugs, share!
CVAR:
PHP Code:
mp_afktime <num> [default: 90] (The time for being AFK
You are sure it's good plugin ?
That plugin is working well now, if bugs i will test your's ;)
AMeEeRo is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-06-2014 , 10:08   Re: Afk TO Spectator !
Reply With Quote #10

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.
Attached Files
File Type: sma Get Plugin or Get Source (AFKSpec.sma - 622 views - 3.6 KB)

Last edited by Flick3rR; 04-06-2014 at 10:11.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
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 06:03.


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