Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Rezerwacja slota na flage admina a


  • Zamknięty Temat jest zamknięty
8 odpowiedzi w tym temacie

#1 naven

    Hero

  • Power User

Reputacja: 200
Profesjonalista

  • Postów:1088
  • GG:
  • Imię:Adam
  • Lokalizacja:Cieszyn
Offline

Napisano 02.12.2008 17:38

Witam,
Mam na serwerze adminslots.amxx (oryginalnie w amxxie) i potrzebowałbym drugiego pluginu, który by kickował afk/speców i "wpuszczał" ludzi z admin_immunity, znalazlem taki kod, lecz nie jestem pewien, czy będzie on działał z dwoma pluginami na rezerwacje, dałoby się do niego dorobić rezerwacje slota na ADMIN_IMMUNITY i zeby byl inny cvar na wlaczanie(amx_res 1/0)
Z góry dzięki;p
/* AMX Mod X
*   Full Server Idler Kicker (+last AFK to Spec)
*
* (c) Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
*     DESCRIPTION
*       The concept of this plugin is "don't clean the full server from idlers unless
*       new connection try". By idlers i mean HLTV/unassigned/spectator/AFK users.
*       I created this plugin because i don't like the goal of all other plugins that
*       deal with idelrs using the conditions which is strictly based on the idle time.
*       This plugin isn't using the idle time as primary condition. So how it work?
*       Let's say the new user is trying to connect to the full server. Normally he
*       would be kicked unless he have a slot reservation access, but this plugin
*       able to clean the slot for this user if it will find the idler on the server.
*       Firstly it will try to find and kick HLTV (this can be disabled). Secondly -
*       the most idle unassigned/spectator user. Though the plugin will never kick
*       a client with immunity access (this can be configured) or the user who is just
*       connected and still unassigned - it will "immune" him for a few seconds
*       (this can be configured). And lastly the plugin will try to find and kick
*       the most idle alive AFK player (min. idle time that required to mark a player
*       as AFK can be configured). Also as a bonus feature the plugin able to detect
*       when all alive players in the same team are AFK. Usually it would be just
*       a single AFK player who is the only one alive player in a team. In this case
*       to avoid waiting/seaching AFK player(s) by other player(s) the plugin will move
*       him/them to the spectators. Later such AFK users can be kicked from Spectators
*       following the steeps that listed above. Requirement for full server kicker are
*       at least one free reserverved slot (controlled by amx_reservation AMXX's CVAR).
*/

#include <amxmodx>

#define PLUGIN_NAME "Full Server Idler Kicker"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

// OPTIONS BELOW

// comment to disable access check on kick
#define IMMUNE_SPEC_ACCESS ADMIN_IMMUNITY

// connected user's unassigned kick immunity time
#define IMMUNE_TIME_AFTER_CONNECT 5

// AFK check interval (seconds)
#define AFK_CHECK_INTERVAL 5

// max. allowed AFK time (seconds)
#define MAX_ALLOWED_AFK_TIME 45

// comment to disable HLTV kick
#define HLTV_KICK

#if defined HLTV_KICK
	new const g_hltv_kick_reason[] = "Sorry, HLTV isn't allowed on the full server"
#endif

// kick reasons
new const g_spec_kick_reason[] = "Sorry, spectating on the full server isn't allowed"
new const g_afk_kick_reason[]  = "You have been kicked for being AFK on the full server"

// AFK to Spectators transfer reason
new const g_afktospec_reason[] = "yYou have been transferred^n to the Spectators for being AFK"

// chat reasons
new const g_spec_kick_chat[] = "[AMXX] %s has been kicked for spectating on the full server"
new const g_afk_kick_chat[]  = "[AMXX] %s has been kicked for being AFK on the full server"
new const g_afktospec_chat[] = "[AMXX] %s has been transferred to the Spectators for being AFK"

// OPTIONS ABOVE

new const g_teamname[2][] = {"TERRORIST", "CT"}

#define MAX_PLAYERS 32
new bool:g_connected[MAX_PLAYERS + 1]
new g_origin[MAX_PLAYERS + 1][3]
new g_afktime[MAX_PLAYERS + 1]
new g_specgametime[MAX_PLAYERS + 1]

new g_maxplayers
new g_pcvar_reservation

public plugin_init() {
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

	register_event("TeamInfo", "event_spectate", "a", "2=UNASSIGNED", "2=SPECTATOR")
	register_event("TeamInfo", "event_playteam", "a", "2=TERRORIST", "2=CT")

	g_maxplayers = get_maxplayers()
	g_pcvar_reservation = get_cvar_pointer("amx_reservation")

	set_task(float(AFK_CHECK_INTERVAL), "task_afk_check", _, _, _, "b")
}

