Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin

DoD Stocks

by Wilson [29th ID] · 2007-12-21 · 6 replies · 3753 views · 186 downloads

Read the thread (7 posts)

From the first post

These are stocks that have come in quite handy and will hopefully be implemented into the DoDx module eventually.
n
nUntil then, feel free to use them and post up some others that you have created.
n
n
//  Returns entity name of provided wpnidn//	Will pass the weaponname into the 2nd argumentnstock dod_get_weapon_name( wpnid, weaponname[], len )nn//	Returns entity number of the client's weaponn//	Provide *either* wpnid (ie. DODW_GARAND) *or* weaponname (ie. "weapon_garand")nstock dod_get_weapon_ent( id, wpnid=0, weaponname[] = "" )nn//  Returns DODW_ id of the weapon entity providednstock dod_get_weapon_id( wpnent )nn//	Special Scoped Weapons (ie. FG42, Enfield) are not their own weapon entitiesn//		but use the entities of similar weapons and this offset to distinguishn//	Returns whether or not the weapon is set to specialn//	Provide *either* wpnid (ie. DODW_GARAND) *or* weaponname (ie. "weapon_garand")n//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_scoped_weapon( id, wpnid, weaponname[] = "", set = -1 )nn//  Gets or Sets the prone state of the clientn//  Values: 0=Not Proned, 1=Proned, 2=Proned and Deployedn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_prone_state( id, set = -1 )nn//	Gets or Sets whether or not the current weapon (ie. Rocket) is shoulderedn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_shouldered( id, set = -1 )nn// Returns whether or not the provided wpnid is a deployable weaponnstock dod_is_deployable( wpnid )nn//	Gets or Sets the client's deploy staten//	Values: 0=Not Deployed, 1=Deployable, 2=Deployedn//	Only use the set param (value of 2, 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_deploy_state( id, set = -1 )nn//  Gets or Sets client's current staminan//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock Float:dod_stamina( id, Float:set = -1.0 )nn//  Gets or Sets the fuse on a grenade entityn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock Float:dod_fuse( grenindex, Float:set = -1.0 )nn//  Tests if client has cl_autoreload enabled - Or sets it for themn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_autoreload( id, set = -1 )nn//  by diamond-optic (12.24.07)n//  converts weapon ids (from dod_get_user_weapon for example)n//  into the ids used for those weapons in death messagesnstock dod_weaponid_to_deathmsgid( weaponid )nn//	Provided simply for convenience/logicnstock dod_is_map_british()

Files

dod_stocks.inc Include 6 KB 186 dl Download

The thread

All 7 posts from 2 people on DoD Stocks, kept as they were written.

Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
12-21-2007, 12:29 AM #1

These are stocks that have come in quite handy and will hopefully be implemented into the DoDx module eventually.nnUntil then, feel free to use them and post up some others that you have created.nn

n//  Returns entity name of provided wpnidn//	Will pass the weaponname into the 2nd argumentnstock dod_get_weapon_name( wpnid, weaponname[], len )nn//	Returns entity number of the client's weaponn//	Provide *either* wpnid (ie. DODW_GARAND) *or* weaponname (ie. "weapon_garand")nstock dod_get_weapon_ent( id, wpnid=0, weaponname[] = "" )nn//  Returns DODW_ id of the weapon entity providednstock dod_get_weapon_id( wpnent )nn//	Special Scoped Weapons (ie. FG42, Enfield) are not their own weapon entitiesn//		but use the entities of similar weapons and this offset to distinguishn//	Returns whether or not the weapon is set to specialn//	Provide *either* wpnid (ie. DODW_GARAND) *or* weaponname (ie. "weapon_garand")n//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_scoped_weapon( id, wpnid, weaponname[] = "", set = -1 )nn//  Gets or Sets the prone state of the clientn//  Values: 0=Not Proned, 1=Proned, 2=Proned and Deployedn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_prone_state( id, set = -1 )nn//	Gets or Sets whether or not the current weapon (ie. Rocket) is shoulderedn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_shouldered( id, set = -1 )nn// Returns whether or not the provided wpnid is a deployable weaponnstock dod_is_deployable( wpnid )nn//	Gets or Sets the client's deploy staten//	Values: 0=Not Deployed, 1=Deployable, 2=Deployedn//	Only use the set param (value of 2, 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_deploy_state( id, set = -1 )nn//  Gets or Sets client's current staminan//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock Float:dod_stamina( id, Float:set = -1.0 )nn//  Gets or Sets the fuse on a grenade entityn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock Float:dod_fuse( grenindex, Float:set = -1.0 )nn//  Tests if client has cl_autoreload enabled - Or sets it for themn//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock dod_autoreload( id, set = -1 )nn//  by diamond-optic (12.24.07)n//  converts weapon ids (from dod_get_user_weapon for example)n//  into the ids used for those weapons in death messagesnstock dod_weaponid_to_deathmsgid( weaponid )nn//	Provided simply for convenience/logicnstock dod_is_map_british()n
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
12-23-2007, 04:57 AM #2

