random for robbery
#1

Heey guys
I want to make a robbery with random chance. But how can i make it? And how can i make the change bigger or lower?

Thanks Admigo
Reply
#2

pawn Код:
new rand = random(10); // How many cases


                switch(rand)
                {
                    case 0, 3, 5, 7: //Case number = a chance
                    {
                        SendClientMessage(playerid, W, "You robbed the bank!" );
                    }
                    case 1, 4, 6, 8: // The more the case numbers the bigger the chance.
                    {
                                  SendClientMessage(playerid, W, "You have been caught!" );
That might do the trick.

EDIT: Changes some of the // to make it more useful.
Reply
#3

Ty for reply
Can you say where to put it?
I want to make a robbery with a pickup
Reply
#4

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == myrobpickup) // So your pick up should be defined as what you want it to be. I used myrobpickup as an example
    {
   
    new rand = random(10);


    switch(rand)
    {
        case 0, 3, 5, 7:
        {
            SendClientMessage(playerid, WHITE, "You have robbed the bank!");
        }
        case 1, 4, 6, 8:
        {
            SendClientMessage(playerid, WHITE, "You got caught");
Something like that
Reply
#5

Okay i will test it thank you so much
Reply
#6

No problem let me know if it works
Reply
#7

I test it in some mins but can i make with this a lottery to?
Reply
#8

Not too sure you could try
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)