AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   SDKCall CBaseCombatWeapon::GetMaxClip1(void) (https://forums.alliedmods.net/showthread.php?t=243347)

Bacardi 07-03-2014 07:15

SDKCall CBaseCombatWeapon::GetMaxClip1(void)
 
2 Attachment(s)
I became interested in this conversation and about psychonic answer.
Quote:

Originally Posted by Bubka3 (Post 2155943)
I don't understand this. What I do understand is I'd have to figure out the default value for each gun which would be annoying at best.

Quote:

Originally Posted by psychonic (Post 2156052)
Or do an SDKCall to GetMaxClip1 on the weapon.

I haven't use before any SDKCall and don't have knowledge how to set those parameters.
I could have just ask from @psychonic, "How to do it ? Show us !"
Instead of easier way to get answer, I search for it.

Require! https://forums.alliedmods.net/images...thread_hot.gif https://forums.alliedmods.net/images/misc/paperclip.gif https://forums.alliedmods.net/images/misc/sticky.gif Sticky: New IDA VTable Script
examples sm_getkey, GetEyePosition Example


SM plugin source code


- What I quick test, HL2DM, CS:S and DOD:S return right value.
- CSGO and TF2 instead return random value.

This is one method to get weapon max ammount ammo in Clip1.
Another way can be done also..
- when entity created, store in global variable weapon clip1 ammo.
- read weapon script file from server (loose file or inside VPK pack)
- use extensions

Hope one SDKCall tutorial more not cause disapproval :3

Powerlord 07-03-2014 09:28

Re: SDKCall CBaseCombatWeapon::GetMaxClip1(void)
 
Did you check the return value of CBaseCombatWeapon::UsesClipsForAmmo1 before checking CBaseCombatWeapon::GetMaxClip1 / CBaseCombatWeapon::GetDefaultClip1?

Bacardi 07-03-2014 11:10

Re: SDKCall CBaseCombatWeapon::GetMaxClip1(void)
 
Quote:

Originally Posted by Powerlord (Post 2161336)
Did you check the return value of CBaseCombatWeapon::UsesClipsForAmmo1 before checking CBaseCombatWeapon::GetMaxClip1 / CBaseCombatWeapon::GetDefaultClip1?

Nope. I was interested only this, GetMaxClip1 will return -1 if not use any ammo type. (Knife, grenades)

These can be check also with GetEntProp "m_iPrimaryAmmoType"
But if I remember rigth, grenades ammotype clip1 return as 255.

If you meant that ?

*edit
There is also Clip2 which HL2MP weapons use. Maybe dod also. And in cs:s mp5navy use both clip with same ammo :P (bug)

h3bus 07-04-2014 05:41

Re: SDKCall CBaseCombatWeapon::GetMaxClip1(void)
 
Where did you find those functions?

I would be interested in using it, but they aren't listed in the vtable dumper I use http://www.sourcemodplugins.org/vtableoffsets/csgo

Maybe they just don't exist in CSGO

psychonic 07-04-2014 08:17

Re: SDKCall CBaseCombatWeapon::GetMaxClip1(void)
 
Quote:

Originally Posted by h3bus (Post 2161743)
Where did you find those functions?

I would be interested in using it, but they aren't listed in the vtable dumper I use http://www.sourcemodplugins.org/vtableoffsets/csgo

Maybe they just don't exist in CSGO

They are in the weapon vtable. That site only shows the player vtable.

Bubka3 07-21-2014 15:17

Re: SDKCall CBaseCombatWeapon::GetMaxClip1(void)
 
Oh wow, glad I saw this -- I don't know how to do SDK calls :)


All times are GMT -4. The time now is 18:31.

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