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

HUD Display "Not Showing my Values"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thebro
Senior Member
Join Date: Jan 2011
Old 12-25-2013 , 02:17   HUD Display "Not Showing my Values"
Reply With Quote #1

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.

Last edited by thebro; 12-25-2013 at 02:20.
thebro is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-25-2013 , 02:40   Re: HUD Display "Not Showing my Values"
Reply With Quote #2

You can't simply pass id in the function. Use get_players and go through all players and show them each the HUD.
__________________
Kia is offline
thebro
Senior Member
Join Date: Jan 2011
Old 12-25-2013 , 02:56   Re: HUD Display "Not Showing my Values"
Reply With Quote #3

Quote:
Originally Posted by Kia View Post
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!

Last edited by thebro; 12-25-2013 at 02:56.
thebro is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-25-2013 , 02:57   Re: HUD Display "Not Showing my Values"
Reply With Quote #4

Put set_hudmessage before the loop begins.
__________________
Kia is offline
thebro
Senior Member
Join Date: Jan 2011
Old 12-25-2013 , 03:04   Re: HUD Display "Not Showing my Values"
Reply With Quote #5

ok thankyou for your help!

Last edited by thebro; 12-25-2013 at 03:09. Reason: Problem Occured
thebro is offline
thebro
Senior Member
Join Date: Jan 2011
Old 12-25-2013 , 03:10   Re: HUD Display "Not Showing my Values"
Reply With Quote #6

Quote:
Originally Posted by Kia View Post
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.
thebro is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-25-2013 , 03:14   AW: Re: HUD Display "Not Showing my Values"
Reply With Quote #7

Quote:
Originally Posted by thebro View Post
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.
__________________
Kia is offline
thebro
Senior Member
Join Date: Jan 2011
Old 12-26-2013 , 00:29   Re: HUD Display "Not Showing my Values"
Reply With Quote #8

ok

Last edited by thebro; 12-27-2013 at 18:24.
thebro is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-26-2013 , 02:43   Re: HUD Display "Not Showing my Values"
Reply With Quote #9

As far as I can see on my mobile you forgot to set the code inside the loop in brackets.
__________________
Kia is offline
thebro
Senior Member
Join Date: Jan 2011
Old 12-26-2013 , 04:52   Re: HUD Display "Not Showing my Values"
Reply With Quote #10

how do I do that? if it loops won't it keep making another HUD over one that is already made?

Last edited by thebro; 12-26-2013 at 04:55.
thebro 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 16:04.


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