AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Show Clip-Ammo by HUDmsg (https://forums.alliedmods.net/showthread.php?t=188608)

tei1995 06-28-2012 11:40

Show Clip-Ammo by HUDmsg
 
How can I use SyncHUD message to show Weapon clip, ammo?
How can I check when player switch weapon?

for example:

I'm holding AK47, and I switch to D-eagle or the other weapons and to the contrary, How can I check it?

plz help me, I want to Show Clip/Ammo, which higher than 125/254.

Liverwiz 06-28-2012 13:45

Re: Show Clip-Ammo by HUDmsg
 
This will help you out. Just take out the calculations and such.

http://forums.alliedmods.net/showthread.php?t=188368

tei1995 06-29-2012 01:24

Re: Show Clip-Ammo by HUDmsg
 
the ammo just show when player shoot/fire.

but i want to show ammo permantly.

ConnorMcLeod 06-29-2012 01:26

Re: Show Clip-Ammo by HUDmsg
 
See http://forums.alliedmods.net/showthread.php?p=1469706

tei1995 06-29-2012 01:43

Re: Show Clip-Ammo by HUDmsg
 
so just make some var to get weaponid, clip, ammo. Check some statement and show it in by task loop flags "b", right?

yokomo 06-29-2012 02:35

Re: Show Clip-Ammo by HUDmsg
 
Quote:

Originally Posted by ConnorMcLeod (Post 1738703)

But in your code it only cap BP ammo at 254. Any idea how to get the true value that > 254?

tei1995 06-29-2012 02:59

Re: Show Clip-Ammo by HUDmsg
 
can use cs_get_user_bpammo(id,WEAPON_ID)?

ConnorMcLeod 06-29-2012 03:06

Re: Show Clip-Ammo by HUDmsg
 
Quote:

Originally Posted by yokomo (Post 1738734)
But in your code it only cap BP ammo at 254. Any idea how to get the true value that > 254?

You tested it ?

If you have tested and that it doesn't work, replace :

PHP Code:

public Event_AmmoX(id)
{
    
g_iBpAmmo[id][read_data(1)] = read_data(2)


with

PHP Code:

new const m_rgAmmo_CBasePlayer[15] = {376,377,...} 

public 
Event_AmmoX(id)
{
    new 
iAmmoIndex read_data(1)
    
g_iBpAmmo[id][iAmmoIndex] = get_pdata_int(idm_rgAmmo_CBasePlayer[iAmmoIndex])



You can do the same here :

PHP Code:

public Event_Health(id)
{
    
g_iHealth[id] = read_data(1)


to

PHP Code:

public Event_Health(id)
{
    
g_iHealth[id] = get_user_health(id)



I'm pretty sure that for Health event, passed value is real health value and not mask, should be the same for AmmoX.

yokomo 06-29-2012 12:18

Re: Show Clip-Ammo by HUDmsg
 
Quote:

Originally Posted by ConnorMcLeod (Post 1738761)
You tested it ?

If you have tested and that it doesn't work, replace :

PHP Code:

public Event_AmmoX(id)
{
    
g_iBpAmmo[id][read_data(1)] = read_data(2)


with

PHP Code:

new const m_rgAmmo_CBasePlayer[15] = {376,377,...} 

public 
Event_AmmoX(id)
{
    new 
iAmmoIndex read_data(1)
    
g_iBpAmmo[id][iAmmoIndex] = get_pdata_int(idm_rgAmmo_CBasePlayer[iAmmoIndex])


You can do the same here :

PHP Code:

public Event_Health(id)
{
    
g_iHealth[id] = read_data(1)


to

PHP Code:

public Event_Health(id)
{
    
g_iHealth[id] = get_user_health(id)


I'm pretty sure that for Health event, passed value is real health value and not mask, should be the same for AmmoX.

Yup tested and confirmed.

Before fix (cap at 254):
https://dl.dropbox.com/u/54275426/beforefix.png

After Fix using your given code:
https://dl.dropbox.com/u/54275426/afterfix.png

Thanks by the way for that code.

But no problem on Heath event, it still give the true value.

tei1995 06-30-2012 06:58

Re: Show Clip-Ammo by HUDmsg
 
yokomo, can you show me your code?


All times are GMT -4. The time now is 06:08.

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