AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved get_pcvar_float() and ColorChat. (https://forums.alliedmods.net/showthread.php?t=330044)

lexzor 01-18-2021 02:41

get_pcvar_float() and ColorChat.
 
hello, i'm trying to display first 2 numbers of a float in chat, but i don t know how, i tried what i found on google but none of the works.

this is my code

PHP Code:


static CamResetTime

CamResetTime 
register_cvar("csgo_camreset""15.0")

CamResetTime 15.0

ColorChat
(idGREEN"%s You can only use^4 Camera View^1 in^4 the first %.2f seconds^1 of every round!"tagget_pcvar_num(CamResetTime)) 

and this is the output

Code:

[JoiNET] You can only use Camera View in the first 0.00 seconds of every round!

Natsheh 01-18-2021 02:53

Re: get_pcvar_float() and ColorChat.
 
get_pcvar_num

:arrow:

get_pcvar_float


And also remove CamResetTime = 15.0

You must not set a value for CamResetTime since it's a cvar pointer.

LondoN 01-18-2021 06:21

Re: get_pcvar_float() and ColorChat.
 
ColorChat(index, "your value is %d", floatround(get_pcvar_float(g_iCvarVariable))) ;

floatround(15.0) -> returns 15
floatround(15.5) -> returns 16

Hope i'd helped you!

lexzor 01-18-2021 10:00

Re: get_pcvar_float() and ColorChat.
 
i used london idea, thanks you all!


All times are GMT -4. The time now is 14:11.

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