public client_connect(id) {
	g_connected[id] = true

	if (get_playersnum(1) <= g_maxplayers - get_pcvar_num(g_pcvar_reservation))
		return

#if defined HLTV_KICK
	if (is_user_hltv(id)) {
		client_kick(id, g_hltv_kick_reason)
		return
	}
#endif

	static players[32], num, i, tchar[2]
	new candidate, candidatetime
	get_players(players, num, "b")
	for (new x; x < num; ++x) {
		i = players[x]

#if defined IMMUNE_SPEC_ACCESS
		if (get_user_flags(i) & IMMUNE_SPEC_ACCESS)
			continue
#endif

		if (is_user_hltv(i)) {
#if defined HLTV_KICK
			client_kick(i, g_hltv_kick_reason)
			return
#else
			continue
#endif
		}

		get_user_team(i, tchar, 1)
		if (((tchar[0] == 'U' && get_user_time(i, 1) > IMMUNE_TIME_AFTER_CONNECT) || tchar[0] == 'S') && (!candidatetime || g_specgametime[i] < candidatetime)) {
			candidatetime = g_specgametime[i]
			candidate = i
		}
	}

	if (candidate) {
		chat_msg(candidate, g_spec_kick_chat)
		client_kick(candidate, g_spec_kick_reason)
		return
	}

	static origin[3], afktime
	get_players(players, num, "a")
	for (new x; x < num; ++x) {
		i = players[x]
		get_user_origin(i, origin)
		if (!is_user_afk(i, origin)) {
			g_afktime[i] = 0
			g_origin[i] = origin
			continue
		}

		afktime = g_afktime[i]
		if (afktime >= MAX_ALLOWED_AFK_TIME && afktime > candidatetime) {
			candidatetime = afktime
			candidate = i
		}
	}

	if (candidate) {
		chat_msg(candidate, g_afk_kick_chat)
		client_kick(candidate, g_afk_kick_reason)
	}
}

public task_afk_check() {
	static players[32], num, i, bool:allafk, origin[3]
	for (new a; a < 2; ++a) {
		get_players(players, num, "ae", g_teamname[a])
		allafk = true
		for (new x; x < num; ++x) {
			i = players[x]
			get_user_origin(i, origin)
			if (is_user_afk(i, origin)) {
				g_afktime[i] += AFK_CHECK_INTERVAL
				if (g_afktime[i] < MAX_ALLOWED_AFK_TIME)
					allafk = false
			}
			else {
				g_afktime[i] = 0
				g_origin[i] = origin
				allafk = false
			}
		}

		if (!allafk)
			continue

		for (new x; x < num; ++x) {
			i = players[x]
			chat_msg(i, g_afktospec_chat)
			user_to_spec(i, g_afktospec_reason)
		}
	}
}

public event_spectate() {
	new id = read_data(1)
	if (g_connected[id] && !g_specgametime[id])
		g_specgametime[id] = floatround(get_gametime())
}

public event_playteam() {
	new id = read_data(1)
	if (g_connected[id])
		clear_vars(id)
}

public client_disconnect(id) {
	g_connected[id] = false
	clear_vars(id)
}

clear_vars(id) {
	g_origin[id][0] = 0
	g_origin[id][1] = 0
	g_origin[id][2] = 0
	g_afktime[id] = 0
	g_specgametime[id] = 0
}

bool:is_user_afk(id, const origin[3]) {
	return (origin[0] == g_origin[id][0] && origin[1] == g_origin[id][1])
}

chat_msg(id, const text[]) {
	static name[32]
	get_user_name(id, name, 31)
	client_print(0, print_chat, text, name)
}

stock client_kick(id, const reason[] = "") {
	server_cmd("kick #%d ^"%s^"", get_user_userid(id), reason)
	server_exec()
}

stock user_to_spec(id, const reason[] = "") {
	user_kill(id, 1)
	engclient_cmd(id, "jointeam", "6")
	show_menu(id, 1023, reason)
}
adminslots.sma
/* AMX Mod X
*   Slots Reservation Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  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
*  along with this program; 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.
*/

#include <amxmodx>
#include <amxmisc>

new g_cmdLoopback[16]
new g_ResPtr
new g_HidePtr

