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

dhud


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-01-2022 , 10:14   dhud
Reply With Quote #1

for some reason sometimes it shows, sometimes not. Delayed execution solves the problem. Why?
PHP Code:
stock __do_dhudmessage(const id, const message[])
{
    static 
Float:holdtime
    holdtime 
= (g_freezetime == 0) ? 9.0 g_freezetime
    
    message_begin
(MSG_ONESVC_DIRECTOR_id)
    
write_byte(strlen(message) + 31)
    
write_byte(DRC_CMD_MESSAGE)
    
write_byte(0)                            // effect
    
write_long(pack_color(255255255))    // color
    
write_long(_:-1.0)                        // x
    
write_long(_:0.3)                        // y
    
write_long(_:0.2)                        // fadeintime
    
write_long(_:1.0)                        // fadeouttime
    
write_long(_:holdtime)                    // holdtime
    
write_long(_:0.0)                        // fxtime
    
write_string(message)
    
message_end()

__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951
kww is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-01-2022 , 14:10   Re: dhud
Reply With Quote #2

Show where you're using it and what g_freezetime is.
__________________

Last edited by OciXCrom; 04-01-2022 at 14:11.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-01-2022 , 16:16   Re: dhud
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Show where you're using it and what g_freezetime is.
Oh sorry.
PHP Code:
bind_pcvar_float(get_cvar_pointer("mp_freezetime"), g_freezetime)
register_event("HLTV""Event_HLTV""a""1=0""2=0")

<...>

public 
Event_HLTV()
{
    
set_task(0.4"removal_function")
}

public 
removal_function()
{
    new 
players[MAX_PLAYERS], playerCount
    get_players
(playersplayerCount"c"// exclude bots
    
    
new szTemp[128]
    for(new 
iplayerCounti++)
    {
        switch(
g_iTeam[players[i]])
        {
            case 
CS_TEAM_CTformatex(szTempcharsmax(szTemp), "some formatted message for CT")
            case 
CS_TEAM_Tformatex(szTempcharsmax(szTemp), "some formatted message for TT")
            default: 
formatex(szTempcharsmax(szTemp), "some formatted message for SPEC")
        }
        
        
__do_dhudmessage(players[i], szTemp)
    }

__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 04-02-2022 at 18:02.
kww is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-02-2022 , 15:03   Re: dhud
Reply With Quote #4

Quote:
Originally Posted by kww View Post
Oh sorry.
PHP Code:
bind_pcvar_float(get_cvar_pointer("mp_freezetime"), g_freezetime)
register_event("HLTV""Event_HLTV""a""1=0""2=0")

<...>

public 
Event_HLTV()
{
    
set_task(0.4"removal_function")
}

removal_function()
{
    new 
players[MAX_PLAYERS], playerCount
    get_players
(playersplayerCount"c"// exclude bots
    
    
new szTemp[128]
    for(new 
iplayerCounti++)
    {
        switch(
g_iTeam[players[i]])
        {
            case 
CS_TEAM_CTformatex(szTempcharsmax(szTemp), "some formatted message for CT")
            case 
CS_TEAM_Tformatex(szTempcharsmax(szTemp), "some formatted message for TT")
            default: 
formatex(szTempcharsmax(szTemp), "some formatted message for SPEC")
        }
        
        
__do_dhudmessage(players[i], szTemp)
    }

Idk the reason but i see some issues in your code
1. Add public for the task functions
2. When creating the loop, return the array number instead of using "player [i]" multiple times, 'players[i]' -> 'iPlayer = players[i]'
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 04-02-2022 at 15:05.
Supremache is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-02-2022 , 18:02   Re: dhud
Reply With Quote #5

Quote:
Originally Posted by Supremache View Post
Idk the reason but i see some issues in your code
1. Add public for the task functions
2. When creating the loop, return the array number instead of using "player [i]" multiple times, 'players[i]' -> 'iPlayer = players[i]'
1. Missclicked when copied. It was in my code already and it didn't compile without "public"
2. Overlooked, thx
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 04-02-2022 at 18:03.
kww 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 06:08.


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