SA-MP Forums Archive
HELP about Random Money and Time :) - 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: HELP about Random Money and Time :) (/showthread.php?tid=639549)



HELP about Random Money and Time :) - AngeloBrand98 - 19.08.2017

I need 2 help on my Business Rob script, here is the problem

Problem 1

How to make the script bellow will be warned like "You have already robbed a business in this week" ? Because the /robbus cmd can be used again in the next day, i wont that happen. I want make player can only rob a business for every 7 days or 1 weeks ? Please help
Code:
new year, month, day;
getdate(year, month, day);
if (month < 10) year *= 10;
if (day < 10) month *= 10;
format(tmp, 9, "%d%d%d", year, month, day);
new temp1 = strval(tmp);
if (temp1 == dini_Int(AddDirFile(dir_userfiles, playername), "robbedbus")) return SendClientMessage2(playerid, COLOR_RED, "Your have already robbed a business today.");
Problem 2

What is that meaning of random money setting ? i dont know as well what is the minimum or maximun of money will player got. Please help

Code:
temp1 = MRandom(35001)+5000;
GivePlayerMoney(playerid, temp1);
Thanks


Re: HELP about Random Money and Time :) - DimaShift - 19.08.2017

#define RandomEx(%1,%2) (random(%2-%1)+%1)

RandomEx(5000,9999999999);



Re: HELP about Random Money and Time :) - AngeloBrand98 - 19.08.2017

what is that mean ?


Re: HELP about Random Money and Time :) - DimaShift - 19.08.2017

is min <===> max value random


Re: HELP about Random Money and Time :) - AngeloBrand98 - 19.08.2017

can u explain with any number ?


Re: HELP about Random Money and Time :) - DimaShift - 19.08.2017

1.Add this code at the beginning of the mode:
#define RandomEx(%1,%2) (random(%2-%1)+%1)

2. Add where you need
new rand = RandomEx(5000,10000);
GivePlayerMoney(playerid, rand);
rand = 0;


Re: HELP about Random Money and Time :) - AngeloBrand98 - 19.08.2017

ok thx a lot, i will try it