Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: Chezor on September 02, 2008, 08:02:21 PM

Title: Random Selection
Post by: Chezor on September 02, 2008, 08:02:21 PM
I want to create a job script, for RPG server. Suppose if i want to make import/export job script. [example]

Like people sit in any car, they type !transport. When they type it they will be given randomly selected place like little havana, docks, lighthouse etc.
How to make a script which randomly selects any option which i script.

just as !search coin
options:
you found a gold coin
you found silver coin
you found nothing

Anything will be directly chosen from that. Please explain in detail, im not expert you can understand because you know how hard it was when you were beginner. :]
Title: Re: Random Selection
Post by: TanaX01 on September 02, 2008, 09:01:45 PM
mm dude look in script tommis !gotoloc name localitation yea ???
Title: Re: Random Selection
Post by: thijn on September 02, 2008, 09:41:36 PM
example:

var %a = $rand(1,3)
if (%a == 1) {
vcmp.msg %id You found were be teleporting to Little Havana.
vcmp.setloc %id (axis)
}
elseif (%a == 2) {
vcmp.msg %id You found were be teleporting to The Lighthouse.
vcmp.setloc %id (axis)
}

Hope u get it ;)
Title: Re: Random Selection
Post by: Chezor on September 03, 2008, 05:59:34 AM
Quote from: thijn on September 02, 2008, 09:41:36 PM
example:

var %a = $rand(1,3)
if (%a == 1) {
vcmp.msg %id You found were be teleporting to Little Havana.
vcmp.setloc %id (axis)
}
elseif (%a == 2) {
vcmp.msg %id You found were be teleporting to The Lighthouse.
vcmp.setloc %id (axis)
}

Hope u get it ;)

okay i got this one, thankx thjn. so that $rand makes it randomly selecting either %a as 1 or %a as 2  :)
Title: Re: Random Selection
Post by: Windlord on September 03, 2008, 11:16:39 AM
$rand(a,b) returns a random integer between a and b.
By using var %a = $rand(1,2)
You are able to temporarily store a random number between 1 and 2.

This lets you make the script to random stuff by checking the value of the variable: %a.
Title: Re: Random Selection
Post by: Chezor on September 03, 2008, 12:31:07 PM
Quote from: Windlord on September 03, 2008, 11:16:39 AM
$rand(a,b) returns a random integer between a and b.
By using var %a = $rand(1,2)
You are able to temporarily store a random number between 1 and 2.

This lets you make the script to random stuff by checking the value of the variable: %a.
Thanks for the info.  :)