random prices for /robbank command
#1

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 :/
Reply
#2

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

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

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

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

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:

};
Reply
#6

Try this;

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

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

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
Reply
#8

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);
Reply
#9

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

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)