AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Random Action (https://forums.alliedmods.net/showthread.php?t=83426)

SkiesOFF 01-09-2009 14:18

Random Action
 
Hi,

Can someone please, give me a script that, for example, when someone types /power in chat, he randomly gets one power? (like gravity, godmode, maxspeed, noclip).

I only need the part that chooses randomly the power to give to the player.


Thanks so much!

anakin_cstrike 01-09-2009 14:21

Re: Random Action
 
PHP Code:

new random_num(1);
switch( 
)
{
case 
1// gravity
case 2//godmode
case 3//speed



SkiesOFF 01-09-2009 14:34

Re: Random Action
 
Thanks!

Just a plus:

Is there a way to modify the chances of each one?

like:

gravity 35%

godmode 1%

speed 64%

thanks!

SnoW 01-09-2009 14:49

Re: Random Action
 
Code:

new x = random_num(1, 100);
if (x <= 67)// gravity
if (x <= 33)//godmode
if (x <= 10)//speed

Ofc if you want that he have chance only to one, you should get out of the check after giving the gravity or godmode.


All times are GMT -4. The time now is 09:10.

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