public plugin_init()
{
	register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
	register_dictionary("adminslots.txt")
	register_dictionary("common.txt")
	g_ResPtr = register_cvar("amx_reservation", "0")
	g_HidePtr = register_cvar("amx_hideslots", "0")
	
	format(g_cmdLoopback, 15, "amxres%c%c%c%c", random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'))
	register_clcmd(g_cmdLoopback, "ackSignal")
}

public plugin_cfg()
{
	set_task(3.0, "MapLoaded")
}

public MapLoaded()
{
	if (!get_pcvar_num(g_HidePtr))
		return

	new maxplayers = get_maxplayers()
	new players = get_playersnum(1)
	new limit = maxplayers - get_pcvar_num(g_ResPtr)
	setVisibleSlots(players, maxplayers, limit)
}

public ackSignal(id)
{
	new lReason[64]
	format(lReason, 63, "%L", id, "DROPPED_RES")
	server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)
	
	return PLUGIN_HANDLED
}

public client_authorized(id)
{
	new maxplayers = get_maxplayers()
	new players = get_playersnum(1)
	new limit = maxplayers - get_pcvar_num(g_ResPtr)

	if (access(id, ADMIN_RESERVATION) || (players <= limit))
	{
		if (get_pcvar_num(g_HidePtr) == 1)
			setVisibleSlots(players, maxplayers, limit)
		return PLUGIN_CONTINUE
	}
	
	client_cmd(id, "%s", g_cmdLoopback)

	return PLUGIN_HANDLED
}

public client_disconnect(id)
{
	if (!get_pcvar_num(g_HidePtr))
		return PLUGIN_CONTINUE

	new maxplayers = get_maxplayers()
	
	setVisibleSlots(get_playersnum(1) - 1, maxplayers, maxplayers - get_pcvar_num(g_ResPtr))
	return PLUGIN_CONTINUE
}

setVisibleSlots(players, maxplayers, limit)
{
	new num = players + 1

	if (players == maxplayers)
		num = maxplayers
	else if (players < limit)
		num = limit
	
	set_cvar_num("sv_visiblemaxplayers", num)
}

  • +
  • -
  • 0

#2 nEgativ

    Zaawansowany

  • Użytkownik

Reputacja: 12
Początkujący

  • Postów:90
  • Imię:Mariusz
  • Lokalizacja:Polska
Offline

Napisano 03.12.2008 08:32

Moim zdaniem to najprosciej bedzie zrobic na serwerze dwa sloty rezerwowe dla admina za pomoca wbudowanego pluginu adminslots.amxx
Co do kickowania ludzi afk to plugin afkkicker CLICK
Na kickowanie ludzi ze specta jest komenda mp_autokick tylko wtedy bedzie kickowalo tez adminow bedacych na spekcie.
  • +
  • -
  • 0

#3 naven

    Hero

  • Autor tematu
  • Power User

Reputacja: 200
Profesjonalista

  • Postów:1088
  • GG:
  • Imię:Adam
  • Lokalizacja:Cieszyn
Offline

Napisano 03.12.2008 16:39

Wiem ze afkkicker jest najlepszy, ale ja potrzebuje kickowac, tylko kiedy ja wchodze
  • +
  • -
  • 0

#4 emblaze

    Koniec z cs/amxx

  • Użytkownik

Reputacja: 166
Profesjonalista

  • Postów:973
  • Lokalizacja:Mój steam: emblaze_95
Offline

Napisano 03.12.2008 17:57

/* AMX Mod X
* Slots Reservation Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* 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
* along with this program; 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.
*/

#include <amxmodx>
#include <amxmisc>

new g_cmdLoopback[16]
new g_ResPtr
new g_HidePtr

public plugin_init()
{
register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminslots.txt")
register_dictionary("common.txt")
g_ResPtr = register_cvar("amx_reservation", "0")
g_HidePtr = register_cvar("amx_hideslots", "0")

format(g_cmdLoopback, 15, "amxres%c%c%c%c", random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'))
register_clcmd(g_cmdLoopback, "ackSignal")
}

public plugin_cfg()
{
set_task(3.0, "MapLoaded")
}

public MapLoaded()
{
if (!get_pcvar_num(g_HidePtr))
return

new maxplayers = get_maxplayers()
new players = get_playersnum(1)
new limit = maxplayers - get_pcvar_num(g_ResPtr)
setVisibleSlots(players, maxplayers, limit)
}

public ackSignal(id)
{
new lReason[64]
format(lReason, 63, "%L", id, "DROPPED_RES")
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)

return PLUGIN_HANDLED
}

