Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › General › Requests for DoD Plugins › How to change Bullet of Clip
9 posts, 4 people · 4,199 views Thread Rating: ★★★★★
closedHow to change Bullet of Clip
Started by netmad on 09-18-2009, 12:33 PM
N netmad
started this thread
Posts: 24
Threads: 5
Joined: May 2009
09-18-2009, 12:33 PM #1

example: MG42 one Clip have 250 bullets, how to change 300bullets?rn Tompson 30bullets in Clip , change 100 bullets?

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
09-18-2009, 02:16 PM #2

not something i have time to do at the moment, but for anyone else...nnclip ammo is pdata offset 108, and youd have to hook the spawning of the weapon as well as when the reload is complete (ReloadDone msg) and check to make sure they have the extra ammo available in their Backpack, then change the clip ammo value and remove the extra added ammo from the backpack..

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
09-19-2009, 04:34 PM #3

Use these functions:rnrn

rn// =================================================================================================rn// Update clip function written by Wilson from dodplugins.netrn// =================================================================================================rnpublic set_clip(id,const weapon[],clip) {rnrn	new currentent = -1, gunid = 0rnrn	// get originrn	new Float:origin[3];rn	entity_get_vector(id,EV_VEC_origin,origin);rn	rn	while((currentent = find_ent_in_sphere(currentent,origin,Float:1.0)) != 0) {rn		new classname[32];rn		entity_get_string(currentent,EV_SZ_classname,classname,31);rn	rn		if(equal(classname,weapon))rn			gunid = currententrn	rn	}rn	rn	set_pdata_int(gunid,108,clip,4); // set their ammorn	rn	return PLUGIN_CONTINUErn}rn
rnrnAnd to set the amount for the clip use this:rnrn
rngive_item(id,"weapon_webley")rn			set_clip(id, "weapon_webley",999)rn
rnrnMore information on how to set a clip can be found here:rnhttps://www.dodplugins.net/forums/showthread.php?t=230&highlight=pdata

N netmad
started this thread
Posts: 24
Threads: 5
Joined: May 2009
09-20-2009, 11:41 PM #4

public dod_setmaxclip( id ) {rn switch( dod_get_user_class(id) )rn {rn case DODC_BAZOOKA:rn {rn rn }rn case DODC_PANZERJAGER:rn {rn rn }rn case DODC_PIAT:rn {rn rn }rn case DODC_GARAND:rn {rn rn }rn case DODC_CARBINE:rn {rn rn }rn case DODC_THOMPSON:rn {rn rn set_clip(id, "weapon_thompson",71);rn rn }rn case DODC_GREASE:rn {rn rn }rn case DODC_BAR:rn {rn rn }rn case DODC_SNIPER:rn {rn rn }rn case DODC_KAR:rn {rn rn }rn case DODC_K43:rn {rn rn }rn case DODC_MP40:rn {rn rn }rn case DODC_MP44:rn {rn rn }rn case DODC_SCHARFSCHUTZE:rn {rn rn }rn case DODC_FG42:rn {rn rn }rn case DODC_MG42:rn {rn set_clip(id, "weapon_mg42",500);rn }rn case DODC_30CAL:rn {rn set_clip(id, "weapon_30cal",333);rn }rn case DODC_MG34:rn {rn rn }rn case DODC_ENFIELD:rn {rn rn }rn case DODC_STEN:rn {rn rn rn rn }rn case DODC_BREN:rn {rn rn }rn rn }rn return PLUGIN_CONTINUE;rn}rnrnthis code can compile,but use it maxclip no change , why?

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
09-21-2009, 07:47 AM #5

Paste it wrapped with PHP tags next time :) Iam glad your are trying to code yourself tho. Look at how other plugins are build, and dont forget the set_clip function in your code. There is alot of tutorials around, look at them, good luck.

N netmad
started this thread
Posts: 24
Threads: 5
Joined: May 2009
09-21-2009, 08:47 AM #6

I already add set_clip function in my code, but have nothing changed. who used set_clip?

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
09-21-2009, 06:25 PM #7

do you have anything calling the dod_setmaxclip(id) function?

N netmad
started this thread
Posts: 24
Threads: 5
Joined: May 2009
09-22-2009, 12:46 AM #8

Can U tell me, how to correct calling this function ?

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
09-22-2009, 07:52 AM #9

Attach the code

Archive › Old Forum Threads › General › Requests for DoD Plugins › How to change Bullet of Clip
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC