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

PhAFK Manager


Post New Thread Reply   
 
Thread Tools Display Modes
zaludan
Member
Join Date: Aug 2012
Old 12-07-2013 , 11:09   Re: PhAFK Manager
Reply With Quote #11

OK, thanks.
I'll try it and report back how it works
zaludan is offline
zaludan
Member
Join Date: Aug 2012
Old 12-07-2013 , 13:21   Re: PhAFK Manager
Reply With Quote #12

It keeps giving me badload:

L 12/07/2013 - 19:10:08: [AMXX] Plugin file open error (plugin "PhAFK.amxx")

Any idea?
zaludan is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-07-2013 , 19:44   Re: PhAFK Manager
Reply With Quote #13

Quote:
Originally Posted by zaludan View Post
It keeps giving me badload:

L 12/07/2013 - 19:10:08: [AMXX] Plugin file open error (plugin "PhAFK.amxx")

Any idea?
You compile and install plugin correctly?
This is default AMXX error in case if file of plugin ("PhAFK.amxx") not found (or broken).
Check file, it's looks like file does not exist.
Phant is offline
Send a message via ICQ to Phant
zaludan
Member
Join Date: Aug 2012
Old 12-08-2013 , 05:20   Re: PhAFK Manager
Reply With Quote #14

I downloaded amxx file - I hardly ever compile locally.
Since it doesn't need any "includes" it should be OK?
zaludan is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-08-2013 , 14:15   Re: PhAFK Manager
Reply With Quote #15

Quote:
Originally Posted by zaludan View Post
I downloaded amxx file - I hardly ever compile locally.
Since it doesn't need any "includes" it should be OK?
My god, I forgot about Fakemeta INClude . You can download it here.
Sorry for that. I add "Includes" paragraph in first post message (and reupload SMA).
Phant is offline
Send a message via ICQ to Phant
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-08-2013 , 16:13   Re: PhAFK Manager
Reply With Quote #16

fakemeta_util is included with AMXX, plus you shouldn't really be using it
__________________
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
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 01-03-2014 , 03:47   Re: PhAFK Manager
Reply With Quote #17

Quote:
Originally Posted by YamiKaitou View Post
fakemeta_util is included with AMXX
You're right. It's strange, fakemeta_util exist in "amxmodx-1.8.2-base", but not in my installed AMXX on CS 1.6 (I downloaded it) . No matter.

PS:
Code updated (1 string added). Added zeroing AFK state for Player, when he join in Team (skin selected).
Phant is offline
Send a message via ICQ to Phant
strikegino
Member
Join Date: Mar 2013
Old 01-27-2014 , 07:23   Re: PhAFK Manager
Reply With Quote #18

wat i need to change to
afk_immunity_spec "1" — Enable/Disable immunity (ADMIN_IMMUNITY) for spectators.
afk_immunity "1" — Enable/Disable immunity (ADMIN_RCON) for kick.

to be for all admin, no oly admin_rcon

i want imuniti to kick for all admin
strikegino is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 01-27-2014 , 09:18   Re: PhAFK Manager
Reply With Quote #19

For do that you need to edit two conditions on 264 and 292 strings (lines). Try:
PHP Code:
if(cv_immunity == && access(idADMIN_ADMIN)) 
PHP Code:
if((team == CS_TEAM_SPECTATOR) && (access(idADMIN_ADMIN)) && (cv_spec_immunity == 1)) 
Code:
ADMIN_ALL          //Everyone
ADMIN_IMMUNITY     //Flag "a", immunity
ADMIN_RESERVATION  //Flag "b", reservation
ADMIN_KICK         //Flag "c", kick
ADMIN_BAN          //Flag "d", ban
ADMIN_SLAY         //Flag "e", slay
ADMIN_MAP          //Flag "f", map change
ADMIN_CVAR         //Flag "g", cvar change
ADMIN_CFG          //Flag "h", config execution
ADMIN_CHAT         //Flag "i", chat
ADMIN_VOTE         //Flag "j", vote
ADMIN_PASSWORD     //Flag "k", sv_password
ADMIN_RCON         //Flag "l", rcon access
ADMIN_LEVEL_A      //Flag "m", custom
ADMIN_LEVEL_B      //Flag "n", custom
ADMIN_LEVEL_C      //Flag "o", custom
ADMIN_LEVEL_D      //Flag "p", custom
ADMIN_LEVEL_E      //Flag "q", custom
ADMIN_LEVEL_F      //Flag "r", custom
ADMIN_LEVEL_G      //Flag "s", custom
ADMIN_LEVEL_H      //Flag "t", custom
ADMIN_MENU         //Flag "u", menus
ADMIN_ADMIN        //Flag "y", default admin
ADMIN_USER         //Flag "z", default user

