SA-MP Forums Archive
random prices for /robbank command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: random prices for /robbank command (/showthread.php?tid=465048)



random prices for /robbank command - Lidor124 - 20.09.2013

Addition to the bank robbery i scripted i want now to know how to make the prizes, after timer of 15 minutes over while robbery the robber will be recieved.
i know that i need to use random but how do i make a specific values of money to recieve?
i want the random prices will be:
250k or 500k or 1mil or 2mil
I hope you understand me :/


Re: random prices for /robbank command - Vanter - 20.09.2013

pawn Код:
new mrand =250000+random(500000); //250K stable, and random half million
       GivePlayerMoney(playerid, mrand);



Re: random prices for /robbank command - Lidor124 - 20.09.2013

Why 250k is stable? i need random prices of GivePlayerMoney of 250k, 500k, 1mil, 2mil


AW: random prices for /robbank command - Skimmer - 20.09.2013

pawn Код:
new robAmount[] // Top of the script
{
    {250000},
    {500000},
    {1000000},
    {2000000}
};

new rand = random(sizeof(robAmount[])); // In any callback
GivePlayerMoney(playerid, robAmount[rand]);



Re: random prices for /robbank command - Lidor124 - 21.09.2013

Skimmer there are 2 errors in your code

[cide]C:\Users\Mor\Desktop\CGRP v1.1 (TollGate System Completed)\filterscripts\bankrobbery.pwn(9) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Mor\Desktop\CGRP v1.1 (TollGate System Completed)\filterscripts\bankrobbery.pwn(14) : error 010: invalid function or declaration[/code]

line 9:

new robAmount[] // Top of the script
{ (line 9 here)

line 14:

};


Re: random prices for /robbank command - EiresJason - 21.09.2013

Try this;

pawn Код:
new robAmount[]=
{
    {250000},
    {500000},
    {1000000},
    {2000000}
};

new rand = random(sizeof(robAmount[]-1)); // In any callback
GivePlayerMoney(playerid, robAmount[rand]);



Re: random prices for /robbank command - Lidor124 - 21.09.2013

errors and more errors!!! fuck that shit

EiresJason - can you try help me? only 4 exactly values for GivePlayerMoney after timer of 15 minutes - amounts of 250k, 500k, 1mil and 2mil.
and not numbers like "You robbed from the bank 1842145$!" i want it with zeroes only! 250,000 500,000 1,000,000 2,000,0000


Re: random prices for /robbank command - Patrick - 21.09.2013

So you're saying like random prizes right? not only 250k, 500k, 1m, 2m and randomize which one it will choose

I hope these code will help you out, this is a random amount of cash that won't go lower than 250k and won't got higher than 2m

pawn Код:
new string[128];
new bankmoney = 250000+random(2000000);
GivePlayerMoney(playerid, bankmoney);
format(string, sizeof(string), "You have succesfully robbed %d from the bank", bankmoney);
SendClientMessage(playerid, -1, string);



Re: random prices for /robbank command - Dragonsaurus - 21.09.2013

Of course you will get errors that way.
pawn Код:
new robamount[] =           // You need the "=: symbol at the end.



Re: random prices for /robbank command - Lidor124 - 21.09.2013

Quote:
Originally Posted by pds2012
Посмотреть сообщение
So you're saying like random prizes right? not only 250k, 500k, 1m, 2m and randomize which one it will choose

I hope these code will help you out, this is a random amount of cash that won't go lower than 250k and won't got higher than 2m

pawn Код:
new string[128];
new bankmoney = 250000+random(2000000);
GivePlayerMoney(playerid, bankmoney);
format(string, sizeof(string), "You have succesfully robbed %d from the bank", bankmoney);
SendClientMessage(playerid, -1, string);
I mean intact values - like 250,000 500,000 etc.
not 251,421 (random number i mean exactly value i defined)