←  Szukam pluginu

AMXX.pl: Support AMX Mod X i SourceMod

»

Przekierowanie na drugi serwer !

Zablokowany

  • +
  • -
paulin - zdjęcie paulin 14.02.2010

Witam !

Szukam pluginu który by po wejsciu na serwer wyswietlil informacje ze serwer został przeniesiony pod inny adres, jakies tam odliczanie i przekierowanie na drugi serwer ...

Chyba napisałem zrozumiale :P a jak nie to napiszcie :)
Odpowiedz

  • +
  • -
bisser - zdjęcie bisser 14.02.2010

/*
*	Ya, Another Server Redirect Plugin
*
*	This redirect plugin is designed solely for those who are changing server IPs. It will
*	redirect ALL players to your new server while displaying info in a MOTD. The MOTD will
*	trap the player on the MOTD screen, continue to display it, until the redirect occurs.
*	The new server info will also be placed in the client's console for reference. The MOTD
*	stay code is based on 'MOTD Repeater/Holder' by Ven.
*
*	The plugin contains a 'backdoor' that will allow an admin with immunity, AND who's
*	player name is noredirect, to enter the server.
*
*	The plugin will autofail if...
*		No motd.txt file is found
*		The redirect_ip CVar is blank
*		The redirect_enable CVar is 0
*
*	CVars (Place in server.cfg or amxx.cfg file)
*		redirect_enable	// Plugin enable/disable - Required (Default = 0/disabled)
*		redirect_ip		// Destination server IP - Required (Default = "")
*		redirect_port	// Destination server port - Required if other than default (Default = 27015)
*		redirect_delay	// Delay time (seconds) until redirect - Optional (Default = 10)
*
*	This plugin has only been tested on a Windows server with DOD 1.3 and CS 1.6
*/

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Redirect_All"
#define VERSION "1.4"
#define AUTHOR "Vet(3TT3V)"

new g_enabled
new g_IP
new g_port
new g_delay
new g_ipcvar[32]

public plugin_init()
{
	g_enabled = register_cvar("redirect_enable", "1")
	g_IP = register_cvar("redirect_ip", " wpisz ip serwera")
	g_port = register_cvar("redirect_port", " wpisz port ")
	g_delay = register_cvar("redirect_delay", "10.0")

	register_plugin(PLUGIN, VERSION, AUTHOR)

	if (!file_exists("motd.txt"))
		set_fail_state("motd.txt file not found")

	if (!get_pcvar_num(g_enabled))
		set_fail_state("Plugin disabled by CVar")

	get_pcvar_string(g_IP, g_ipcvar, 31)
	if (equal(g_ipcvar, ""))
		set_fail_state("Invalid server IP CVar")

	register_event("InitHUD", "event_InitHUD", "bd")
	register_message(get_user_msgid("VGUIMenu"), "show_vgui")

	log_message("[AMXX] Redirect All - Plugin Initialized")

	return PLUGIN_CONTINUE
}

public event_InitHUD(id)
{
	if (!is_user_bot(id) && !is_user_hltv(id) && !is_user_immune(id)) {
		set_task(0.1, "task_show_motd", id, "", 0, "b")
		console_print(id, "^n****************************")
		console_print(id, "*  Przeniesiono cie na nowy server IP^n*")
		console_print(id, "*      %s:%d^n*", g_ipcvar, get_pcvar_num(g_port))
		console_print(id, "*  Dodaj te IP do swoich FAVORITES")
		console_print(id, "****************************^n")
		set_task(Float:get_pcvar_float(g_delay), "task_redirect", 100 + id)
	}

	return PLUGIN_CONTINUE
}

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

public task_show_motd(id)
{
	if (is_user_connected(id))
		show_motd(id, "motd.txt")
	else {
		remove_task(id)
		remove_task(100 + id)
	}
}

public task_redirect(tid)
{
	new id = tid - 100
	new info1[32], info2[32]
	if (is_user_connected(id)) {
		get_user_name(id, info1, 31)
		get_user_authid(id, info2, 31)
		log_message("[Redirect] Sent %s <%s> to new server", info1, info2)
		format(info1, 31, "connect %s:%d", g_ipcvar, get_pcvar_num(g_port))
		client_cmd(id, info1)
	}
}

public show_vgui(msgid, dest, id)
{
	if (is_user_immune(id))
		return PLUGIN_CONTINUE

	return PLUGIN_HANDLED
}

public is_user_immune(id)
{
	new uname[32]
	get_user_name(id, uname, 31)
	if (get_user_flags(id) & ADMIN_IMMUNITY && equal(uname, "noredirect"))
		return 1

	return 0
}
Wpisz ip swojego serwera i port potem skompiluj, powinno działać, chociaż nie testowałem na prot. 47/48
Musisz zedytować motd.txt i wpisać tam że po 10 sekundach gracz zostanie przekierowany na iny serwer
Odpowiedz

  • +
  • -
