|
|
|
Used with permission. Drawing a Special Credit Number on the clients head's up display! ________________________________________________________ This tutorial assumes you know basic C++ coding, the opening and compling of client.dll tutorial and also requires you to have 5.0 or 6.0 MSVC++. Remember, I will not anwser questions about simple coding skills. Ok! Lets get started! Now, lets up up the client workspace and open the file hud.h and lets study the function that allows us to print a string. (line 535) int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ); This function is pretty easy to understand. Here is a general breakdown of it: int x = Position X on the hud. ( Remember Graphs! (XX, 00) ) int y = Position Y on the hud. ( Remember Graphs! (00, XX) ) int iMinX = The MIN size of pixels of the number. ( For reversal reasons. ) int iNumber= Number wanted to display( Variables only, no strings. ) int r = Red color int g = Green color int b = Blue color Ok, now that we understand how it works, lets add this fucntion in the health.cpp file. Open up the file, health.cpp, and go down to line 213 and type this in: if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))) { // gHUD. is added to DrawHudString Function because of its class in gHUD gHUD.DrawHudNumberString(ScreenWidth / 2, ScreenHeight / 2, 0, m_iHealth, 255, 255, 255); HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; } Explaination of what I just did: gHUD.DrawHudNumberString(ScreenWidth / 2, ScreenHeight / 2, 0, m_iHealth, 255, 255, 255); I set the x variable to the clients current ScreenWidth and centered it ( divided by 2 ), and I also did this with the y variable. I set the MinX to 0. I set the iNumber to the current client's Health. I set the colors all to 255 which equals to white. Alright! Thats it! Complie, and setup your small mod and run it! You should see your current health in the middle of your hud! Its not a sprite, but its the kewl font!
Any questions or suggestions should be sent to me:
surreal@optonline.net