AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with HUD (https://forums.alliedmods.net/showthread.php?t=241147)

Lucho. 05-28-2014 18:24

Help with HUD
 
Hello, sorry for my bad english. I'm just doing a kills / deaths by HUD but when I try HUD bugged me. please help me fix D:

PHP Code:

show_hudmessage (Players[i], "-Name: %s^n-Kills: %d^n-deaths: %d^n-K/D: %d^n-Headshots :%d"szNameg_frags[Players[i]], get_user_deaths(Players[i]), (g_frags[Players[i]] / get_user_deaths(Players[i])), g_Hskill[Players[i]]) 


swapped 05-29-2014 01:34

Re: Help with HUD
 
1. post all code
2. tell us all your problems

Lucho. 05-31-2014 15:14

Re: Help with HUD
 
No need to put all the code as it is in that line the bug.
What I want is to divide kills by deaths and give me the result in the hud where "K / D" said. No if he understood. for example
Kills 10
Deaths: 5
K/D: 2.0

fysiks 05-31-2014 23:50

Re: Help with HUD
 
You have to change the kills and deaths to floating point values before you can divide. Then, you have to use %f and not %d to show the value.

Code:

Float:kdr = float(kills)/float(deaths)

Lucho. 06-01-2014 00:19

Re: Help with HUD
 
Thanks leave the code

PHP Code:

float(g_frags[Players[i]]) / float((get_user_deaths(Players[i]))) 



All times are GMT -4. The time now is 18:06.

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