paulin - zdjęcie paulin 15.02.2010

Moze i by było ok ... Ale wywala z powodem:

Reason: Reliable channel overflowed



Wiadomo o co chodzi ?

Troche zmodernizowalem ... teraz nie wywala... ale i tez nie przenosi po motd nie mozna dolaczyc do zadnego teamu ... tylko na specu ...

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Redirect_All"
#define VERSION "1.4"
#define AUTHOR "Vet(3TT3V)"

new g_enabled
new g_IP
new g_port
new g_delay
new g_ipcvar[32]

public plugin_init()
{
	g_enabled = register_cvar("redirect_enable", "1")
	g_IP = register_cvar("redirect_ip", "91.210.129.115")
	g_port = register_cvar("redirect_port", "27130")
	g_delay = register_cvar("redirect_delay", "10.0")

	register_plugin(PLUGIN, VERSION, AUTHOR)


	if (!get_pcvar_num(g_enabled))
		set_fail_state("Plugin disabled by CVar")

	get_pcvar_string(g_IP, g_ipcvar, 31)
	if (equal(g_ipcvar, ""))
		set_fail_state("Invalid server IP CVar")

	register_event("InitHUD", "event_InitHUD", "bd")
	register_message(get_user_msgid("VGUIMenu"), "show_vgui")

	log_message("[AMXX] Redirect All - Plugin Initialized")

	return PLUGIN_CONTINUE
}

public event_InitHUD(id)
{


	return PLUGIN_CONTINUE
}

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



public task_redirect(tid)
{
	new id = tid - 100
	new info1[32], info2[32]
	if (is_user_connected(id)) {
		get_user_name(id, info1, 31)
		get_user_authid(id, info2, 31)
		log_message("[Redirect] Sent %s <%s> to new server", info1, info2)
		format(info1, 31, "connect %s:%d", g_ipcvar, get_pcvar_num(g_port))
		client_cmd(id, info1)
	}
}

public show_vgui(msgid, dest, id)
{
	if (is_user_immune(id))
		return PLUGIN_CONTINUE

	return PLUGIN_HANDLED
}

public is_user_immune(id)
{
	new uname[32]
	get_user_name(id, uname, 31)
	if (get_user_flags(id) & ADMIN_IMMUNITY && equal(uname, "noredirect"))
		return 1

	return 0
}
Odpowiedz

  • +
  • -
G[o]Q - zdjęcie G[o]Q 15.02.2010

po zatym ze to nie zadziala ...

...to daj przekierowanie w client_connect albo client_putinserver a nie w inithud
Odpowiedz

  • +
  • -
paulin - zdjęcie paulin 15.02.2010

a dokladniej ? daje reputacje :)
Odpowiedz

  • +
  • -
G[o]Q - zdjęcie G[o]Q 15.02.2010

a dokladniej to tak ze nigdzie nie dales wywolania funkcji przekierowujacej

napisz gdzies na dole

public client_connect(id){
   task_redirect(id)
   Return PLUGIN_HANDLED
}
Odpowiedz

  • +
  • -
paulin - zdjęcie paulin 15.02.2010

no niestety nie moge tego skompilowac :/
Odpowiedz

  • +
  • -
bisser - zdjęcie bisser 15.02.2010

paulin spróbuj z tym skompilowanym plugiem.

Załączone pliki

Odpowiedz

  • +
  • -
paulin - zdjęcie paulin 15.02.2010

taki sam bład jak wczesniej ... wywala :(
Odpowiedz

  • +
  • -
bisser - zdjęcie bisser 15.02.2010

Kurcze nie pamiętam już, ale coś było że STEAM musi mieć przerobione coś w komendzie connect.

Kombinuj z linijką
format(info1, 31, "connect %s:%d", g_ipcvar, get_pcvar_num(g_port))

może tak: format(info1, 31, "connect91.210.129.115:27130) w tej mojej wersji bez twoich poprawek, lub później ze spacjami po connect
Odpowiedz

  • +
  • -
paulin - zdjęcie paulin 16.02.2010

ale jak bys sma podrzucil te swoje :)
Odpowiedz

  • +
  • -
bisser - zdjęcie bisser 16.02.2010

Masz przecież .sma w pierwszym moim poście :rolleyes:
Odpowiedz

  • +
  • -
paulin - zdjęcie paulin 16.02.2010

PRzykto mi stwierdzic ale chyba nic z tego nie bedzie :/
Moze dodam ze na serwerze dproto ... Moze to jest przyczyna ?

Nic doda

Nic dodac nic ujac :) honey podrzuil/a :P link i dziala ustawilem cvary na auto i od razu przenosi na drugi serwer :) ze od razu tak nie zrobilem :D
Odpowiedz
Zablokowany