AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Random from 3 numbers.. (https://forums.alliedmods.net/showthread.php?t=208415)

alonelive 02-13-2013 06:11

Random from 3 numbers..
 
Hello.
I have, for example, 3 floats for hudmessage:

new const position[25] =
{
"0.55",
"0.60",
"0.50"
}

How i can put random value to hud_msg parameters?

set_hudmessage(255, 0, 0, 0.08, 0.51, 0, 6.0, 2.0)
show_hudmessage(id, "test")

Sylwester 02-13-2013 07:27

Re: Random from 3 numbers..
 
If you want to use one of the values from the array then you can do this (don't store floats in array as strings):
PHP Code:

new const Float:position[] =
{
    
0.55,
    
0.60,
    
0.50

set_hudmessage(255000.08position[random(sizeof(position))], 06.02.0)
show_hudmessage(id"test"



All times are GMT -4. The time now is 20:41.

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