[Script] Swap |
Fierywarpath « Citoyen » 1403863500000
| 1 | ||
A random racing map is played from a list. You must try to get win. However, there is a twist! Every player will be swapped with another player every 10-15 seconds. You can try to either rush to the cheese/hole or sabotage your friends so that they will be in a bad position after the swap. It's a lot of fun! You can play it with either 1 friend or chaotically with a large group of friends. They are both fun and hilarious. To run the script, go to http://pastebin.com/cLMnWLFx and copy all the code. Go to your tribehouse and type /lua and paste the code into the box. Click submit and the script will run. Have fun! Link: http://pastebin.com/Mbg1EbHp Update: There is now a timer box for you to see when the swap will happen. Leave your comments below :) Dernière modification le 1419999720000 |
Firestonnne « Citoyen » 1403888520000
| 0 | ||
I believe you have an error on line 16. Code a dit : You are creating a random number between 1 and the map array length + 1 in order to select a map. Now this is a problem for two reasons. The first reason is that lua (for some reason) has their arrays to have indexes starting at 1 instead of 0, so this will generate an error (it won't happen every time, since it's random) if a random number of 0 is chosen. It's the same thing for the #maps+1) bit of code. This will also have the same effect if that number is chosen (25 in this case). This is another undefined index, since it is literary one more than the highest index in the array. So the correct way to choose a random index in the array would be to use math.random(1, #maps) which can be shortened to just math.random(#maps), since with one argument, the math.random function will choose a random number from 1 to the argument. So you code should be: Code a dit : |
Mishellep « Citoyen » 1403904180000
| 0 | ||
It will be great |
Fierywarpath « Citoyen » 1403912940000
| 0 | ||
Thanks firestonnne, I will change it. The lua page said that math.random will generate a value between upper and lower so I misunderstood it as not inclusive of those numbers. |