Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › setting current clip bullets
8 posts, 3 people · 1,069 views Thread Rating: ★★★★★
closedsetting current clip bullets
Started by meiao on 01-26-2007, 09:52 PM
M meiao
started this thread
Posts: 4
Threads: 1
Joined: Jan 2007
01-26-2007, 09:52 PM #1

I'm using dod_set_user_ammo(id, wid, value)rnbut it only sets the remaining clips, not current clip.rnrnI was told that this line, would set current clip (to 0):rn

set_pdata_int(gunid,108,0);
rnrnI believe i got the gunid correct. Anyway, here is the rest of the code:rn
rnpublic client_death (killer, victim, wpnindex, hitplace, TK){rn  //suicidern  if (killer == victim){rn    return PLUGIN_HANDLEDrn  }rn  new currentent = -1, gunid = 0rn  new Float:origin[3];rn  entity_get_vector(killer,EV_VEC_origin,origin);rnrn  //here I take the ammo for every possible weaponrn  //except the pistols and grenadesrn  //so there is a bunch of dod_set_user_ammo(...)rnrn  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    console_print(0, "%s", classname)rn    if (!equal(classname, "player") &&rn        !equal(classname, "weapon_amerknife") &&rn        !equal(classname, "weapon_gerknife") &&rn        !equal(classname, "weapon_spade") &&rn        !equal(classname, "weapon_luger") &&rn        !equal(classname, "weapon_colt") &&rn        !equal(classname, "weapon_stickgrenade") &&rn        !equal(classname, "weapon_handgrenade")rn       ){rn      gunid = currententrn      breakrn    }rnrn  }rn  set_pdata_int(gunid,108,0); // set their ammorn  return PLUGIN_HANDLEDrn}rn
rnrnI've left the console_print just so I could see if it got the right weapon. Will be taken out when it is in production.rnrnrnWhat I want is a plugin that whenever you kill someone, you're left only with your knife, pistol, grenades and a empty main gun.

=|[76AD]|= TatsuSaisei
posted here
Posts: 794
Threads: 54
Joined: May 2005
01-27-2007, 05:40 PM #2
What I want is a plugin that whenever you kill someone, you're left only with your knife, pistol, grenades and a empty main gun.
nwhy not just strip the player of all their weapons when they kill, then simply reequipt them with only the weapons you want them to have....

M meiao
started this thread
Posts: 4
Threads: 1
Joined: Jan 2007
01-27-2007, 06:40 PM #3

I've done that.rnBut I couldn't keep their current bullets (for pistols), nor grenades.rnrndod_get_user_ammo always returned 0.rnI'll try that again with get_user_ammo.rnrnBut I thought it might be easier to take all bullets from 1 weapon.

=|[76AD]|= TatsuSaisei
posted here
Posts: 794
Threads: 54
Joined: May 2005
01-28-2007, 02:03 AM #4
I've done that.nBut I couldn't keep their current bullets (for pistols), nor grenades.
n nvalid point.. I was a bit hasty in my reply...

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
01-28-2007, 11:17 AM #5
M meiao
started this thread
Posts: 4
Threads: 1
Joined: Jan 2007
01-29-2007, 04:02 PM #6
;3850']https://www.dodplugins.net/forums/showthread.php?t=230
rnrnIf you take a closer look to my code, you'll see that it is a modified version of the code found on that thread.rnrnIt doesn't work, at least for me on my linux dedicated server.

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
01-30-2007, 04:25 AM #7

oooh! linux server. You need the linux offset.rnrnTry set_pdata_int(gunid,108,0,4);rnrnif that doesn't work, try set_pdata_int(gunid,108,0,5);rnrnThe last digit is the linux offset and it's probably one of those.

M meiao
started this thread
Posts: 4
Threads: 1
Joined: Jan 2007
01-30-2007, 06:10 PM #8

Worked like a charm.rnrnThanks.

Archive › Old Forum Threads › Help › Scripting Help › setting current clip bullets
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC