Raised This Month: $ Target: $400
 0% 

Solved HUD Breaks on spawn (DOD)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-06-2022 , 16:54   HUD Breaks on spawn (DOD)
Reply With Quote #1

Hello,
Recently I'm trying to reactivate the client's HUD with the player's pdata though It seems that the offsets I found for DoD's CBasePlayer aren't correct?
dod-offsets-cbaseplayer

When the player spawns in using a custom function, the client-side HUD seems to break and not function correctly. The weapons are in the players inventory though aren't switchable by selecting them with scroll wheel or numbers. plus, the ammo counter and weapon switch HUD aren't seen.

I thought maybe changing the player's pdata related to hiding the HUD will fix though it hasn't worked so far...

PHP Code:
set_pdata_int(id1060020); //m_iHideHUD
set_pdata_int(id1072020); //m_iClientHideHUD
set_pdata_int(id1024120); //m_fInitHUD 
I really can't seem to find any solutions without asking any experienced people about it...
Isn't there a way to catch these kind of pdata changes so debugging could be done?

Last edited by cmndrfello; 01-07-2022 at 14:05.
cmndrfello is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 01-06-2022 , 17:31   Re: HUD Breaks on spawn (DOD)
Reply With Quote #2

Windows or linux server?

Post the function here
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-06-2022 , 17:40   Re: HUD Breaks on spawn (DOD)
Reply With Quote #3

Here's the code that i am using on a windows server

PHP Code:
register_forward(FM_PlayerPreThink"dod_player_prethink");
RegisterHam(Ham_Spawn"player""dod_player_postspawn"true);

public 
dod_player_prethink(id)
{
    if(
pev(idpev_health) <= && pev(id,pev_team) != && get_pdata_int(id,366) != -1){
        
set_task(0.4"dod_player_spawn"id);
        
set_pev(idpev_deadflagDEAD_RESPAWNABLE);
    }
}

public 
dod_player_spawn(id)
{
    
set_pev(idpev_iuser10);
    
dllfunc(DLLFunc_Spawnid);
}

public 
dod_player_postspawn(id)
{
    
fm_strip_user_weapons(id);

    
giveLoadout(); //Function with give_item() calls

    
set_pdata_int(id1060020);
    
set_pdata_int(id1072020);
    
set_pdata_int(id1024120);

    return 
PLUGIN_CONTINUE;

"dod_player_prethink()" function checks if player is dead and if so will spawn them with dllfunc.
After spawning even without "fm_strip_user_weapons()" still the weapon HUD won't appear.
(health, deathmsgs and chat still appears only weapon related HUD does not)

Last edited by cmndrfello; 01-06-2022 at 17:41.
cmndrfello is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-07-2022 , 00:52   Re: HUD Breaks on spawn (DOD)
Reply With Quote #4

I ran the original plugin that I gave you and it seems to work just fine. I see that you removed some of the things that were in the original plugin, namely the line that has the comment: "I found this is needed to use weapons for a forced spawn.". Seems like that might be important.

I'm running on Linux so I can't be sure it's not a Windows thing but if you can attach your full plugin (or a smaller working plugin that still exhibits the unwanted behavior) so that I can test on my Linux server and see if it happens on Linux also.
__________________
fysiks is offline
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-07-2022 , 02:02   Re: HUD Breaks on spawn (DOD)
Reply With Quote #5

Here's the source code
Attached Files
File Type: sma Get Plugin or Get Source (zm_game.sma - 35 views - 16.7 KB)
cmndrfello is offline
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-07-2022 , 14:04   Re: HUD Breaks on spawn (DOD)
Reply With Quote #6

Nevermind! I've found a fix!
Sending a "HideWeapon" message post spawn with written byte as 0 will reset the hidden elements and will fix my issue!
PHP Code:
message_begin(MSG_ONEget_user_msgid("HideWeapon"), {0,0,0}, id);
    
write_byte(0);
message_end(); 
cmndrfello is offline
Reply


Thread Tools
Display Modes

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 11:33.


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