Skocz do zawartości

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
Zombie Plague 4.3

Komenda say kupujaca item

Zombie Plague 4.3

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

#1 VirusX

    Pomocny

  • Użytkownik

Reputacja: 75
Zaawansowany

  • Postów:48
  • Imię:Adam
  • Lokalizacja:Zabrze
Offline

Napisano 21.07.2011 15:06

Witam

Chcialbym prosic o modyfikacje pluginu, by po wpisaniu w sayu /speed uzytkownik kupowal szybkosc (plugin ponizej)

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

// Hack to be able to use Ham_Player_ResetMaxSpeed (by joaquimandrade)
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

new g_itemid_boost
new cvar_boost_amount
new cvar_boost_duration
new g_has_speed_boost[33]

public plugin_init()
{
	register_plugin("[ZP] Extra Item Speed Boost", "1.2", "MeRcyLeZZ")
	
	g_itemid_boost = zp_register_extra_item("Przyspieszenie", 2000, ZP_TEAM_HUMAN | ZP_TEAM_ZOMBIE)
	cvar_boost_amount = register_cvar("zp_boost_amount", "100.0")
	cvar_boost_duration = register_cvar("zp_boost_duration", "5.0")
	
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}

public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_itemid_boost)
	{
		// Player frozen (or CS freezetime)
		if (pev(player, pev_maxspeed) <= 1)
		{
			client_print(player, print_chat, "[ZM] Nie mozesz uzywac gdy jestes zamrozony")
			return ZP_PLUGIN_HANDLED;
		}
		
		// Already using speed boost
		if (g_has_speed_boost[player])
		{
			client_print(player, print_chat, "[ZM] Kupiles juz Przyspieszenie.")
			return ZP_PLUGIN_HANDLED;
		}
		
		// Enable speed boost
		g_has_speed_boost[player] = true
		client_print(player, print_chat, "[ZM] Przyspieszenie aktywne!")
		
		// Set the restore speed task
		set_task(get_pcvar_float(cvar_boost_duration), "restore_maxspeed", player+TASK_SPEED_BOOST)
		
		// Update player's maxspeed
		ExecuteHamB(Ham_Player_ResetMaxSpeed, player)
	}
	return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
	// Disable speed boost
	g_has_speed_boost[ID_SPEED_BOOST] = false
	client_print(ID_SPEED_BOOST, print_chat, "[ZM] Przyspieszenie nieaktywne.")
	
	// Update player's maxspeed
	ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

// Remove speed boost task when infected, humanized, killed, or disconnected
public zp_user_infected_pre(id, infector, nemesis)
{
	g_has_speed_boost[id] = false
	remove_task(id+TASK_SPEED_BOOST)
}
public zp_user_humanized_pre(id, survivor)
{
	g_has_speed_boost[id] = false
	remove_task(id+TASK_SPEED_BOOST)
}
public fw_PlayerKilled(victim)
{
	g_has_speed_boost[victim] = false
	remove_task(victim+TASK_SPEED_BOOST)
}
public client_disconnect(id)
{
	g_has_speed_boost[id] = false
	remove_task(id+TASK_SPEED_BOOST)
}

// Remove speed boost at round start
public event_round_start()
{
	new id
	for (id = 1; id <= get_maxplayers(); id++)
	{
		g_has_speed_boost[id] = false
		remove_task(id+TASK_SPEED_BOOST)
	}
}

