AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [HELP] Setting Ammo Clip to 150 (https://forums.alliedmods.net/showthread.php?t=294520)

hellmonja 03-01-2017 04:53

[HELP] Setting Ammo Clip to 150
 
Hi guys. I'm using cs_set_weapon_ammo to set a weapon's clip to 150. But the HUD only shows 106. Then when I fire it keeps increasing to about 120+ before it begins to go down. I haven't checked if there were actually 150 bullets fired and it's just a problem with the HUD.

Is there a limitation on the HL engine I'm not familiar with?...

OciXCrom 03-01-2017 07:20

Re: [HELP] Setting Ammo Clip to 150
 
Yes, there is. I know it's 255 for the health, armor and backpack ammo, but not sure for the clip ammo. The ammo is still there, it's just not displayed properly.

edon1337 03-01-2017 07:20

Re: [HELP] Setting Ammo Clip to 150
 
Show the code, probably doing something wrong.

EDIT : Oh hey OciXCrom

hellmonja 03-01-2017 08:00

Re: [HELP] Setting Ammo Clip to 150
 
1 Attachment(s)
Here's the snippet starting at line 284:
PHP Code:

       #define CLIP 150
       
...

        new 
ent fm_give_item(idweapon_negev);
        ...

        
// Set Ammo
        
cs_set_weapon_ammo(entCLIP); 

I've also attached the source code. It's rather long...

hellmonja 03-01-2017 08:04

Re: [HELP] Setting Ammo Clip to 150
 
I might've forgotten to define CLIP back to 150. I think the one I uploaded is set to 100 only. But that's all I changed. Sorry...

edon1337 03-01-2017 08:10

Re: [HELP] Setting Ammo Clip to 150
 
Try doing this, also NEVER use Fakemeta util.
Code:
new ent = give_item(id, weapon_negev); if( ent > 0 ) cs_set_weapon_ammo(ent, CLIP)

hellmonja 03-01-2017 08:24

Re: [HELP] Setting Ammo Clip to 150
 
My game hung up on me so I removed this line:
Code:

while( ent > 0 )
Still only 106 is showing.

I know I'm not supposed to use fakemeta_util. But this is old code I got a while back that I'm trying to update. Would you help me convert some codes from fakemeta_util to their appropriate counterparts?...

edon1337 03-01-2017 08:33

Re: [HELP] Setting Ammo Clip to 150
 
Sorry, I meant to use 'if' not 'while'. Try again.

Why are you using this
Code:
        engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, g_Msg_CurWeapon, {0, 0, 0}, id)         write_byte(1)         write_byte(CSW_NEGEV)         write_byte(CLIP)         message_end()

hellmonja 03-01-2017 08:42

Re: [HELP] Setting Ammo Clip to 150
 
Sorry. Still 106. It goes up until 128 then it becomes 127. From 106 to 128 there are 23 bullets. 23 + 127 = 150. I think its a HUD thing. >_<

I'm gonna try setting it to 110 and see what happens the edit the results in...

edon1337 03-01-2017 08:43

Re: [HELP] Setting Ammo Clip to 150
 
Delete this and try again
Code:
        engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, g_Msg_CurWeapon, {0, 0, 0}, id)         write_byte(1)         write_byte(CSW_NEGEV)         write_byte(CLIP)         message_end()

Are you using any plugin that changes weapon ammo?


All times are GMT -4. The time now is 20:59.

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