AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   HUD Display "Not Showing my Values" (https://forums.alliedmods.net/showthread.php?t=232070)

thebro 12-25-2013 02:17

HUD Display "Not Showing my Values"
 
Hello, I got the HUD to loop every 2 seconds. It shows up fine but there is one problem.
The "Cash" and "XP" I have it setup to Display, always reads as 0. Regardless of how much of them I have.

In the "public plugin_init()"
I have this to call the HUD.
Code:

set_task(2.0, "p_infoz", _, _, _, "b")
here is the HUD event.
Code:

public p_infoz(id)
{
    set_hudmessage(255, 50, 50, -1.0, 0.50, 0, _, 2.0, _, _, -1)
    ShowSyncHudMsg(id, g_hudmsg8, "[Points] %i    [XP] %i",Cash[id],XP[id])
}

I am not sure why the Values always read Zero, when I have atleast 200 Cash and above 600 XP.
It shows the Values though if I do my "/info" command. But not when it auto updates on screen per 2 Seconds. I basically got the HUD to stay on screen, but it doesn't display the Values.

Please help!

Thankyou.

Kia 12-25-2013 02:40

Re: HUD Display "Not Showing my Values"
 
You can't simply pass id in the function. Use get_players and go through all players and show them each the HUD.

thebro 12-25-2013 02:56

Re: HUD Display "Not Showing my Values"
 
Quote:

Originally Posted by Kia (Post 2076074)
You can't simply pass id in the function. Use get_players and go through all players and show them each the HUD.

Is this correct?
Code:

public p_infoz()
{
    new Players[32]
    new playerCount, i, player
    get_players(Players, playerCount, "a")
    for (i=0; i<playerCount; i++)
    player = Players[i]
    set_hudmessage(30, 100, 255, -1.0, 0.87, 0, _, 2.0, _, _, -1)
    ShowSyncHudMsg(player, g_hudmsg8, "^n^n[Points] %i    [XP] %i",Cash[player],XP[player])
}

I tested this and it reads the Values now!

Kia 12-25-2013 02:57

Re: HUD Display "Not Showing my Values"
 
Put set_hudmessage before the loop begins.

thebro 12-25-2013 03:04

Re: HUD Display "Not Showing my Values"
 
ok thankyou for your help!

thebro 12-25-2013 03:10

Re: HUD Display "Not Showing my Values"
 
Quote:

Originally Posted by Kia (Post 2076080)
Put set_hudmessage before the loop begins.

Ok well it updates, but now. When another Player is alive, for example.
I join a Team first, it refreshes yeah and the HUD stays up.
But as soon as another player spawns, mine disappears but it show for him/her?

Help please.

Kia 12-25-2013 03:14

AW: Re: HUD Display "Not Showing my Values"
 
Quote:

Originally Posted by thebro (Post 2076084)
Ok well it updates, but now. When another Player is alive, for example.
I join a Team first, it refreshes yeah and the HUD stays up.
But as soon as another player spawns, mine disappears but it show for him/her?

Help please.

Post full code, don't forget to use PHP Tags to show the here properly.

thebro 12-26-2013 00:29

Re: HUD Display "Not Showing my Values"
 
ok

Kia 12-26-2013 02:43

Re: HUD Display "Not Showing my Values"
 
As far as I can see on my mobile you forgot to set the code inside the loop in brackets.

thebro 12-26-2013 04:52

Re: HUD Display "Not Showing my Values"
 
how do I do that? if it loops won't it keep making another HUD over one that is already made?


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

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