Howto display additional information?

Please post any questions about developing your plugin here. Please use the search function before posting!
kalle
Junior Member
Posts: 26
Joined: Sun Jun 26, 2016 9:48 am
Contact:

Howto display additional information?

Postby kalle » Thu Jul 07, 2016 11:30 am

Dear Community members,

I got another question regarding on what is the best option to display something in the hud of a player. I currently use HintText for fast changing things and its working very well. But I'm on my way to create a little gamemode where I need to display dynamic changing text for the round. This information is neccessary to have an idea what this gamemode is about.

I tried to use a simplemenu and it worked quite well but I can't update the menu (the player needs to close it first). The needed function HudMsg is not working for CSGO (nothing gets displayed).

Is there any chance to display text on the players HUD on the upper left under the current amount of money? Maybe in the same style? Would be great :)
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Howto display additional information?

Postby Ayuto » Thu Jul 07, 2016 1:12 pm

Yes, HudMsg doesn't work in CS:GO, but your first aproach with menus was already correct. All you need is a build callback. It gets called everytime the menu is sent to the Player (every second).

Example:

Syntax: Select all

import time
from menus import SimpleMenu

my_menu = SimpleMenu()

@my_menu.register_build_callback
def my_build_callback(menu, index):
menu.clear()

# Fill your menu here
menu.append(time.ctime())
An alternative would be to subclass a menu option class and override its _render method. Then you don't need the build_callback. However, the build callback is the easiest solution.
kalle
Junior Member
Posts: 26
Joined: Sun Jun 26, 2016 9:48 am
Contact:

Re: Howto display additional information?

Postby kalle » Thu Jul 07, 2016 2:20 pm

Thanks,

now I'm feeling dumb because I had a look at that class before and didn't find a solution. Anyway its working quite well for me :)
kalle
Junior Member
Posts: 26
Joined: Sun Jun 26, 2016 9:48 am
Contact:

Re: Howto display additional information?

Postby kalle » Wed Jul 13, 2016 3:30 pm

So I've got a question related to this :) - the main problem is that players can't use their hotkeys for weapon changing any more because it's a menu at all. Any possibility to render stuff directly in the UI in CSGO instead of using a menu? Maybe directly as an 2D Object that marks an object? Something like in BF3 (see the blue C and the red B):

http://static1.gamespot.com/uploads/scr ... 111_m2.jpg

Or sth like the current amount of cash on the left.

Background: I'm currently successful in creating a conquest mod for CSGO at all. It's working quite well for now but I'm on my way to make it "good looking" for everyone. So it would at least be nice to have some more nice looking visuals ingame.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 139 guests