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

[REQ] Weapon Speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 10-25-2009 , 11:39   [REQ] Weapon Speed
Reply With Quote #1

Hi! Im working on implementing a mod in amxx. (Its now in hlsdk)
I want to speed up the weapons reload time, and or firing rate.

I checked lots of plugins, but they did not worked for me.

Can You help me how to speed up my weapons ?
(Im working with half-life, but if you give me cs examples, that will help too!)

Thx for help!
ujjl is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-25-2009 , 12:22   Re: [REQ] Weapon Speed
Reply With Quote #2

Did you try http://forums.alliedmods.net/showthread.php?p=597185 ?
__________________
Impossible is Nothing
Sylwester is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 10-25-2009 , 14:07   Re: [REQ] Weapon Speed
Reply With Quote #3

Quote:
Originally Posted by Sylwester View Post
Thx, for reply! (+KARMA)

Works in cs, not in hl, according to this thread:

http://forums.alliedmods.net/showthread.php?t=98665

the pdata things are only used in cs

so now i need to rewrite this part

Code:
static Float:Delay,Float:M_Delay
Delay = get_pdata_float( Ent, 46, 4) * N_Speed
M_Delay = get_pdata_float( Ent, 47, 4) * N_Speed
if (Delay > 0.0)
{
	set_pdata_float( Ent, 46, Delay, 4)
	set_pdata_float( Ent, 47, M_Delay, 4)
}
so that it not use set_pdata_float and get_pdata_float functions.
(maybe some function form hamsandwich, or engine)
Anyone can help me where i shoud start?
ujjl is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-25-2009 , 14:55   Re: [REQ] Weapon Speed
Reply With Quote #4

There are different offsets for half-life. I couldn't find them in google, so I coded plugin to check some of them ~100 and somehow I found one responsible for fire rate (its 35).

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

new Float:g_fDelay 0.02
public plugin_init(){
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_mp5""fwd_AttackSpeed" 1)
}

public 
fwd_AttackSpeed( const Entity ){
    
set_pdata_float(Entity35g_fDelay)

fDelay is time in seconds before you can fire next bullet.

Unfortunately I wasn't able to find anything responsible for reload among them.

EDIT:
Check this plugin: https://forums.alliedmods.net/showpo...18&postcount=6
You need to find correct offsets to make it work with hl.
__________________
Impossible is Nothing

Last edited by Sylwester; 10-25-2009 at 15:02.
Sylwester is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 10-26-2009 , 06:08   Re: [REQ] Weapon Speed
Reply With Quote #5

Quote:
There are different offsets for half-life. I couldn't find them in google, so I coded plugin to check some of them ~100 and somehow I found one responsible for fire rate (its 35).
Thx! Works great for me!

I found the offset for seconday attack too:

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

//const m_flNextPrimaryAttack    = 35
const m_flNextSecondaryAttack    36

new Float:shotgun_secondary_speed 0.75        //default: 1.5

public plugin_init(){
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_shotgun""fwd_Attack2Speed"1)
}

public 
fwd_Attack2Speed( const Entity ){
    
set_pdata_float(Entitym_flNextSecondaryAttackshotgun_secondary_speed)

Maybe
PHP Code:
const m_flTimeWeaponIdle        37 
I try experimenting with this plugin's offsets and update my progress here.
ujjl is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-26-2009 , 06:28   Re: [REQ] Weapon Speed
Reply With Quote #6

If I remember correctly 37 was something like time in seconds before next animation of idle weapon.
__________________
Impossible is Nothing
Sylwester is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 10-26-2009 , 10:06   Re: [REQ] Weapon Speed
Reply With Quote #7

I want to speed up shotgun and crossbow reload. Shotgun-reload is complicated, so first i try with crossbow. I edited this plugin, for my needs.

The result:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>


 //weapons offsets
const m_pPlayer                  28
const m_flNextPrimaryAttack    35
const m_flNextSecondaryAttack  36
//const m_flTimeWeaponIdle     = ??
const m_fInReload                43
//const m_flNextAttack         = ??

// weapon_clip_offset 40    // looks like this is for weapon-clip
const Float:crossbow_reload_speed 2.25    // default: 4.5

public plugin_init()
{
    
register_plugin("Reload Speed""09.10.26""ujjl")
    
RegisterHam(Ham_Item_PostFrame"weapon_crossbow""Item_PostFrame_Post"1)

}

public 
Item_PostFrame_Post(iEnt)
{    
    if( 
get_pdata_int(iEntm_fInReload4) )
    {
        new 
player_id get_pdata_cbase(iEntm_pPlayer4)    //who are reloading
    
        //set_pdata_float(player_id, m_flNextAttack, crossbow_reload_speed, 5)
        //set_pdata_float(iEnt, m_flTimeWeaponIdle, crossbow_reload_speed + 0.5, 4)
        
        
client_print(player_id,print_chat,"You are reloading your crossbow.")
    }

So, i figured out InReload, and Player offsets.

The WeaponIdle offset can wait.
Now i search for NextAttack offset.

Last edited by ujjl; 10-26-2009 at 12:27.
ujjl is offline
Old 10-26-2009, 10:12
Exolent[jNr]
This message has been deleted by Exolent[jNr]. Reason: Nevermind,
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 20:12.


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