Forum posts

Unfortunately no, as Nintendo DS is too weak to run any form of Half-Life engine. Doom is available though and there is a "fanmade" WAD of Half-Life for it, which would be the closest thing to run Half-Life on DS.
Posted 2 months ago2024-10-16 20:22:12 UTC
in My Steam Client is no longer lauches Post #349254
You can check one of Steam downgrading guides (available by Googling), but I'd advise to install a new Steam (you need to find a 8.1 compatible install first) into another directory and try to see if it works that way.
Posted 2 months ago2024-10-16 20:19:08 UTC
in Only server may change level. Post #349253
I'd get this command only when I try to use the "changelevel2" command. Are you sure that you're using the first one, changelevel?
Posted 2 months ago2024-10-16 20:11:39 UTC
in Singleplayer map in DM list Post #349252
Is this Half-Life itself or another mod? Because the engine is hardcoded to hide singleplayer maps only if the game name matches with one of those:
Half-Life
Opposing Force
I had to name my Half-Life Deathmatch (because plugins break the singleplayer) "Half-Life" just to avoid the singleplayer maps being shown up in the list and keeping them in valve folder.
I created some simple new weapon sound for the shooting and reloading of the crossbow in Goldsource HL1. I followed the instructions from the tutorials and exported in Audacity as Mono, Wav (Microsoft), 11025 Hz, unassigned 6-Bit or signed 16 Bit.
I moved it to the sound/weapons folder of my mod but when I shoot in game, it automatically loads the reload sound. I tried other settings in Audacity as well and checked a million times the file-names are correct but I dont find the error. When I put the original sound files in the mod-folder it works fine.
Any help please?
Posted 2 months ago2024-10-16 14:33:28 UTC
in Nerd Kills Military Veterans Post #349250
He's a Hazard Course professional. Knows his way around shafts and trains, that stuff n' fluff enough. But I suppose you can always chalk it up to FPS main character syndrome and the power of a silent shotgun-wielding warrior. This naturally explains the other one-man-army case of Barney Calhoun, who took down a tank and a whole squadron of grunts at the same time all by himself.

Some people also think that the save/load feature is Gman making sure Gordon always comes out on top in some sort of meta-fourth-wallerly-way. Others chalk it up to the magical properties of the HEV suit and obscene amounts of morphine.

But what you should really be wondering is how the guy can see his health and armor at all times. Must be one high-end top-of-the-industry pair of indestructible and comfort-built glasses.
Posted 2 months ago2024-10-16 09:32:05 UTC
in Nerd Kills Military Veterans Post #349249
I don't know what Half-Life's lore is on this but isn't Gordon a Mary Sue? A scientist with a crowbar that can kill fully trained military soldiers and alien forces single handedly. Is there something missing here?
Meerjel01 Meerjel01I want to be a Meerjel
This post was made on a thread that has been deleted.
Posted 2 months ago2024-10-12 01:07:43 UTC
in Only server may change level. Post #349244
I think you get this message when the game is in multiplayer mode, maybe check your launch parameters or config to make sure you're not changing mode. If you start the map using map <mapname> and no other parameters then it should be in singleplayer by default (deathmatch 0).

This of course applies to standard HL, if you're trying to make a singleplayer mod for a multiplayer game (like cstrike) then you will have trouble.
Penguinboy PenguinboyHaha, I died again!
Posted 2 months ago2024-10-11 23:54:15 UTC
in Only server may change level. Post #349243
Hey ive been making a mod but when i change levels it keeps saying "only server may change level" help please!
Oh yes. I gladly agree. Use featureful.

To get an idea what this SDK is capable of play mods such as
Field Intensity: https://www.moddb.com/mods/field-intensity
&
The big boned and the curious: https://www.moddb.com/mods/the-big-boned-and-the-curious

I'm mapping for Half-Life since 2015 and let me tell you that this SDK provides everything I always dreamed of when it comes to Opposing Force and beyond. It combines Spirit of Half-Life features, Sven Coop features and all of Op4 while adding tons of additional extras. That SDK for instance allowed me for the 1st time ever to get a true model replacement going by adding female scientists to the game including female death sounds. Even Spirit wasn't capable of that.

That being said - It's still getting actively supported. You need help - you ask the dev. You need a feature implemented - you ask the dev and if he finds it to be a worthy request he will implement the feature request to his SDK. I personally believe that for any none coder Featureful SDK will become the future default hl1 mapping SDK.

