SA-MP Forums Archive
Anyone know this - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anyone know this (/showthread.php?tid=207207)



Anyone know this - Jordan Smith - 05.01.2011

My question is; How will I make a system when player put's money in bank they will get interest by every 10 mins


Re: Anyone know this - blackwave - 05.01.2011

First you need to create a bank system, using dini or y_ini (anyone works). Later, on the money deposit command, you need to put an array to get the value, and depending of this value, set a timer for every 10minutes:

Example:
pawn Код:
blackwave: has used the command /deposit 2000 !
pawn Код:
forward GiveBack(playerid); // script top
new array,interest; // Recommended to be on top
array = 2000 // On the /deposit command
interest = array * 20 // Depending value. In this case it's 2000 x 20
SetTimerEx("GiveBack",600000,false,"i",playerid); // 600000ms = 10min
pawn Код:
public GiveBack(playerid)
{
    GivePlayerMoney(playerid, interest);
    // Depending a string, you might create one to check the interest value
    return 1;



Re: Anyone know this - Jordan Smith - 05.01.2011

how will I make an interest value. I am weak at maths


Re: Anyone know this - blackwave - 05.01.2011

Dude, I gave a example. Interest = value * 20. Example:

Код:
 I put 20 $ on my bank account. The intereset will be 20x20 = 400
Simply.


Re: Anyone know this - bertuspiteri - 05.01.2011

Quote:
Originally Posted by Jordan Smith
Посмотреть сообщение
how will I make an interest value. I am weak at maths
Not to be a douche but being weak in maths won't get you far in programming...


Re: Anyone know this - Kwarde - 05.01.2011

[OFFTOPIC]
Instead of forwarding/public for callbacks you can use this:

pawn Код:
#define CB:%0(%1) forward %0(%1); public %0(%1)
So it will be like this:
pawn Код:
CB:GiveBack(playerid)
{
    // Do something
    return 1;
}
instead of
pawn Код:
forward GiveBack(playerid);
public GiveBack(playerid)
{
    // Do something
    return 1;
}
Someone made this before, but idk who anymore. And I am using this for a long time.