public client_authorized(id)
{
new maxplayers = get_maxplayers()
new players = get_playersnum(1)
new limit = maxplayers - get_pcvar_num(g_ResPtr)

if (access(id, ADMIN_RESERVATION) || (players <= limit))
{
if (get_pcvar_num(g_HidePtr) == 1)
setVisibleSlots(players, maxplayers, limit)
return PLUGIN_CONTINUE
}

client_cmd(id, "%s", g_cmdLoopback)

return PLUGIN_HANDLED
}

public client_disconnect(id)
{
if (!get_pcvar_num(g_HidePtr))
return PLUGIN_CONTINUE

new maxplayers = get_maxplayers()

setVisibleSlots(get_playersnum(1) - 1, maxplayers, maxplayers - get_pcvar_num(g_ResPtr))
return PLUGIN_CONTINUE
}

setVisibleSlots(players, maxplayers, limit)
{
new num = players + 1

if (players == maxplayers)
num = maxplayers
else if (players < limit)
num = limit

set_cvar_num("sv_visiblemaxplayers", num)
}


spróbuj zmienic
if (access(id, ADMIN_RESERVATION) || (players <= limit))

na
if (access(id, ADMIN_IMMUNITY) || (players <= limit))
moze zadziała :)
  • +
  • -
  • 0

#5 nEgativ

    Zaawansowany

  • Użytkownik

Reputacja: 12
Początkujący

  • Postów:90
  • Imię:Mariusz
  • Lokalizacja:Polska
Offline

Napisano 03.12.2008 19:36

Spróbuj może tego pluginu kickuje gdy admin wchodzi :

* gracza, który najkrócej gra.
* gracza z największym pingiem.

Cvary:

* amx_reservation 1 - wyrzuca gracza, który najkrócej gra.
* amx_reservation 2 - wyrzuca gracza z największym pingiem.

Instalacja:

* slots_reservation.amxx wklej do addons/amxmodx/plugins/
* otwórz addons/amxmodx/configs/plugins.ini i dopisz na końcu slots_reservation.amxx
* dodaj cvary do addons/amxmodx/configs/amxx.cfg
* zrestartuj serwer lub zmień mapę i gotowe!!

Załączone pliki


  • +
  • -
  • 0

#6 emblaze

    Koniec z cs/amxx

  • Użytkownik

Reputacja: 166
Profesjonalista

  • Postów:973
  • Lokalizacja:Mój steam: emblaze_95
Offline

Napisano 03.12.2008 20:03

tylko że on chcial na flage a (ADMIN_IMMUNITY) a ty dałeś na flage B
if ( get_user_flags(id) & ADMIN_RESERVATION )
;>
  • +
  • -
  • 0

#7 naven

    Hero

  • Autor tematu
  • Power User

Reputacja: 200
Profesjonalista

  • Postów:1088
  • GG:
  • Imię:Adam
  • Lokalizacja:Cieszyn
Offline

Napisano 04.12.2008 17:00

Zmodyfikowalem sobie plugin od nEgativ, zobaczymy, czy bedzie dzialac. negativ mozesz dac zrodlo tego? najlepiej link do alliedmods jak jest tam

edit: plugin dziala, ale chcialbym zeby mial inne cvary zamiast amx_reservation to amx_res
Znalazlem w kodzie:

	register_plugin("Slots Reservation","0.9.7","f117bomb") 
	register_cvar("amx_reservation","1") 
	
	new resType = get_cvar_num( "amx_reservation" )

Czy wystarczy w tych 2 miejscach zmienić amx_reservation na inny?
  • +
  • -
  • 0

#8 emblaze

    Koniec z cs/amxx

  • Użytkownik

Reputacja: 166
Profesjonalista

  • Postów:973
  • Lokalizacja:Mój steam: emblaze_95
Offline

Napisano 04.12.2008 17:57

no to sprobuj zmienic to na ten amx_res ;) moze sie uda :D
  • +
  • -
  • 0

#9 naven

    Hero

  • Autor tematu
  • Power User

Reputacja: 200
Profesjonalista

  • Postów:1088
  • GG:
  • Imię:Adam
  • Lokalizacja:Cieszyn
Offline

Napisano 04.12.2008 18:10

Hmm dziala, a nie wiecie może jak zmienic, zeby ten plugin nie odejmowal mi 1 slota na serwerze, amx_hideslots 0 mam a ten mi ciagle 1 slota ukrywa

edit: juz znalazlem w kodzie, dzięki wszystkim, mozna zamykac
  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych