|
|
|
Used with permission. Drawing a Special Credit String 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 536) int DrawHudString( int xpos, int ypos, int iMaxX, char *szString, 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 iMaxX = The MAX size of pixels of the string. char *szString= String wanted to display( Literal or String variables) 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.DrawHudString(ScreenWidth / 2, ScreenHeight / 2, ScreenWidth,"I'm a L337 H4x0r!", 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.DrawHudString(ScreenWidth / 2, ScreenHeight / 2, ScreenWidth,"I'm a L337 H4x0r!", 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 MaxX to the clients ScreenWidth. I set the szString to the literal "I'm a L337 H4x0r!". 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 the line "I'm a L337 H4x0r!" in the middle of your screen!
Any questions or suggestions should be sent to me:
surreal@optonline.net