This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Put plugin for vip (reload_speed)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
agrafos97
Junior Member
Join Date: Feb 2012
Old 03-01-2012 , 09:38   Put plugin for vip (reload_speed)
Reply With Quote #1

They could put this plugin for VIPs with flag "ADMIN_RESERVATION"?
Code:
/*	Copyright © 2009, ConnorMcLeod

	Reload Status Bar 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.

	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 Reload Status Bar; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
*/

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

#define PLUGIN "Reload Speed"
#define AUTHOR "ConnorMcLeod"
#define VERSION "1.0.0"

const NOCLIP_WPN_BS	= ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))
const SHOTGUNS_BS	= ((1<<CSW_M3)|(1<<CSW_XM1014))

const m_pPlayer			= 41
const m_fInReload			= 54

const m_flNextAttack		= 83

new gmsgBarTime2

new g_pCvarReloadSpeed, g_pCvarReloadBar

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	g_pCvarReloadSpeed = register_cvar("amx_reload_speed", "0.2")
	g_pCvarReloadBar = register_cvar("amx_reload_bar", "1")

	new szWeapon[17]
	for(new i=1; i<=CSW_P90; i++)
	{
		if(	!( NOCLIP_WPN_BS & (1<<i) )
		&&	!( SHOTGUNS_BS & (1<<i) )
		&&	get_weaponname(i, szWeapon, charsmax(szWeapon)) )
		{
			RegisterHam(Ham_Weapon_Reload, szWeapon, "Weapon_Reload", 1)
			RegisterHam(Ham_Item_Holster, szWeapon, "Item_Holster")

		}
	}

	gmsgBarTime2 = get_user_msgid("BarTime2")
}

public Weapon_Reload( iEnt )
{
	if( get_pdata_int(iEnt, m_fInReload, 4) )
	{
		new id = get_pdata_cbase(iEnt, m_pPlayer, 4)
		new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, 5) * get_pcvar_float(g_pCvarReloadSpeed)
		set_pdata_float(id, m_flNextAttack, flNextAttack, 5)
		
		if( get_pcvar_num(g_pCvarReloadBar) )
		{
			new iSeconds = floatround(flNextAttack, floatround_ceil)
			Make_BarTime2(id, iSeconds, 100 - floatround( (flNextAttack/iSeconds) * 100 ))
		}
	}
}

public Item_Holster( iEnt )
{
	if( get_pdata_int(iEnt, m_fInReload, 4) )
	{
		Make_BarTime2(get_pdata_cbase(iEnt, m_pPlayer, 4), 0, 0)
	}
}

Make_BarTime2(id, iSeconds, iPercent)
{
	message_begin(MSG_ONE_UNRELIABLE, gmsgBarTime2, _, id)
	write_short(iSeconds)
	write_short(iPercent)
	message_end()
}
I have this but not working:

Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Reload Speed"
#define AUTHOR "ConnorMcLeod"
#define VERSION "1.0.0"

const NOCLIP_WPN_BS= ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))
const SHOTGUNS_BS= ((1<<CSW_M3)|(1<<CSW_XM1014))

const m_pPlayer= 41
const m_fInReload= 54

const m_flNextAttack= 83

new gmsgBarTime2

new g_pCvarReloadSpeed, g_pCvarReloadBar

#define VIP_FLAG ADMIN_RESERVATION

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	g_pCvarReloadSpeed = register_cvar("amx_reload_speed", "0.2")
	g_pCvarReloadBar = register_cvar("amx_reload_bar", "1")
	
	new szWeapon[17]
	for(new i=1; i<=CSW_P90; i++)
	{
		if(!( NOCLIP_WPN_BS & (1<<i) )
		&&!( SHOTGUNS_BS & (1<<i) )
		&&get_weaponname(i, szWeapon, charsmax(szWeapon)) )
		{
			RegisterHam(Ham_Weapon_Reload, szWeapon, "Weapon_Reload", 1)
			RegisterHam(Ham_Item_Holster, szWeapon, "Item_Holster")
			
		}
	}
	
	gmsgBarTime2 = get_user_msgid("BarTime2")
}

public Weapon_Reload( id, iEnt )
{
	if(!(get_user_flags(id) & VIP_FLAG))
		return HAM_IGNORED;
		
	if( get_pdata_int(iEnt, m_fInReload, 4) )
	{
		new id = get_pdata_cbase(iEnt, m_pPlayer, 4)
		new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, 5) * get_pcvar_float(g_pCvarReloadSpeed)
		set_pdata_float(id, m_flNextAttack, flNextAttack, 5)
		
		if( get_pcvar_num(g_pCvarReloadBar) )
		{
			new iSeconds = floatround(flNextAttack, floatround_ceil)
			Make_BarTime2(id, iSeconds, 100 - floatround( (flNextAttack/iSeconds) * 100 ))
		}
	}
	return HAM_HANDLED;
}

public Item_Holster( id, iEnt )
{
	if(!(get_user_flags(id) & VIP_FLAG))
		return HAM_IGNORED;
		
	if( get_pdata_int(iEnt, m_fInReload, 4) )
		Make_BarTime2(get_pdata_cbase(iEnt, m_pPlayer, 4), 0, 0)
	return HAM_IGNORED;
}

Make_BarTime2(id, iSeconds, iPercent)
{
	message_begin(MSG_ONE_UNRELIABLE, gmsgBarTime2, _, id)
	write_short(iSeconds)
	write_short(iPercent)
	message_end()
}

Last edited by agrafos97; 03-01-2012 at 10:55.
agrafos97 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-01-2012 , 10:04   Re: Put plugin for vip (reload_speed)
Reply With Quote #2

Moved to proper forum.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 03-01-2012, 10:54
agrafos97
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Old 03-03-2012, 04:14
agrafos97
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Gh05t04
Senior Member
Join Date: Jul 2015
Old 08-19-2015 , 14:35   Re: Put plugin for vip (reload_speed)
Reply With Quote #3

bump
Gh05t04 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 08:27.


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