| closedChanging Rate of Fire |
| Started by Wilson [29th ID] on 01-20-2007, 05:35 AM |
Threads: 57
Joined: Oct 2005
This is barely a tutorial. It's more like a reference for those who already know somewhat how to do it.rnrnI found the pdata offsets for weapon's rate of fire in dod.rnrn
// These are the offsets and the values when the player isrn// standing still, not firing, ready to fire.rnrn#define OFFSET_1 103rn#define OFFSET_2 104rnrn#define VALUE_1 -1.0rn#define VALUE_2 -0.001rnrnBoth get set to 0.49 when Firing the k98's primary fire, and set to 0.538 when bayoneting. Obviously this would be different for each weapon, but I believe it is the time before it can be fired/bayoneted again.rnrnHere is some example code for changing the rate of fire. It basically makes it unlimited ROF so you can fire completely semi auto with any weapon (kar can shoot as fast as pistol or carbine)rnrnrnpublic cmd_set_pdata( id ) {rn new num, args[16];rn read_args( args, 199 );rn num = str_to_num( args );rn rn new clip, ammo, weaponID = get_user_weapon(id,clip,ammo)rn new weapon[32]rn xmod_get_wpnlogname( weaponID, weapon, 31 );rn format( weapon, 31, "weapon_%s", weapon );rn new wpnent = detect_weapon_id( id, weapon );rn rn if( num == 1 ) set_pdata_float( wpnent, OFFSET_1, VALUE_1 );rn else if( num == 2 ) set_pdata_float( wpnent, OFFSET_2, VALUE_2 );rn rn console_print( id, "Set pdata" );rn return PLUGIN_HANDLED;rn}rnrnstock detect_weapon_id( id, szWpn[32] ) {rn new m_iCurEnt = -1, m_iWpn = 0;rnrn // Get User Originrn new Float:m_flOrigin[3];rn pev( id, pev_origin, m_flOrigin );rn rn // Find Dummy Weaponrn while( ( m_iCurEnt = engfunc( EngFunc_FindEntityInSphere, m_iCurEnt, m_flOrigin, Float:1.0 ) ) != 0 ) {rn new m_szClassname[32];rn pev( m_iCurEnt, pev_classname, m_szClassname, 31 );rn rn if( equal( m_szClassname, szWpn ) )rn m_iWpn = m_iCurEnt;rn }rn return m_iWpn;rn}rnrnrnSo it gets the user's origin, then finds the weapon entity in that origin that matches the weapon name that the user is holding, then depending on whether the command's argument was 1 or 2, it sets primary or secondary fire to the VALUE_1 / VALUE_2rnrnSo you'd register the client command in plugin_init like register_clcmd("setpdata", "cmd_set_pdata") then, for example, bind MOUSE1 "+attack;setpdata 1" and bind MOUSE2 "+attack2;setpdata 2"rnrnTry it out it's extremely fun, and hopefully I'll have a customisable rate of fire plugin soon enough.Threads: 57
Joined: Oct 2005
On a separate note, just as a reference, the offset for the clip ammo is 108.rnAdjusting this will allow you to, say, give the Thompson 100 rounds per magazine, or make a ten shot webley :PrnrnWeapon ID (matches dod_const.inc) is offset 91
Threads: 1
Joined: Mar 2007
how are you getting these offsets?
Threads: 57
Joined: Oct 2005
Using a developer plugin I made, fakemeta research. You log pdata bytes 0 - 200, then fire and quickly compare bytes 0 - 200 to the original "logged set". Check what changed. If nothing hints at a rate of fire offset, move to 201 - 400, then 401 - 600, etc. (the weapon's pdata)rnrnAre you trying to find offsets for another mod? Or for something else? I might be able to help point you in the right direction.rnrnHopefully one of these days I'll release FM Research too :P
Threads: 103
Joined: May 2005
ya im having a bitch of a time finding offsets...nnneither by doing it over and over with the offset reading from a cvar and i manually change it 1 at a time lol..nnor thru a loop that goes thru a whole bunch of offset values to begin with.. but its pretty sloppy and i only made it look for a value i specify
Threads: 57
Joined: Oct 2005
Message me on AIM and I'll send you fm research. Development with pev, cd, es, and pdata is sooooo much easier with it.
Threads: 57
Joined: Oct 2005
Update - download FM Research from the developer plugins section, then use this script to give you rapid fire for any weapon. It basically allows you to fire, say, the k98 or garand as quickly as you can fire the m1carbine or pistol.rnrnalias +rapidfire "+attack"rnalias -rapidfire "-attack;wait;wait;fm_pdata wpn 103 -1.0"rnbind mouse1 +rapidfirernrnIf you want an effective gun...just try the k98 without the boltaction to slow you down :P
Threads: 103
Joined: May 2005
lmao.. nnthat plus a 500 round clip = unstoppablennn...im tempted to play around with that lol, seems i can get away with all sorts of stuff on my server.. i found that ppl dont even question you when you buttstock them from across the map (out of probably 100+ ppl .. maybe 2 or 3 have even said anything)
Threads: 75
Joined: Jun 2006
I would like to get the pdata from the DoD Dev team, but you know they wont give that shit out. But would like to!!!nnHehehehnnCheers!
Threads: 47
Joined: Apr 2007
lmao.. rnrnthat plus a 500 round clip = unstoppablernrnrn...im tempted to play around with that lol, seems i can get away with all sorts of stuff on my server.. i found that ppl dont even question you when you buttstock them from across the map (out of probably 100+ ppl .. maybe 2 or 3 have even said anything)rnrnrnI bet that is dead funny d-o LMAO ill have to try that cos i can get away with anything on my server lol
Threads: 2
Joined: Jan 2008
quick question how would i say change the rate of fire on the thompson
Threads: 47
Joined: Apr 2007
This topic tells you how to change the rate of fire on all weapons
Threads: 2
Joined: Jan 2008
it doesn't work for the thompson the offset 103 appears to change when fired is there any way to lock the pdata offsetrnrunning on a deticated serverrnbeentrying to do it all day
Threads: 57
Joined: Oct 2005
Hook FM_PlayBackEventnTest if eventindex == DODW_THOMPSONnIf so, set the pdata offset like you did.nnThis basically does it every time you fire.nBTW if it doesn't work, hook it in post.
Threads: 0
Joined: Feb 2008
Thank you for the information.Very useful.

