Raised This Month: $ Target: $400
 0% 

How to make this Hud work =O


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-07-2011 , 07:22   Re: How to make this Hud work =O
Reply With Quote #2

First of all, indent your code ! You didn't even see that you've got an extra "}" over there.

Also, forwards (like client_connect() ) must have public in front of them.

Next, players are from 1 to 32, a 32 cell array holds from 0 to 31, you need to set it to 33.

Use client_putinserver() since client_connect() triggers when player connects BUT if player cancells in loading, client_disconnect() doesn't trigger, so you'll have a slot set to true even if the player isn't in the game.

Use a loop to cycle through all players in hudmessage(), remove that id since it's always "69" (the task id).
Example loop:
Code:
new g_iMaxPlayers

//...

// plugin_init()
g_iMaxPlayers = get_maxplayers()

//...

set_hudmessage( ... ) /* you don't need to call this for each player so just place it here */

for(new i = 1; i <= g_iMaxPlayers; i++)
{
    if(players[i])
    {
        show_hudmessage(i, "message!")
    }
}
Remove get_players() from plugin_init() since it will ALWAYS return 0 players, plugin_init() is called only when plugin is loaded, you could use get_players() in hudmessage() but it's faster to just use that loop since you're already tracking online players in a way (offline players have players[id] = false so it'll skip them anyway).


And I don't think you can set an array to a value like that, either use = {true, ...} or just use them the other way around, false means show hud message, and true means hide hud message, it could be easier for you.

Your version is weird =) use a lower number such as 0.1, 1.0, 2.0, or just leave it empty.


EDIT: and yeah, show_hudmessage() is a hud MESSAGE, not a menu.
__________________

Last edited by Hunter-Digital; 05-07-2011 at 07:46.
Hunter-Digital is offline
 



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 04:17.


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