More Info: https://twhl.info/thread/view/20500
Posted 2 months ago2024-10-10 10:31:54 UTC
in mp4, avi, or webm cutscenes possible? Post #349241
Sorry, but nope. Not with the vanilla SDK.
Posted 2 months ago2024-10-09 22:15:17 UTC
in mp4, avi, or webm cutscenes possible? Post #349240
I'm making a mod and I want to experiment with video cutscenes for story and showing an area... I don't think I'll be good at real-time cutscenes lol.

Is there a way I can make a new-game play a video file in-game each time it's created? And if so, can I make it so the game can play video before loading a new chapter?
Like, you finish one chapter, move to the next, but before the next chapter map loads, it plays a video, and then loads the map?

Thanks!
"HLOP" is a very strange way to abbreviate Opposing Force. It's more common to use "Op4" or "OF" :p

But back to the topic at hand, the base game does not provide any way to change monster relationship, but you can either use a mod/SDK that already provides this functionality as the base for your mod, or use a SDK with Op4 code such as Op4 Updated SDK and either modify the Classify() method on the monsters or write in the functionality to override the Classify() value using a keyvalue.

The easiest would be using the Featureful SDK as kimilil suggested, as it already comes with Op4 monsters and allows one to invert the monster entities' player relationship (i.e. from friendly to enemy and vice versa).
SoHL has accumulated bugs through the years from the simple fact of Valve keeping updating the engine.
For the most up-to-date flavour of SoHL, and way more featureful on top, there's Featureful.
Posted 2 months ago2024-10-07 18:40:56 UTC
in Half-Life: dx Post #349237
Where's the dl link to the beta hornet ?
Posted 2 months ago2024-10-06 20:57:24 UTC
in Half-Life: dx Post #349236
beta hornet monster model
possible use:
either as an monster;
either as a placeable sentry unit - weapon;
beta hornet monster modelbeta hornet monster model
Use Spirit of Half-Life. It's full of features, and there's a faction function made exactly for this. However, if you want to do it yourself, i guess you'd need to code a bit.
Posted 2 months ago2024-10-06 18:34:46 UTC
in Post your screenshots! WIP thread Post #349234
it looks beautiful
Posted 2 months ago2024-10-06 16:13:20 UTC
in Warning: === LEAK in hull 0 === Post #349233
"The entity listed in the error is just a helpful indication of where the beginning of the leak pointfile starts..."
From the error message itself. It could be outside the map, or it just happens to be the entity nearest a possible leak location. Following the How to fix those leaks tutorial explains the steps to find and fixing the leak(s).
Posted 2 months ago2024-10-06 15:24:42 UTC
in Warning: === LEAK in hull 0 === Post #349232
Entity light_environment @ ( 232,-2976, -16)
try reading the error imo
As the title suggests,I want tro make HLOP mod ith Shock Trooper as the PC,so I'd like to have Shock Troopers along with Drone Pits etc otehr X Race creatures ith the player being able to work in tandem with each other instead of against them,is there any way to do this?
Izuko_Fukuda Izuko_FukudaWelcome to Fukuda of House!
Posted 2 months ago2024-10-06 11:40:11 UTC
in error: map not found on server Post #349230
Thanks for the explination! Now i fixed the problem and now my maps compile and they run in the game

The problem was that the SDHLT .wad folder needed to be in the half-life/valve folder
Yeah, this has been questioned a few times in the past, as far back as twenty years ago on this very site. It's not possible to make Barney hostile via a trigger I'm afraid.
monster_urby monster_urbyGoldsourcerer
Posted 2 months ago2024-10-06 06:08:06 UTC
in error: map not found on server Post #349228
That's not the only WAD it couldn't find.
The compile tool used shouldn't matter, what matters is your editor's configuration has been set to use hlof.wad, hlbshift.wad and zhlt.wad, all under the ambiguous directory "/Program Files/" (it's ambiguous because the directory doesn't specify the drive, and both game and compile tools are on different drives).

If these WADs aren't used or don't exist, you can remove them from the game configuration and compile again.

If they do exist, you can try either placing them on the same drive as the compile tools (or vice versa), or edit the MAP file's "wad" property and add in the drive letter for each WAD path.
Is replacing the hgrunt model with the barney one possible in vanilla? I feel like I remember it requiring you to edit a DLL.

