Blockland Forums > Modification Help

Getrandom

Pages: (1/4) > >>

Danny Boy:

Ok so I know you can get a random number between 2 numbers by doing this

announce(getrandom(1,50));
That will give me a random number between 1 and 50.

What I'm looking for is a way were I can but text in front of the number so I can make it say
"The random number selected was (number)"

Is there any way I can change the command about to get this to work?

Headcrab Zombie:

announce("The random number selected was (" @ getRandom(1,50) @ ")");

Danny Boy:


--- Quote from: Headcrab Zombie on December 11, 2011, 02:59:58 PM ---announce("The random number selected was (" @ getRandom(1,50) @ ")");

--- End quote ---
Cool I'll give it a shot, thanks.

mp7964:

Could even make it a slash command, only using console.


--- Code: ---function servercmdrnd(%a,%b) { announce("The random number selected was (" @ getRandom(1,50) @ ")"); }
--- End code ---

Now just type /rnd

Makes it a lot easier.

Axolotl:

a better syntax would be announce("The random number selected was SPC getRandom(1,50) @ ".");

Pages: (1/4) > >>

Go to full version