public fw_ResetMaxSpeed_Post(id)
{
	if (!is_user_alive(id) || !g_has_speed_boost[id])
		return;
	
	// Apply speed boost
	new Float:current_maxspeed
	pev(id, pev_maxspeed, current_maxspeed)
	set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

Użytkownik VirusX edytował ten post 21.07.2011 15:06

  • +
  • -
  • 0

#2 kapi10072

    Wszechpomocny

  • Użytkownik

Reputacja: 70
Pomocny

  • Postów:318
  • Steam:steam
  • Imię:Kacper
  • Lokalizacja:Polska
Offline

Napisano 21.07.2011 17:00


#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

const TASK_SPEED_BOOST = 100
#define ID_SPEED_BOOST (taskid - TASK_SPEED_BOOST)

// Hack to be able to use Ham_Player_ResetMaxSpeed (by joaquimandrade)
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

new g_itemid_boost
new cvar_boost_amount
new cvar_boost_duration
new g_has_speed_boost[33]

public plugin_init()
{
register_plugin("[ZP] Extra Item Speed Boost", "1.2", "MeRcyLeZZ")

g_itemid_boost = zp_register_extra_item("Przyspieszenie", 2000, ZP_TEAM_HUMAN | ZP_TEAM_ZOMBIE)
cvar_boost_amount = register_cvar("zp_boost_amount", "100.0")
cvar_boost_duration = register_cvar("zp_boost_duration", "5.0")

RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_clcmd("say /speed", "zp_extra_item_selected")
}

public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid_boost)
{
// Player frozen (or CS freezetime)
if (pev(player, pev_maxspeed) <= 1)
{
client_print(player, print_chat, "[ZM] Nie mozesz uzywac gdy jestes zamrozony")
return ZP_PLUGIN_HANDLED;
}

// Already using speed boost
if (g_has_speed_boost[player])
{
client_print(player, print_chat, "[ZM] Kupiles juz Przyspieszenie.")
return ZP_PLUGIN_HANDLED;
}

// Enable speed boost
g_has_speed_boost[player] = true
client_print(player, print_chat, "[ZM] Przyspieszenie aktywne!")

// Set the restore speed task
set_task(get_pcvar_float(cvar_boost_duration), "restore_maxspeed", player+TASK_SPEED_BOOST)

// Update player's maxspeed
ExecuteHamB(Ham_Player_ResetMaxSpeed, player)
}
return PLUGIN_CONTINUE;
}

public restore_maxspeed(taskid)
{
// Disable speed boost
g_has_speed_boost[ID_SPEED_BOOST] = false
client_print(ID_SPEED_BOOST, print_chat, "[ZM] Przyspieszenie nieaktywne.")

// Update player's maxspeed
ExecuteHamB(Ham_Player_ResetMaxSpeed, ID_SPEED_BOOST)
}

// Remove speed boost task when infected, humanized, killed, or disconnected
public zp_user_infected_pre(id, infector, nemesis)
{
g_has_speed_boost[id] = false
remove_task(id+TASK_SPEED_BOOST)
}
public zp_user_humanized_pre(id, survivor)
{
g_has_speed_boost[id] = false
remove_task(id+TASK_SPEED_BOOST)
}
public fw_PlayerKilled(victim)
{
g_has_speed_boost[victim] = false
remove_task(victim+TASK_SPEED_BOOST)
}
public client_disconnect(id)
{
g_has_speed_boost[id] = false
remove_task(id+TASK_SPEED_BOOST)
}

// Remove speed boost at round start
public event_round_start()
{
new id
for (id = 1; id <= get_maxplayers(); id++)
{
g_has_speed_boost[id] = false
remove_task(id+TASK_SPEED_BOOST)
}
}

public fw_ResetMaxSpeed_Post(id)
{
if (!is_user_alive(id) || !g_has_speed_boost[id])
return;

// Apply speed boost
new Float:current_maxspeed
pev(id, pev_maxspeed, current_maxspeed)
set_pev(id, pev_maxspeed, current_maxspeed + get_pcvar_float(cvar_boost_amount))
}

  • +
  • -
  • 1

Dołączona grafika
Najlepszy serwer TeamPlay w Polsce !
Pomogłem, wejdź ;)
Zapraszam na BHZ-Game.pl
Bo nie liczą się fragi tylko dobra atmosfera ;D


#3 VirusX

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 75
Zaawansowany

  • Postów:48
  • Imię:Adam
  • Lokalizacja:Zabrze
Offline

Napisano 21.07.2011 23:37

Niestety nie bangla :( ale juz ogarnalem, stworzylem osobna funkcje bez sprawdzania jaki item zostal wybrany.
Thnx anyway. +

Użytkownik VirusX edytował ten post 22.07.2011 01:06

  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: Zombie Plague 4.3

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

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