EDIT: Also, the map contains monster_scientists that the hgrunts would need to be non-hostile to.
You can't do this in vanilla Half-Life, unfortunately. I guess you could try using an edited model and replace the HECU soldiers.
I'm currently making a map that revolves around sneakily sabotaging equipment in a building, and if you get caught you're declared a threat. I want to make it so that security guards you encounter after getting caught will try to shoot you on sight, but as far as I'm aware the only way to make them upset at you is to shoot at them, or to shoot at one of their allies while you're in their line of sight. Additionally, this is for the currently running competition, for which custom code is not allowed. Is there any way in the vanilla engine to make all barneys in a map become hostile to the player?
Posted 2 months ago2024-10-05 22:16:47 UTC
in Half-Life: dx Post #349224
beta hornet world model
beta hornet world modelbeta hornet world model
Posted 2 months ago2024-10-05 14:09:15 UTC
in error: map not found on server Post #349223
It tells me that it cant find the VHLT .wad file even thought i use SDHLT
Posted 2 months ago2024-10-05 13:55:50 UTC
in error: map not found on server Post #349222
Do a text search for "error" in the compile log to find error messages.
There's several errors you should deal with in CSG.
Posted 2 months ago2024-10-05 12:34:30 UTC
in error: map not found on server Post #349221
So i wanted to use SDHLT for mapping but everytime i tried to compile or load my map in the game it just wont compile at all and say that its not found in the server. Can anyone please tell me how can i fix this?

This is the compile process:

** Executing...
** Command: Change Directory
** Parameters: C:/Program Files (x86)/Steam/steamapps/common/Half-Life/atoolkit

** Executing...
** Command: Copy File
** Source: D:\#Maps\labs.map
** Destination: C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs.map

** Executing...
** Command: D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLCSG.exe
** Parameters: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
sdHLCSG v1.2.0 (Jul 11 2024)
seedee's Half-Life Compilation Tools
Based on code modifications by Sean 'Zoner' Cavanaugh and Vluzacn
Based on Valve's version, modified with permission.
Submit detailed bug reports to (github.com/seedee/SDHLT/issues)
----- BEGIN sdHLCSG -----
Command line: "D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLCSG.exe" "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
Arguments: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs" -low
Entering C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs.map

Current sdHLCSG Settings
Name | Setting | Default
---------------------|-----------|-------------------------
threads [ 4 ] [ Varies ]
verbose [ off ] [ off ]
log [ on ] [ on ]
reset logfile [ on ] [ on ]
developer [ 0 ] [ 0 ]
chart [ on ] [ on ]
estimate [ off ] [ off ]
max texture memory [ 33554432 ] [ 33554432 ]
max lighting memory [ 50331648 ] [ 50331648 ]
priority [ Low ] [ Normal ]

noclip [ off ] [ off ]
null texture stripping[ on ] [ on ]
clipnode economy mode [ off ] [ off ]
clip hull type [ simple ] [ simple ]
onlyents [ off ] [ off ]
wadtextures [ on ] [ on ]
skyclip [ on ] [ on ]
hullfile [ None ] [ None ]
wad.cfg file [ None ] [ None ]
wad.cfg config name [ None ] [ None ]
nullfile [ None ] [ None ]
nullify trigger [ on ] [ on ]
min surface area [ 0.000 ] [ 0.000 ]
brush union threshold [ 0.000 ] [ 0.000 ]
map scaling [ None ] [ None ]
light name optimize [ on ] [ on ]
convert game_text [ on ] [ on ]
world extent [ 65536 ] [ 65536 ]

Loading mapfile wad configuration by default
Wadinclude list
sdhlt.wad
CreateBrush:
(0.02 seconds)
CSGBrush:
(0.12 seconds)

Error: Could not open wad file /Program Files/hlof.wad
Error: Could not find wad file
Description: The compile tools could not locate a wad file that the map was referencing.
Howto Fix: Make sure the wad's listed in the level editor actually all exist

Error: Could not open wad file /Program Files/hlbshift.wad
Error: Could not open wad file /Program Files/J.A.C.K/halflife/zhlt.wad

----- END sdHLCSG -----

** Executing...
** Command: D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLBSP.exe
** Parameters: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
sdHLBSP v1.2.0 (Jul 11 2024)
seedee's Half-Life Compilation Tools
Based on code modifications by Sean 'Zoner' Cavanaugh and Vluzacn
Based on Valve's version, modified with permission.
Submit detailed bug reports to (github.com/seedee/SDHLT/issues)
----- BEGIN sdHLBSP -----
Command line: "D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLBSP.exe" "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
Arguments: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs" -low
There was a problem compiling the map.
Check the file C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs.log for the cause.
----- END sdHLBSP -----

