• Welcome to Vice City Multiplayer.
 

Random Selection

Started by Chezor, September 02, 2008, 08:02:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chezor

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. :]

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

TanaX01

mm dude look in script tommis !gotoloc name localitation yea ???

thijn

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 ;)


Chezor

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  :)

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Windlord

$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.

Chezor

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.  :)

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..