meiao
01-26-2007, 09:52 PM
I'm using dod_set_user_ammo(id, wid, value)
but it only sets the remaining clips, not current clip.
I was told that this line, would set current clip (to 0):
set_pdata_int(gunid,108,0);
I believe i got the gunid correct. Anyway, here is the rest of the code:
public client_death (killer, victim, wpnindex, hitplace, TK){
//suicide
if (killer == victim){
return PLUGIN_HANDLED
}
new currentent = -1, gunid = 0
new Float:origin[3];
entity_get_vector(killer,EV_VEC_origin,origin);
//here I take the ammo for every possible weapon
//except the pistols and grenades
//so there is a bunch of dod_set_user_ammo(...)
while((currentent = find_ent_in_sphere(currentent,origin,Float:1.0)) != 0) {
new classname[32]
entity_get_string(currentent,EV_SZ_classname,class name,31)
console_print(0, "%s", classname)
if (!equal(classname, "player") &&
!equal(classname, "weapon_amerknife") &&
!equal(classname, "weapon_gerknife") &&
!equal(classname, "weapon_spade") &&
!equal(classname, "weapon_luger") &&
!equal(classname, "weapon_colt") &&
!equal(classname, "weapon_stickgrenade") &&
!equal(classname, "weapon_handgrenade")
){
gunid = currentent
break
}
}
set_pdata_int(gunid,108,0); // set their ammo
return PLUGIN_HANDLED
}
I'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.
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.
but it only sets the remaining clips, not current clip.
I was told that this line, would set current clip (to 0):
set_pdata_int(gunid,108,0);
I believe i got the gunid correct. Anyway, here is the rest of the code:
public client_death (killer, victim, wpnindex, hitplace, TK){
//suicide
if (killer == victim){
return PLUGIN_HANDLED
}
new currentent = -1, gunid = 0
new Float:origin[3];
entity_get_vector(killer,EV_VEC_origin,origin);
//here I take the ammo for every possible weapon
//except the pistols and grenades
//so there is a bunch of dod_set_user_ammo(...)
while((currentent = find_ent_in_sphere(currentent,origin,Float:1.0)) != 0) {
new classname[32]
entity_get_string(currentent,EV_SZ_classname,class name,31)
console_print(0, "%s", classname)
if (!equal(classname, "player") &&
!equal(classname, "weapon_amerknife") &&
!equal(classname, "weapon_gerknife") &&
!equal(classname, "weapon_spade") &&
!equal(classname, "weapon_luger") &&
!equal(classname, "weapon_colt") &&
!equal(classname, "weapon_stickgrenade") &&
!equal(classname, "weapon_handgrenade")
){
gunid = currentent
break
}
}
set_pdata_int(gunid,108,0); // set their ammo
return PLUGIN_HANDLED
}
I'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.
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.