** Executing...
** Command: D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLVIS.exe
** Parameters: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
sdHLVIS v1.2.0 (Jul 11 2024)
seedee's Half-Life Compilation Tools
Based on code modifications by Sean 'Zoner' Cavanaugh and Vluzacn
Based on Valve's version, modified with permission.
Submit detailed bug reports to (github.com/seedee/SDHLT/issues)
----- BEGIN sdHLVIS -----
Command line: "D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLVIS.exe" "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
Arguments: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs" -low
There was a problem compiling the map.
Check the file C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs.log for the cause.
----- END sdHLVIS -----

** Executing...
** Command: D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLRAD.exe
** Parameters: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
sdHLRAD v1.2.0 (Jul 11 2024)
seedee's Half-Life Compilation Tools
Based on code modifications by Sean 'Zoner' Cavanaugh and Vluzacn
Based on Valve's version, modified with permission.
Submit detailed bug reports to (github.com/seedee/SDHLT/issues)
----- BEGIN sdHLRAD -----
Command line: "D:/Program Files/J.A.C.K/halflife/compile tools/tools/sdHLRAD.exe" "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs"
Arguments: "C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs" -low
There was a problem compiling the map.
Check the file C:\Program Files (x86)\Steam\steamapps\common\Half-Life\atoolkit\maps\labs.log for the cause.
----- END sdHLRAD -----
Yeah, C++ is quite the beast. I'd be willing to answer any other questions you'd have, whether here or on TWHL Discord, so feel free to ask.
Admer456 Admer456If it ain't broken, don't fox it!
Looks like I have a lot to learn in C++ besides the main syntax 😅

Anyway, I finally have nothing to ask. Thanks for your patience when answering my dumb questions :3
Posted 2 months ago2024-10-04 07:48:37 UTC
in Warning: === LEAK in hull 0 === Post #349218
There's a tutorial specifically for finding and fixing leaks: Tutorial: How to fix those leaks
Posted 2 months ago2024-10-03 22:25:20 UTC
in Warning: === LEAK in hull 0 === Post #349217
I'm making a map with hammer for counter strike 1.6, and when I compile the map, it is fullbirght. I've fit everyting into my skybox, I can't find where the leak is :

Warning: === LEAK in hull 0 ===
Entity light_environment @ ( 232,-2976, -16)
Error:
A LEAK is a hole in the map, where the inside of it is exposed to the
(unwanted) outside region. The entity listed in the error is just a helpful
indication of where the beginning of the leak pointfile starts, so the
beginning of the line can be quickly found and traced to until reaching the
outside. Unless this entity is accidentally on the outside of the map, it
probably should not be deleted. Some complex rotating objects entities need
their origins outside the map. To deal with these, just enclose the origin
brush with a solid world brush

Leak pointfile generated

Warning: === LEAK in hull 1 ===
Entity light_environment @ ( 232,-2976, -16)
Warning: === LEAK in hull 2 ===
Entity light_environment @ ( 232,-2976, -16)
Warning: === LEAK in hull 3 ===
Entity light_environment @ ( 232,-2976, -16)
0.54 seconds elapsed
Okay so generally speaking, avoid writing implementation code like this in headers.
class Class
{
public:
    void Method()
    {
       // Avoid doing this if possible
    }
};
// Class.h
class Class
{
public:
   void Method();
}

// Class.cpp
void Class::Method()
{
   // Do prefer doing this in .cpp files - sometimes it may not be possible
}
This is because of how declarations work in C and C++. When a header is #include -ed into a .cpp file, it is literally copy-pasted there, together with other headers. If a datatype is declared above some code, then that code is quite simply "aware" that it exists.

In other words, when writing code in header files, be aware of other headers that may be included, in the .cpp files that include that header.

In this case, chances are CBasePlayer wasn't declared in one of these situations. So you gotta move that code into a .cpp and include player.h to get the CBasePlayer declaration. Or, if you absolutely have to do it in a header, you can use forward-declaration:
class CBasePlayer; // this class is more fully declared elsewhere
Admer456 Admer456If it ain't broken, don't fox it!
I found that this error doesn't appear in the new entity's file. However, it seems to appear when I'm trying to write such code in the same method override in my old entity's class. After finding this, I also tried to copy-paste includes (ones from items.cpp), and it solved the problem, so the reason is one of these includes. How...?
Okay, I'll post all the code anyway, I'm curious about the real reason, and I don't think my pathetic attempts in C++ are worth something xd
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "UserMessages.h"
#include "cstring"

