Jump to content

How to make a casino roulette :3


Recommended Posts

Hello everyone, today I will teach you how to make a working casino roulette. I immediately say do not ask stupid questions!

To begin with, we need to spawn the roulette table itself.

const table = mp.objects.new(mp.game.joaat('vw_prop_casino_roulette_01'), pos);

In pos, we specify the coordinates where it will be spawned. Next, we need to spawn a ball that will spin around the roulette wheel.

const ball = mp.objects.new(mp.game.joaat('vw_prop_roulette_ball'), new mp.Vector3(pos.x-0.734742, pos.y-0.16617, pos.z+1.0715));

In pos, we specify the same coordinates that were specified in the table spawn, only with an offset. Now let's tie our ball to the table.

ball.attachTo(table.handle, 0, 0, 0, 0, 0, 0, 0, true, true, false, false, 0, false);

I will explain a little for the work of such things, usually an object(entity) is taken and animation is called, then we can only use animation.
For example, we will do this, by pressing the F2 button, we will start the roulette.

let lib = 'anim_casino_b@amb@casino@games@roulette@table';
const routtle = () => {
    ball.position = new mp.Vector3(pos.x-0.734742, pos.y-0.16617, pos.z+1.0715);
    ball.rotation = new mp.Vector3(0, 0, 32.6);

    ball.playAnim('intro_ball', lib, 1000.0, false, true, true, 0, 136704);
    ball.playAnim('loop_ball', lib, 1000.0, false, true, false, 0, 136704);
    table.playAnim('intro_wheel', lib, 1000.0, false, true, true, 0, 136704);
    table.playAnim('loop_wheel', lib, 1000.0, false, true, false, 0, 136704);
    ball.playAnim('exit_x_ball', lib, 1000.0, false, true, false, 0, 136704);
    table.playAnim('exit_x_wheel', lib, 1000.0, false, true, false, 0, 136704);
mp.keys.bind(0x71, true, routtle);

Instead of x you need to substitute the number that ask what, in the list of animations found 38 numbers, below I will attach a txt file with the list in the format x,x is a number color, take x and substitute, as well if you want to do the randomization on the server side, store the array with all numbers, generate a number from 1 to 38 and sent to the client number from the document, that is, for example, you have an array and you know that the 4 black is x=9, you get randomness 4, but the client send 9, and substitute the x.

If you want to say thank you to the author, then here is the nickname of kiwi-ALMAZOFFQ

https://drive.google.com/file/d/1mV9nluJKNWp_OWQ2-aW9kNoYHufsqj6i/view?usp=sharing - File

Edited by almazoff
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...