View Single Post
Author Message
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2012 , 17:54   panel nav_progress [Cs:s]
Reply With Quote #1

UserMessage "VGUIMenu" "nav_progress"

Some of you sure recognize this. Especially when have add one bot in game and server start generate nav file if it not exist.
And that time you almost can't do anything, you see your mouse cursor on screen and this panel what show server progress.
You can close this panel ALT+F4 or go your menu with ESC.

Lets create this.

*tip
Can quick test in game, type in console
showpanel nav_progress
hidepanel nav_progress




Simple way, using ShowVGUIPanel, we get it appear in player screen.
PHP Code:
ShowVGUIPanel(client"nav_progress"); 
At this point if you get already some message and different load bar status, it's because there have been remaining some data last time when player seen this panel and have not been erased.
Yeah, this data are store in players.
As you can see my picture, it have not message and loading bar full (data empty).


Start customize our panel!

Need build proper keyvalue structure to get it work. (I peek from sourcecode2007)
It looks like this!

You build like this
PHP Code:
    new Handle:kv CreateKeyValues("data");
    
KvSetString(kv"msg",     "My own message");
    
KvSetNum(kv,    "total",    100);
    
KvSetNum(kv,    "current",  33); 
Then send it to player and close handel just make sure no leak appears.
PHP Code:
    ShowVGUIPanel(client"nav_progress"kv);
    
CloseHandle(kv); 


Here example plugin, if you want test for fun


When use UserMsg to send "nav_progress"
UserMessage

Last edited by Bacardi; 06-06-2012 at 10:05. Reason: update title :P NOT WORK in TF2
Bacardi is offline