How would i do this?
#1

I Want to make a scratch and win on a dialog how would i make it?

on My list item code

Код:
if(listitem == 0) //  $100 1/10 Option
{
	//Code
}
What would i put in their then? i want to make a 1/10 Chance of winning $500

Thanks

Ellie
Reply
#2

Maybe use a random ?
Reply
#3

pawn Код:
switch( random( 10 ) )
{
    case 0: GivePlayerMoney( playerid, 500 ), SendClientMessage( playerid, -1, "500$ to you !" );
    case 1..9: SendClientMessage( playerid, -1, "You lost !" );
}
Reply
#4

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Maybe use a random ?
Like This?

Код:
new rand = random(2);
        		switch(rand)
       			{
                	case 0:
					{
						SendClientMessage(playerid, COLOR_YELLOW,"Case 0");
					}
					case 1:
					{
						SendClientMessage(playerid, COLOR_YELLOW,"Case 1");
					}
        		}
Only Problem Is It's Very Messy & Big Is Their Any Other Ways?

Ellie
Reply
#5

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
pawn Код:
switch( random( 10 ) )
{
    case 0: GivePlayerMoney( playerid, 500 ), SendClientMessage( playerid, -1, "500$ to you !" );
    case 1..9: SendClientMessage( playerid, -1, "You lost !" );
}
Thanks I'll try that now thanks

Ellie
Reply
#6

Quote:
Originally Posted by Ely
Посмотреть сообщение
Like This?

Код:
new rand = random(2);
        		switch(rand)
       			{
                	case 0:
					{
						SendClientMessage(playerid, COLOR_YELLOW,"Case 0");
					}
					case 1:
					{
						SendClientMessage(playerid, COLOR_YELLOW,"Case 1");
					}
        		}
Only Problem Is It's Very Messy & Big Is Their Any Other Ways?

Ellie
costel_nister96 has the solution:
Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
pawn Код:
switch( random( 10 ) )
{
    case 0: GivePlayerMoney( playerid, 500 ), SendClientMessage( playerid, -1, "500$ to you !" );
    case 1..9: SendClientMessage( playerid, -1, "You lost !" );
}
That would work ...
Reply
#7

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
costel_nister96 has the solution:


That would work ...
Yes it did thank you costel_nister96 and michael for trying

Ellie
Reply
#8

If you want people to have 10 buttons in the dialog and one of them is randomly the prize, use:

pawn Код:
if(listitem == random(10)) {
    // Code for winning
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)