just a reminder.. if this gets included with amxx (which it should) zor needs to add #include <dod_stocks> to the dodx.inc and dodfun.inc nnn:-)

Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
12-23-2007, 10:36 AM #3

Most of these could be incorporated into the module, which would be even better.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
12-24-2007, 08:22 PM #4
////////////////////////////////////////////////////////////////////n// by diamond-optic (12.24.07)n//n//    converts weapon ids (from dod_get_user_weapon for example)n//    into the ids used for those weapons in death messagesn//nstock dod_weaponid_to_deathmsgid(weaponid)n{n    if(weaponid > 31 && weaponid < 38)n        return weaponid+3n    else if(weaponid == 38 || weaponid == 41)n        return 42n    else if(weaponid == 39)n        return 43n    else if(weaponid == 40)n        return 32nn    return weaponidn}
Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
01-03-2008, 01:50 PM #5
n//	Only use the set param (value of 1 or 0) to set this offset; ignore it to "get"n//		the current valuenstock Float:dod_fuse( grenindex, Float:set = -1.0 ) {n	new Float:gametime = get_gametime();n	if( set > -1.0 )	set_pev( grenindex, pev_dmgtime, gametime + set );n	return 		pev( grenindex, pev_dmgtime ) - gametime;n}n
nnThis is a much more "to the point" way than the dodfun module's way.nnI've got a few other new ones too - I'll update this thread very shortly.

Wilson [29th ID]
started this thread
Posts: 623
Threads: 57
Joined: Oct 2005
04-06-2008, 11:42 AM #6

Updated 06 APR 2008. Lots of new stuff.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
04-13-2008, 09:23 PM #7

here's one i just threw together today while doing some long overdue work on my gore plugin.. pass it an id and a hitplace value and it will return the origin (integer) of the bone for that hitplace.nnAnd im pretty sure the bone values are correct, or at least they seem correct enough lol.. But they arent always perfect, since its the half life engine, the origin of a bone might not be exactly where the player models is visible at (as in shooting a leg on a running player will sometimes show the 'origin' as being a little infront of the leg or behind etc etc..)nnnuseful for calling in damage/death forwards (passing victim & hitplace)nn

stock get_hitplace_origin(id,hitplace)n{n    new Float:fOrigin[3],Float:angles[3],hitOrigin[3]nn    switch(hitplace)n        {n        case HIT_HEAD: hitplace = 19n        case HIT_CHEST: hitplace = 11n        case HIT_LEFTARM: hitplace = 15n        case HIT_RIGHTARM: hitplace = 18n        case HIT_STOMACH: hitplace = 9n        case HIT_GENERIC: hitplace = 10n        case HIT_LEFTLEG: hitplace = 3n        case HIT_RIGHTLEG: hitplace = 6n        }n    n    engfunc(EngFunc_GetBonePosition,id,hitplace,fOrigin,angles)n        n    hitOrigin[0] = floatround(fOrigin[0])n    hitOrigin[1] = floatround(fOrigin[1])n    hitOrigin[2] = floatround(fOrigin[2])n            n    return hitOriginn}
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC