[Help]Roulette Table Win Coordinates
#1

I'm planning to make a Roulette Casino Games
and first thing I need to do is placing players bet number
how to make script for when players presses the
Left,Up,Down,Right Arrow is moving the object to the roulette number??
and how do i know the selected number.

Like this
Reply
#2

Use this to find out the player's button.

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

And make a textdraw for that circle, and move the textdraw when person presses the button using CreatePlayerTextDraw and calculate the betting number by how many times the person presses the button. You will also need SetPlayerCameraPos and SetPlayerCameraLookAt to keep player camera on the betting machine.
Reply
#3

I already find that object and my plan is to use this function CreatePlayerObject
so that the object is visible only on the player
my main problem now is how to move the circle and
detect if the circle is on the specific number or betting type

thanks for your reply Sir @Tamy
Reply
#4

I don't think CreatePlayerObject will work for that. I suggest using CreatePlayerTextdraw, that will create textdraw for only one player, so it'll work for you. Use 'O' in it's string to make circle. To move circle, do something like this.

Код:
//Define textdraw and other variables in the way you like.

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_UP)
    {
        PlayerTextDrawDestroy(playerid, BetTextdraw[playerid]);
        CircleOn[playerid] += PreviousBetNumber[playerid];
        BetTextdraw[playerid] = CreatePlayerTextDraw(playerid, new x-coordinate of screen, new y-coordinate of screen, "O");
    }
    return 1;
}
and make something similar to this for other keys KEY_DOWN, KEY_LEFT, KEY_RIGHT, change the x and y coordinates of the screen to move the circle make a variable that will add to current circle position.
Reply
#5

What you need to do is define EACH spot on the board a bet can be placed then either do the following. This will let the script know exactly where to move the chips when you press a key. You can also use distance checking to see how close the stack is to the position if you don't want to define all the array references. If you are having troubles at this point I can bet you will be have a lot of other troubles later on with undefined behaviour between player and system states. These kinds of games need to be scripted a certain way to save yourself a lot of headaches.

Код:
#define             ROULETTE_SPOT_UNUSED            0
#define             MAX_ROULETTE_BET_PLAYSPOTS      10

enum ROULETTESPOTINFO
{
	Float:g_RPosX,
	Float:g_RPosY,
	Float:g_RPosZ,
	g_RArrayUp,
	g_RArrayDown,
	g_RArrayLeft,
	g_RArrayRight,
}

static gRouletteData[MAX_ROULETTE_BET_PLAYSPOTS][ROULETTESPOTINFO] = {
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
};
Reply
#6

Thanks man! @Pottus
that's script helps me alot nice idea I'll implement that on my upcoming Script
Thanks sir

Can you check if I'm wrong
g_RArray -- this will be the coordinates of numbers and other bet?
then why is there a Up,Down,Left,Right?

Then What's Down, left for?
my analyzation is Up and Down are the X,Y Coordinates on Table.
Reply
#7

and one more thing.
My plan to do is one bet per round
do I need this MAX_ROULETTE_BET_PLAYSPOTS ?
Reply
#8

When a player presses a key to move you need to know where the next bet position on the board is these are array reference indexes. The x, y, z is where to place the chips for the bet you will certainly have other data as well such as payout odds stored in this enum.
Reply
#9

Can you give me some good algo for getting results
Random(0,36) this is my plan

and this is my plan to get the result for color
new result = Random(0,36)
new colorRed = [1,3,5.....] <<--- this is my problem this is not work on pawno
new colorBlack = [2,4,6.....] <<--- this is my problem this is not work on pawno
if(colorBlack[result]){
print("Black")
}else{
print("red")
}
Reply
#10

Quote:
Originally Posted by Pottus
Посмотреть сообщение
What you need to do is define EACH spot on the board a bet can be placed then either do the following. This will let the script know exactly where to move the chips when you press a key. You can also use distance checking to see how close the stack is to the position if you don't want to define all the array references. If you are having troubles at this point I can bet you will be have a lot of other troubles later on with undefined behaviour between player and system states. These kinds of games need to be scripted a certain way to save yourself a lot of headaches.

Код:
#define             ROULETTE_SPOT_UNUSED            0
#define             MAX_ROULETTE_BET_PLAYSPOTS      10

enum ROULETTESPOTINFO
{
	Float:g_RPosX,
	Float:g_RPosY,
	Float:g_RPosZ,
	g_RArrayUp,
	g_RArrayDown,
	g_RArrayLeft,
	g_RArrayRight,
}

static gRouletteData[MAX_ROULETTE_BET_PLAYSPOTS][ROULETTESPOTINFO] = {
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
	{ 0.0, 0.0, 0.0, 1, 2, 3, 4 },
};
what is the 1,2,3,4 means for that array??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)