03.08.2010, 23:39
Sorry guys, but i am stuck on how to make a bank system involing dini. If anyone could help it would be greatly apperciated...
#include <a_samp>
#include <dini>
new PlayerBankAmount[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
PlayerBankAmount[playerid] = 0;
new string[66];
GetPlayerName(playerid, string, 24);
format(string, 66, "Bank/%s.ini", string);
if(dini_Exists(string)) {
PlayerBankAmount[playerid] = dini_Int(string, "Cash");
}
else {
dini_Create(string);
}
}
public OnPlayerDisconnect(playerid, reason) {
new string[66];
format(string, 66, "Bank/%s.ini", string);
dini_IntSet(string, "Cash", PlayerBankAmount[playerid]);
}
stock AddBankCash(playerid, amount) {
PlayerBankAmount[playerid] += amount;
}