Including a header Created 8 years ago2016-05-22 11:12:55 UTC by EsprimoP EsprimoP

Created 8 years ago2016-05-22 11:12:55 UTC by EsprimoP EsprimoP

Posted 8 years ago2016-05-22 11:12:55 UTC Post #330196
Started from mapping questions, now we're at coding topics :D Half Life modding is indeed very addictive and fun. But less knowledge ruins it a little.

Anyway

In ev_hldm.cpp I wanted to check the room type, configured by the env_sound entity by using if(pPlayer->m_flSndRoomtype == <number>) { ... }. It can be found and called in player.h which calls the main function in sound.cpp, though there is no header for sound (sound.h). Then I included player.h in ev_hldm.cpp. When compiling, it gives errors in player.h. There are 170+ errors. I see that most cpp's have included player.h . I really can't explain further... any solution? If there is explain it to me please.
EsprimoP EsprimoPwEight
Posted 8 years ago2016-05-22 11:48:15 UTC Post #330197
You can't just include "player.h" (server side) on the client project. If it's about weapons, the thing you can do is transmit "pPlayer->m_flSndRoomtype" through the event. Otherwise you can use a HUD message.

Even more simplier, "env_sound" changes the "room_type" CVAR, so you can use "gEngfuncs.GetCvarFloat" (can't remember).
Posted 8 years ago2016-05-22 14:05:51 UTC Post #330198
Thanks! Works nicely. Didn't even know there was a cvar for that.
Also I get it, they have to be in the same project dir. Totally didn't think about it.

Btw. It's
gEngfuncs.pfnGetCvarFloat
EsprimoP EsprimoPwEight
You must be logged in to post a response.