AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add cvar number in message (https://forums.alliedmods.net/showthread.php?t=3869)

Burnzy 07-17-2004 10:56

add cvar number in message
 
1 Attachment(s)
How would u add a cvar number in a text message

Code:
new WAITTIME[32]

Code:
    if( waiting_time[id]==true )     {         get_cvar_num("sv_tmine_wait",WAITTIME,31)         client_print( id, print_chat, "You have to wait %s seconds before you can plant another mine.",WAITTIME)         return PLUGIN_HANDLED     }

Code:
    register_cvar("sv_tmine_wait","10")

when i compiled it, it would give me arguments

PM 07-17-2004 10:58

Try this to get the cvar:
Code:
num_to_str(get_cvar_num("sv_tmine_wait"), WAITTIME, 31)

Burnzy 07-17-2004 11:40

thanx PM, your always there for screw ups

Johnny got his gun 07-18-2004 12:09

Code:
/* Reads a cvar value. */ native get_cvar_string(const cvarname[],output[],iLen);

PM 07-18-2004 12:13

Quote:

Originally Posted by Johnny got his gun
Code:
/* Reads a cvar value. */ native get_cvar_string(const cvarname[],output[],iLen);

That one can also return 0.1 or even "blabla".

Using num_to_str on get_cvar_string always ensures the output string will be a plain whole number.


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

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