//But the problem is when someone get a new weapon, i need to check all current weapon enyity and set infinity clip like method above. //So what kind of forward that suitable to hook when player get a new weapons? //I don't want to use CurWeapon message, it's called to often. //Is "Ham_Item_AttachToPlayer" good to use?
So what kind of forward that suitable to hook when player get a new weapons?
Thanks.
RateX
10-03-2014 05:08
Re: [Help] CS16: A new method for Unlimited@Infinity Clip.
Ham_Item_AddToPlayer?
HamletEagle
10-03-2014 11:59
Re: [Help] CS16: A new method for Unlimited@Infinity Clip.
Ham_AddPlayerItem and then check for the weaponid( new iId = cs_get_weapon_id( iWeaponEnt ) )
yokomo
10-03-2014 14:56
Re: [Help] CS16: A new method for Unlimited@Infinity Clip.
Ok rewrite the code, but why the bpammo not set properly when 1st time i pickup the new weapon?
I need to drop then re-pickup it and then the bpammo set correctly.
public CmdBlocked(id) { if(bInfinityClip[id]) return PLUGIN_HANDLED;
return PLUGIN_CONTINUE; }
public OnItemDeployPost(ent) { if(!is_valid_ent(ent)) return; //for safety
static id; id = get_pdata_cbase(ent, 41, 4); if(!is_user_alive(id) || !bInfinityClip[id]) return; //for safety @ player don't have infinity clips
cs_set_weapon_ammo(ent, 32767) //set infinity clip new iParams[1]; iParams[0] = ent; set_task(0.1, "TaskSetBpAmmo", id, iParams, 1) //HL1 engine is weird it need task to set bpammo }
public TaskSetBpAmmo(iParams[], id) { if(!is_user_alive(id) || !bInfinityClip[id]) return; //for safety
new ent = iParams[0] if(!is_valid_ent(ent)) return; //for safety
new wpnid = cs_get_weapon_id(ent); if((WPN_NO_RELOAD & (1<<wpnid))) return; //unreload weapon
This method only suitable to use on server that has no weapon drop feature. Because when you drop your weapon and someone pickup it he will get the infinity clip in weaponbox too. But that ammo will be reset if he reload the weapon.
HamletEagle
10-04-2014 15:33
Re: [Solved] CS16: A new method for Unlimited@Infinity Clip.
To solve your problem you can edit weaponbox props.
wicho
06-01-2016 14:34
Re: [Solved] CS16: A new method for Unlimited@Infinity Clip.
Sorry to revive, Hamlet could you give an example about the weaponbox props pls..
Napoleon_be
06-02-2016 04:12
Re: [Solved] CS16: A new method for Unlimited@Infinity Clip.
Not that it is required, but you could store all your weapons into a constant and then loop trough it in your plugin_init function to optimize your code & make it look better.