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

Subplugin Submission [ZP] Extra Item: Speed Boost


Post New Thread Reply   
 
Thread Tools Display Modes
dfwu.dark
Senior Member
Join Date: Mar 2011
Location: In dreams...
Old 07-03-2011 , 06:22   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #21

hahaha If You Start Scripting You Never STOP !...Keep It Up.
__________________
[url]http://hw-movie.blogspot.com[/url]
Watch Latest Movies Online For Free !...
dfwu.dark is offline
Send a message via Skype™ to dfwu.dark
Old 07-04-2011, 07:29
Dolph_Ziggler
This message has been deleted by Dolph_Ziggler.
xixi
Member
Join Date: Nov 2010
Old 07-13-2011 , 21:54   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #22

VIP can change?


1. I changed to VP
- changes are in red

Code:
/*================================================================================
	
	----------------------------------------
	-*- [ZP] Extra Item: Speed Boost 1.2 -*-
	----------------------------------------
	
	~~~~~~~~~~~~~~~
	- Description -
	~~~~~~~~~~~~~~~
	
	This item gives humans/zombies a short speed boost, configurable
	by cvars: zp_boost_amount and zp_boost_duration.
	
	ZP 4.3 Fix 5 or later required.
	
	~~~~~~~~~~~~~
	- Changelog -
	~~~~~~~~~~~~~
	
	* v1.0: (Jun 21, 2011)
	   - First release
	
	* v1.1: (Jun 22, 2011)
	   - Fixed speed not properly restored if player gets frozen after
	      buying the speed boost (high zp_frost_duration settings)
	
	* v1.2: (Jul 02, 2011)
	   - Changed speed setting method to be compatible with ZP 4.3 Fix5
	
================================================================================*/

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

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 = zv_register_extra_item("Speed Boost", 5, ZV_TEAM_HUMAN | ZV_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 zv_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, "[ZP] You can't use this item when frozen.")
			return ZP_PLUGIN_HANDLED;
		}
		
		// Already using speed boost
		if (g_has_speed_boost[player])
		{
			client_print(player, print_chat, "[ZP] You already have the speed boost.")
			return ZP_PLUGIN_HANDLED;
		}
		
		// Enable speed boost
		g_has_speed_boost[player] = true
		client_print(player, print_chat, "[ZP] Speed boost enabled!")
		
		// 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, "[ZP] Speed boost is over.")
	
	// 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))
}
2. that gives me error compilation

__________________


[img]http://img217.**************/img217/2378/col2w.png[/img]
xixi is offline
Send a message via Yahoo to xixi Send a message via Skype™ to xixi
Dolph_Ziggler
BANNED
Join Date: Jun 2011
Old 07-14-2011 , 02:31   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #23

@XIXI you forget to make descriptive on him for example
Code:
g_itemid_boost = zv_register_extra_item("Speed Boost", "Make You speed for moment", 5, ZV_TEAM_HUMAN | ZV_TEAM_ZOMBIE)

Last edited by Dolph_Ziggler; 07-14-2011 at 02:33.
Dolph_Ziggler is offline
Send a message via MSN to Dolph_Ziggler
9evill
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 12-11-2011 , 10:59   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #24

You also need to set players cl_forwardspeed, cl_backspeed and cl_sidespeed to 9999, if you are going to boost for more when 320.
9evill is offline
Gam3ronE
SourceMod Donor
Join Date: Aug 2010
Old 03-11-2012 , 18:40   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #25

Can you do a trail and glow version?
Gam3ronE is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 03-11-2012 , 18:46   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #26

Quote:
Originally Posted by Graham View Post
Can you do a trail and glow version?
Look at fryes version.
PS: This wont work for zp 5.0 just so people know.
__________________
H.RED.ZONE is offline
biggaass
Junior Member
Join Date: Mar 2012
Location: Malaysia
Old 03-11-2012 , 22:36   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #27

Quote:
Originally Posted by H.RED.ZONE View Post
Look at fryes version.
PS: This wont work for zp 5.0 just so people know.
OMG This wont work for ZP5.0!? I was planning to make trail version of it /.\
biggaass is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 03-12-2012 , 02:48   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #28

Make it but use.
Code:
#include <cs_maxspeed_api>
__________________
H.RED.ZONE is offline
Gam3ronE
SourceMod Donor
Join Date: Aug 2010
Old 03-13-2012 , 14:23   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #29

Quote:
Originally Posted by H.RED.ZONE View Post
Look at fryes version.
PS: This wont work for zp 5.0 just so people know.
Well I am using 5.0.8 on a test server. Can you link fryes version?
Gam3ronE is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 03-13-2012 , 14:34   Re: [ZP] Extra Item: Speed Boost
Reply With Quote #30

For zp 5.0.8 it would need to be rewriten because zp is useing
Code:
#include <cs_maxspeed_api>
So if you use it you will get speed bugs.
__________________
H.RED.ZONE 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 14:56.


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