Raised This Month: $51 Target: $400
 12% 

Too many checks


Post New Thread Reply   
 
Thread Tools Display Modes
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 04-15-2011 , 06:16   Re: Too many checks
Reply With Quote #11

Quote:
Originally Posted by FoxMulder View Post
I thought of this but then The Sandman came into mind

I think checking to see if the active weapon is in the 0 slot would suffice.
Sandman stopped using ammo quite a while ago, it now has a "charge" only similar to the Sandvich.

Isn't slot 0 = inventory slot 1 the main gun slot. I've never coded for tf2.


Just dump the tf2 netprops and have a look .. or here i found a dump online
http://www.joe.to/~bl4nk/other/netprops-tf2.txt

Values on Melee Weapons i'd check:

m_iItemDefinitionIndex
m_iEntityLevel
m_iEntityQuality
m_iClip1
m_iPrimaryAmmoType
AtomicStryker is offline
FoxMulder
Senior Member
Join Date: Jan 2009
Location: Orlando, FL
Old 04-17-2011 , 09:01   Re: Too many checks
Reply With Quote #12

Sandman still has ammo.

If you use m_iItemDefinitionIndex then you would need a list to check against (http://wiki.alliedmods.net/Team_Fort...nition_Indexes)


Think doing something like this would work.
PHP Code:
public bool:IsActiveWeaponMelee(client)
{
    
//returns false when active weapon is not melee
    //otherwise returns true
    
    
new iWeapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
    
//do check to see if activeweapon is in the first slot
    
if(GetPlayerWeaponSlot(client2) != iWeapon)
        return 
false;
    
    if(!
IsValidEntity(iWeapon))
        return 
false;
    
    
//check to see if it has ammo
    
new iOffset GetEntProp(iWeaponProp_Send"m_iPrimaryAmmoType"1)*4;
    new 
iAmmoTable FindSendPropInfo("CTFPlayer""m_iAmmo");
    new 
iCurAmmo GetEntData(clientiAmmoTable+iOffset);
    
    
//has ammo, technically not a melee weapon
    
if(iCurAmmo 0)
        return 
false;
    
    
//it's a melee weapon  :D
    
return true;

__________________

Last edited by FoxMulder; 04-17-2011 at 12:24. Reason: Derp, Slot 2 = Melee
FoxMulder is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode