Raised This Month: $ Target: $400
 0% 

Random Action


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SkiesOFF
Member
Join Date: Mar 2008
Old 01-09-2009 , 14:18   Random Action
Reply With Quote #1

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!
SkiesOFF is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 01-09-2009 , 14:21   Re: Random Action
Reply With Quote #2

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

__________________

anakin_cstrike is offline
SkiesOFF
Member
Join Date: Mar 2008
Old 01-09-2009 , 14:34   Re: Random Action
Reply With Quote #3

Thanks!

Just a plus:

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

like:

gravity 35%

godmode 1%

speed 64%

thanks!
SkiesOFF is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-09-2009 , 14:49   Re: Random Action
Reply With Quote #4

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.
SnoW is offline
Send a message via MSN to SnoW
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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