class CTargetChangeHudColor : public CBaseEntity
{
public:
    // make these variables private, probably?
    // nothing should change them directly
    int m_iRed;
    int m_iGreen;
    int m_iBlue;
    void Use(CBaseEntity* pActivator, CBaseEntity* pOther, USE_TYPE useType, float value) override;
    bool KeyValue(KeyValueData* pkvd) override;
};

LINK_ENTITY_TO_CLASS(target_change_hud_color, CTargetChangeHudColor);

bool CTargetChangeHudColor::KeyValue(KeyValueData* pkvd)
{
    if (FStrEq(pkvd->szKeyName, "red"))
    {
        m_iRed = atof(pkvd->szValue);
        return true;
    }
    else if (FStrEq(pkvd->szKeyName, "green"))
    {
        m_iGreen = atof(pkvd->szValue);
        return true;
    }
    else if (FStrEq(pkvd->szValue, "blue"))
    {
        m_iBlue = atof(pkvd->szValue);
        return true;
    }

    return CBaseEntity::KeyValue(pkvd);
}

void CTargetChangeHudColor::Use(CBaseEntity* pActivator, CBaseEntity* pOther, USE_TYPE useType, float value)
{
    CBasePlayer* player;

     // errors here
    if (pActivator->IsPlayer())
        player = static_cast<CBasePlayer*>(pActivator);
    else
        player = static_cast<CBasePlayer*>(pOther);

    // MESSAGE_BEGIN(MSG_ONE, gmsgHudColor, NULL, player->pev);
    MESSAGE_BEGIN(MSG_ALL, gmsgHudColor);
    WRITE_SHORT(m_iRed);
    WRITE_SHORT(m_iGreen);
    WRITE_SHORT(m_iBlue);
    MESSAGE_END();
}
ScreenshotScreenshot
I don't know which entity is calling player (who pressed the button), so I checked both of them. This article says something about pCaller, however, I don't see such variable in the method signature.
Posted 2 months ago2024-10-03 16:20:14 UTC
in HL1 chase sequence help!!! Post #349214
ah, sounds good for my map, as for its only going to be 2-player. thanks!
I'm trying to make a trigger_changelevel script, but every time the level changes i get teleported out of the boundaries. does anyone know how to fix this? thanks! edit: i learned how, but i got a bsod and lost everything :(
Post your code (preferably a good chunk of the .cpp) please. Something doesn't sound right.
Admer456 Admer456If it ain't broken, don't fox it!
@Admer456 said:
It's probably an entvars_t*
Nope, it's exactly CBaseEntity*; at least, the method signature says so. All attempts were in the CBaseEntity::Use() method override. Maybe, some Unified SDK bug? I double-checked everything to be correct. Otherwise, I wouldn't be asking - I prefer to solve by myself mostly, without asking someone to do this instead of me, unless I don't have another option and Google can't help me.
Check the datatype of pOther. It's probably an entvars_t* which you first must convert into a CBaseEntity* via some utility.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-10-03 01:17:23 UTC
in HL1 chase sequence help!!! Post #349208
You could use a trigger_changetarget, place one for each path that the player can take.
Posted 2 months ago2024-10-02 20:29:33 UTC
in HL1 chase sequence help!!! Post #349207
understood, and that WAS my original plan, but again, theres multiple places you can run while chased, and the gman cube cant follow multiple paths at once, all i can see is a sweeping kinda fake ai, where it runs around the map, but then again, id prefer to have it CHASE the play rather than mindlessly slide around the map, also, thank you for the mini-tutorial, but i already know how trains work (for the most part), may check out the article if theres any way to fire a path while its on a different path.
@Admer456 said:
They knew about good principles, they just didn't really have the time to apply em. Between 1996 and 1998, the game spec changed so rapidly and so much, nobody could really keep up. Game code is very patchy, very volatile, and rapidly evolves. It's simply like that by nature.
Oh, it explains.
@Admer456 said:
It is possible you were getting errors because you were casting to CBasePlayer and not CBasePlayer*. This is just C++'s value and reference semantics. In C#, a value type is a struct. In C++, a value type is anything that isn't a pointer. So you were trying to, essentially, convert a reference type into a value type there. Possibly, I'm just guessing.
Sorry for asking without clarification.
I used a static cast like this:
if (pOther->IsPlayer())
    player = static_cast<CBasePlayer*>(pOther); // invalid type conversion
