new client = GetEntPropEnt(weapon, Prop_Send, "m_hOwnerEntity"); if ( !(client > 0 && client <= MaxClients) ) return;
new active = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); if (weapon == active) return;
if ( (GetGameTime()-flHolsterTime) > flSecondsDelay ) /*if flSecondsDelay = 3.0, then u gotta wait 3.0 seconds before function will reload. Obviously this function needs to work in a timer/think function */ { flHolsterTime = GetGameTime(); if (GetWeaponAmmo(weapon) < 1) return; if (GetWeaponClip(weapon) < ClipTable[weapon]) { if (GetWeaponAmmo(weapon) < ReloadInterval) ReloadInterval = GetWeaponAmmo(weapon);
public Action OnWeaponSpawned(Handle timer, any ref) { int wep = EntRefToEntIndex(ref); if ( IsValidEntity(wep) && IsValidEdict(wep) ) { int client = GetEntPropEnt(wep, Prop_Send, "m_hOwnerEntity"); if ( !(client > 0 && client <= MaxClients) ) return Action:0; flHolstered[wep] = GetGameTime(); AmmoTable[wep] = GetWeaponAmmo(wep); ClipTable[wep] = GetWeaponClip(wep); } return Action:0; }
stock void BackPackReload(int weapref, float flHolsterTime, float flSecondsDelay, bool SingleReload = false, int ReloadInterval) { int weapon = EntRefToEntIndex(weapref); if ( weapon <= 0 || !IsValidEntity(weapon) ) return;
int client = GetEntPropEnt(weapon, Prop_Send, "m_hOwnerEntity"); if ( !(client > 0 && client <= MaxClients) ) return;
int active = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); if (weapon == active) return;
if ( (GetGameTime()-flHolsterTime) > flSecondsDelay ) /*if flSecondsDelay = 3.0, then u gotta wait 3.0 seconds before function will reload. Obviously this function needs to work in a timer/think function */ { //CPrintToChat(client, "{olive}[VSH-TEST]{default} (GetGameTime()-flHolsterTime = %f) > flSecondsDelay = %f, flHolsterTime = %f", GetGameTime()-flHolsterTime, flSecondsDelay, flHolsterTime); flHolsterTime = GetGameTime(); if (GetWeaponAmmo(weapon) < 1) return; if (GetWeaponClip(weapon) < ClipTable[weapon]) { if (GetWeaponAmmo(weapon) < ReloadInterval) ReloadInterval = GetWeaponAmmo(weapon);
stock int GetWeaponAmmo(int weapon) { int owner = GetEntPropEnt(weapon, Prop_Send, "m_hOwnerEntity"); if (owner == -1) return 0; if (IsValidEntity(weapon)) { int iOffset = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 1)*4; int iAmmoTable = FindSendPropInfo("CTFPlayer", "m_iAmmo"); return GetEntData(owner, iAmmoTable+iOffset, 4); } return 0; } stock int GetWeaponClip(int weapon) { if (IsValidEntity(weapon)) { int AmmoClipTable = FindSendPropInfo("CTFWeaponBase", "m_iClip1"); return GetEntData(weapon, AmmoClipTable); } return 0; } stock void SetWeaponAmmo(int weapon, int ammo) { int owner = GetEntPropEnt(weapon, Prop_Send, "m_hOwnerEntity"); if (owner == -1) return; if (IsValidEntity(weapon)) { int iOffset = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 1)*4; int iAmmoTable = FindSendPropInfo("CTFPlayer", "m_iAmmo"); SetEntData(owner, iAmmoTable+iOffset, ammo, 4, true); } return; } stock void SetWeaponClip(int weapon, int ammo) { if (IsValidEntity(weapon)) { int iAmmoTable = FindSendPropInfo("CTFWeaponBase", "m_iClip1"); SetEntData(weapon, iAmmoTable, ammo, 4, true); } return; }
404UserNotFound
12-14-2014 04:24
Re: [TF2] Backpack Reload from HL2
i don't get it, what's this for?
nergal
12-14-2014 14:53
Re: [TF2] Backpack Reload from HL2
Quote:
Originally Posted by abrandnewday
(Post 2235112)
i don't get it, what's this for?
it remakes the HL2 backpack reload where, if u had a weapon that wasn't fully reloaded but it's not active for 3 seconds, it'll be fully reloaded by the time you switch back to it.
Only certain weapons in HL2 had this feature.
This basically is a remake of the entire mechanic.
Chdata
12-16-2014 22:36
Re: [TF2] Backpack Reload from HL2
"saxxy" is also a valid weapon
404UserNotFound
12-17-2014 05:44
Re: [TF2] Backpack Reload from HL2
Quote:
Originally Posted by Chdata
(Post 2236241)
"saxxy" is also a valid weapon
But it can't reload, it's a melee. So what's the point?
Chdata
12-17-2014 17:41
Re: [TF2] Backpack Reload from HL2
Sandman wrap assassin wrench
Sandman/wrap aren't a problem, but saxxy/necro smasher could be. If he wants to implement engie ammo regen that is.