Hey! I've been learning to script lately, and Twinny asked me to make a bank. So I've been working on this for about 30 mins or so with a bit of help from Twinny and some from PFA.
Not exactly working out.
The general idea is to open the account, deposit, withdraw or close the account all with chat.
PHP Code:
function onActionserverside() {
if (params[0] == "open") {
Test.(@"account_" @ player.account) += params[1];
}
else if (params[0] == "deposit") {
Test.(@"account_" @ player.account) += params[1];
}
else if (params[0] == "withdraw") {
Test.(@"account_" @ player.account) -= params[1];
}
}
//#CLIENTSIDE
function onPlayerchats() {
if (player.chat == "/openbankaccount") {
if(player.gralats > 300) {
player.gralats - 300;
this.startmoney = 300;
triggeraction(0,0,"serverside",this.name,"open",this.startmoney);
}
}
else if (player.chat == "/closebankaccount") {
Test.(@"account_" @ player.account).clear();
}
else if (player.chat.starts("/deposit")) {
this.depmoney = player.chat.substring(10);
triggeraction(0,0,"serverside",this.name,"deposit",this.depmoney);
}
else if (player.chat.starts("/withdraw")) {
this.witmoney = player.chat.substring(11);
triggeraction(0,0,"serverside",this.name,"withdraw",this.witmoney);
}
}