Have no idea why it gives an error. I read that this may also occur when inheritance is private, but it's public in SDK code.

And dynamic cast like this:
player = dynamic_cast<CBasePlayer*>(pOther); // the type in a dynamic_cast must be a pointer or reference to a complete class type, or void *
I believe I've already indicated that I need a pointer by using an asterisk. At least, when I used dynamic_cast multiple times trying to cast from CBaseEntity to CBasePlayer through the inheritance chain, it worked fine with all classes but CBasePlayer.

I also know the differences between these two methods, I tried both just in case, but thanks for the explanation anyway!

By the way, your code:
@Admer456 said:
if ( pEntity->IsPlayer() )
{
   CBasePlayer* player = static_cast<CBasePlayer*>( pEntity );
   ...
}
Is just like the one I used and caused the same error (invalid type conversion). The only difference is that I changed pEntity to pOther (since I used your snippet in the entity code), however, it does not look like the reason.
Posted 2 months ago2024-10-02 20:22:50 UTC
in HL1 chase sequence help!!! Post #349205
You cant turn the gcube into a func_train, and use path_corner to create a simple trayectory. If you want the gcube to kill the player, set the damage to something like 300 (so the player gets gibbed).
Yeah, after a few days working with SDK, I'm starting to think that guys from Valve didn't know about any good coding practices or principles back in 1998.
They knew about good principles, they just didn't really have the time to apply em. Between 1996 and 1998, the game spec changed so rapidly and so much, nobody could really keep up. Game code is very patchy, very volatile, and rapidly evolves. It's simply like that by nature.
but I also want to ask how to get CBasePlayer from CBaseEntity
if ( pEntity->IsPlayer() )
{
   CBasePlayer* player = static_cast<CBasePlayer*>( pEntity );
   ...
}
It is possible you were getting errors because you were casting to CBasePlayer and not CBasePlayer*. This is just C++'s value and reference semantics. In C#, a value type is a struct. In C++, a value type is anything that isn't a pointer. So you were trying to, essentially, convert a reference type into a value type there. Possibly, I'm just guessing.

Rule of thumb: if you know an object is of a certain class (e.g. via IsPlayer or checking pev->classname), you use static_cast. static_cast will throw if the cast fails.
If you don't know what object a class is, and you wish to "ask" it, you use dynamic_cast (a bit like the is keyword in C# but simultaneously it's an as)

You may then write a few utility methods into CBaseEntity too, as an example:
template<class T>
T* As()
{
    return static_cast<T*>( this );
}

template<class T>
T* TryAs()
{
    if ( Is<T>() )
    {
       return As<T>();
    }

   return nullptr;
}

template<class T>
bool Is()
{
    return dynamic_cast<T*>( this ) != nullptr;
}
Usage:
if ( pEntity->Is<CBasePlayer>() )
{
   pEntity->As<CBasePlayer>()->DoPlayerSpecificStuff();
   // or
   CBasePlayer* player = pEntity->As<CBasePlayer>();
}
Admer456 Admer456If it ain't broken, don't fox it!
Oh, and... I don't know, maybe I should create a new thread for a new question (sorry if I do :3), but I also want to ask how to get CBasePlayer from CBaseEntity.
I tried both static_cast and dynamic_cast, but they failed with different errors. I also tried to cast step-by-step through the inheritance chain (CBaseEntity -> CBaseDelay -> CBaseAnimating -> CBaseToggle -> CBaseMonster -> CBasePlayer, if I'm not mistaken), and it still gives an error when trying to cast CBasePlayer from CBaseMonster. I (again) have no idea what causes these errors, so I am asking here.
Thanks! All worked. Thanks for the link too, I found a lot of interesting articles about working with HUD/VGUI there.

Also, for those who will find this thread when searching for the same question and encounter the same problem - Tried to create a message with a bogus message type ( 0 ) in my case popped up because of a message name longer than 12 characters (I somehow skipped it in tutorial 😅).
@Admer456 said:
And yes, gHUD is the HUD singleton. It represents the clientside as a whole, almost a bit of a god object I'm afraid..
Yeah, after a few days working with SDK, I'm starting to think that guys from Valve didn't know about any good coding practices or principles back in 1998. Otherwise, they could at least use folders to group files and make working with code a little less hell. Or, maybe, it wasn't possible in C++ back then... I don't know for sure, so I won't judge.