Last edited by Phant; 01-27-2014 at 12:24.
Phant is offline
Send a message via ICQ to Phant
strikegino
Member
Join Date: Mar 2013
Old 01-28-2014 , 07:47   Re: PhAFK Manager
Reply With Quote #20

Code:
/*
    PhAFK Manager, AMX Mod X Plugin
    Copyright (C) 2013  Phantomas

    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 3 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
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#tryinclude <fakemeta_util>
#if !defined _fakemeta_util_included
        #assert Fakemeta Utilities function library required! Read the below instructions:   \
                1. Download it at forums.alliedmods.net/showthread.php?t=28284   \
                2. Put it into amxmodx/scripting/include/ folder   \
                3. Compile this plugin locally, details: wiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                4. Install compiled plugin, details: wiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif

#include <hamsandwich>
#include <cstrike>

#define PLUGIN "PhAFK Manager"
#define AUTHOR "Phantomas"
#define VERSION "1.2"

#define PREFIX "[AFK] "
 
 // Tasks IDs
#define TASK_AFK_CHECK 0
#define TASK_DROP_DOWN 1

// Some frequences
#define FREQ_AFK_CHECK 5.0
#define DROP_DOWN_TIME 1.0
#define WARNING_MESSAGE_MODULO 2

#define BE_AFK_TIME 10.0
#define GLOBAL_MESSAGE_FREQ 5.0

// Customization
#define ANGLES_SUPPORT
#define AFK_SPEC_IMMUNITY ADMIN_ADMIN
#define AFK_IMMUNITY ADMIN_ADMIN

// Users Individual
#if defined ANGLES_SUPPORT
new Float:g_angles[33][3]
#endif
new Float:g_origin[33][3]
new bool:g_in_class_choose[33]
new bool:g_in_afk[33]
new g_afk_ticks[33]

// Other
new Float:g_last_global_message
new bool:g_disable_alive_check

// CVARS
new cv_kick_time
new cv_spec_time
new cv_bomb
new cv_bomb_drop_time
new cv_spec_immunity
new cv_immunity
new cv_global_message
new cv_min_players

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_dictionary("phafk.txt")
	
	register_event("HLTV", "start_round", "a", "1=0", "2=0")
	register_logevent("start_round_fr", 2, "1=Round_Start")
	register_event("30", "intermission", "a")
	
	register_message(96, "Message_ShowMenu")
	register_message(114, "Message_VGUIMenu")
	
	register_clcmd("joinclass", "class_selected")
	register_menucmd(register_menuid("Terrorist_Select", 1), 511, "class_selected")
	register_menucmd(register_menuid("CT_Select", 1), 511, "class_selected")
	
	register_cvar("afk_kick_time", "90")
	register_cvar("afk_spec_time", "0")
	register_cvar("afk_bomb_time", "15")
	register_cvar("afk_bomb", "2")
	register_cvar("afk_immunity_spec", "1")
	register_cvar("afk_immunity", "1")
	register_cvar("afk_global_message", "1")
	register_cvar("afk_min_players", "0")
	cv_kick_time = get_cvar_num("afk_kick_time")
	cv_spec_time = get_cvar_num("afk_spec_time")
	cv_bomb_drop_time = get_cvar_num("afk_bomb_time")
	cv_bomb = get_cvar_num("afk_bomb")
	cv_spec_immunity = get_cvar_num("afk_immunity_spec")
	cv_immunity = get_cvar_num("afk_immunity")
	cv_global_message = get_cvar_num("afk_global_message")
	cv_min_players = get_cvar_num("afk_min_players")
}

public intermission()
{
	remove_task(TASK_AFK_CHECK)
}

public Message_ShowMenu(iMsgId, iMsgDest, iReceiver)
{
	static szArg4[20]
	get_msg_arg_string(4, szArg4, charsmax(szArg4))
	if(equal(szArg4, "#Terrorist_Select", 17) || equal(szArg4, "#CT_Select", 10))
	{
		g_in_class_choose[iReceiver] = true
	}
	return PLUGIN_CONTINUE;
}
 
public Message_VGUIMenu(iMsgId, iMsgDest, iReceiver)
{
	static iArg1; iArg1 = get_msg_arg_int(1)
	if(iArg1 == 2)
	{
		g_in_class_choose[iReceiver] = true
	}
	return PLUGIN_CONTINUE;
}

public client_putinserver(id)
{
	g_in_class_choose[id] = false
	g_in_afk[id] = false
	g_afk_ticks[id] = 0
}

public class_selected(id)
{
	g_in_class_choose[id] = false
	client_putinserver(id)
}

public bomb_action(id, cv_bomb)
{
	if(cv_bomb == 1)
	{
		engclient_cmd(id, "drop", "weapon_c4")
		client_print(id, print_chat, "%s%L", PREFIX, LANG_SERVER, "BOMB_DROP")
	} else if(cv_bomb == 2) {
		new players[32], inum
		get_players(players, inum, "aeh", "TERRORIST")
		if(inum > 1)
		{
			new random_terrorist
			do
			{
				random_terrorist = players[random_num(0, inum - 1)]
			}
			while(random_terrorist == id)
			if(g_in_afk[random_terrorist] == false)
			{
				fm_transfer_user_gun(id, random_terrorist, CSW_C4)
				client_print(id, print_chat, "%s%L", PREFIX, LANG_SERVER, "BOMB_TRANSFERRED")
				client_print(random_terrorist, print_chat, "%s%L", PREFIX, LANG_SERVER, "BOMB_GOT")
			}
		}
	}
}

public afk_action(id, alive, CsTeams:team)
{
	g_afk_ticks[id]++
	
	if(g_afk_ticks[id] >= (BE_AFK_TIME / FREQ_AFK_CHECK))
	{
		g_in_afk[id] = true
	}
	
	if((g_afk_ticks[id] >= (cv_bomb_drop_time / FREQ_AFK_CHECK)) && (alive == 1) && (team == CS_TEAM_T) && (pev(id, pev_weapons) & (1 << CSW_C4)))
	{
		bomb_action(id, cv_bomb)
	}
	
	if((cv_kick_time != 0) && (g_afk_ticks[id] >= (cv_kick_time / FREQ_AFK_CHECK)))
	{
		//if(true)
		if(!(id == 1 && !is_dedicated_server()))
		{
			new name[32]
			get_user_name(id, name, sizeof name - 1)
			server_cmd("kick #%d ^"%L^"", get_user_userid(id), LANG_SERVER, "KICK_REASON")
			client_print(0, print_chat, "%s%L", PREFIX, LANG_SERVER, "KICKED_AFK", name)
			return 1
		}
	} else if((cv_spec_time != 0) && (team != CS_TEAM_SPECTATOR) && (g_afk_ticks[id] >= (cv_spec_time / FREQ_AFK_CHECK)) && (get_cvar_num("allow_spectators"))) {
		if(is_user_alive(id))
		{
			user_silentkill(id)
		}
		set_pdata_int(id, 125, get_pdata_int(id, 125, 5) & ~(1<<8), 5)
		engclient_cmd(id, "jointeam", "6")
		set_pdata_int(id, 125, get_pdata_int(id, 125, 5) & ~(1<<8), 5)
		new name[32]
		get_user_name(id, name, sizeof name - 1)
		client_print(0, print_chat, "%s%L", PREFIX, LANG_SERVER, "SPEC_TRANSFERRED", name)
	} else if((g_in_afk[id] == true) && (cv_kick_time != 0)) {
		if(g_afk_ticks[id] % WARNING_MESSAGE_MODULO == 0)
		{
			if(alive == 1)
			{
				client_print(id, print_chat, "%s%L", PREFIX, LANG_SERVER, "YOU_AFK")
			} else {
				client_print(id, print_chat, "%s%L", PREFIX, LANG_SERVER, "YOU_AFK_JOIN")
			}
		}
	}
	return 0
}

public send_global_message(ts_alive, cts_alive, ts_afks, cts_afks, Float:current_time)
{
	if(cv_global_message == 0)
	{
		return PLUGIN_HANDLED
	}
	
	if((current_time - g_last_global_message) < GLOBAL_MESSAGE_FREQ)
	{
		return PLUGIN_HANDLED
	}
	
	if(cts_afks > 0 && cts_alive == 0 && ts_alive > 0)
	{
		client_print(0, print_chat, "%s%L", PREFIX, LANG_SERVER, "ALL_CTS_AFK")
	}
	if(ts_afks > 0 && ts_alive == 0 && cts_alive > 0)
	{
		client_print(0, print_chat, "%s%L", PREFIX, LANG_SERVER, "ALL_TS_AFK")
	}
	g_last_global_message = current_time

	return PLUGIN_CONTINUE
}

public afk_check_player(id, Float:current_time, alive, CsTeams:team)
{
	if(alive)
	{
		if(g_disable_alive_check == true && alive == 1)
		{
			return 0
		}
		
		if(cv_immunity == 1 && access(id, ADMIN_ADMIN))
		{
			return 0
		}
		
		new Float:current_origin[3]
		pev(id, pev_origin, current_origin)
		
		#if defined ANGLES_SUPPORT
		new Float:current_angles[3]
		pev(id, pev_v_angle, current_angles)
		if((current_angles[0] == g_angles[id][0]) && (current_angles[1] == g_angles[id][1]) && (current_origin[0] == g_origin[id][0]) && (current_origin[1] == g_origin[id][1]) && (current_origin[2] == g_origin[id][2]))
		#else
		if((current_origin[0] == g_origin[id][0]) && (current_origin[2] == g_origin[id][2]) && (current_origin[2] == g_origin[id][2]))
		#endif
		{
			return afk_action(id, alive, team)
		} else {
			g_in_afk[id] = false
			g_afk_ticks[id] = 0
			g_origin[id] = current_origin
			#if defined ANGLES_SUPPORT
			g_angles[id] = current_angles
			#endif
		}
	} else {
		if((g_in_class_choose[id] == true) || (team == CS_TEAM_UNASSIGNED) || (team == CS_TEAM_SPECTATOR))
		{
			if((team == CS_TEAM_SPECTATOR) && (access(id, ADMIN_ADMIN)) && (cv_spec_immunity == 1))
			{
				return 0
			}
			return afk_action(id, alive, team)
		} else {
			g_in_afk[id] = false
		}
	}
	return 0
}

public afk_check()
{
	new Float:current_time = get_gametime()
	
	new CsTeams:team, alive
	new ts_num, cts_num
	new ts_num_afks, cts_num_afks
		
	new players[32], inum
	get_players(players, inum, "h")
	if(inum >= cv_min_players)
	{
		for(new i = 0; i < inum; ++i)
		{
			alive = is_user_alive(players[i])
			team = cs_get_user_team(players[i])
			if(afk_check_player(players[i], current_time, alive, team) == 0)
			{
				if(team == CS_TEAM_T)
				{
					if(alive == 1)
					{
						//ts_num++
						if(g_in_afk[players[i]] == true)
						{
							ts_num_afks++
						} else {
							ts_num++
						}
					}
				} else if(team == CS_TEAM_CT) {
					if(alive == 1)
					{
						//cts_num++
						if(g_in_afk[players[i]] == true)
						{
							cts_num_afks++
						} else {
							cts_num++
						}
					}
				}
			}
		}
		send_global_message(ts_num, cts_num, ts_num_afks, cts_num_afks, current_time)
	}
}

public start_round()
{
	g_disable_alive_check = true
	remove_task(TASK_DROP_DOWN)
	set_task(DROP_DOWN_TIME, "start_round_fr_action", TASK_DROP_DOWN)
}

public start_round_fr_action()
{
	new players[32], inum
	get_players(players, inum, "ha")
	for(new i = 0; i < inum; ++i)
	{
		new Float:current_origin[3]
		pev(players[i], pev_origin, current_origin)
		g_origin[players[i]] = current_origin
		#if defined ANGLES_SUPPORT
		new Float:current_angles[3]
		pev(players[i], pev_v_angle, current_angles)
		g_angles[players[i]] = current_angles
		#endif
	}
	g_disable_alive_check = false
}

public start_round_fr()
{
	if(!task_exists(TASK_AFK_CHECK))
	{
		set_task(FREQ_AFK_CHECK, "afk_check", TASK_AFK_CHECK, _, _, "b")
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
L 01/28/2014 - 14:49:19: [AMXX] Run time error 25: parameter error
L 01/28/2014 - 14:49:19: [AMXX] [0] PhAFK.sma::afk_action (line 201)
L 01/28/2014 - 14:49:19: [AMXX] [1] PhAFK.sma::afk_check_player (line 296)
L 01/28/2014 - 14:49:19: [AMXX] [2] PhAFK.sma::afk_check (line 320)
strikegino 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 02:06.


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