Posts: 39
Threads: 18
Joined: Jan 2015
Reputation:
0
Hey, i try to keep it short as i can and clean as i can(i mean i try to give my best on english)
I want make bank system, i already make withrdaw and deposite also balance. Now im stuck with money transfer. I want make that if player is not in game then players can send them money.
If you can help me then please.
Posts: 455
Threads: 29
Joined: Apr 2014
It is very simple to do, first you have to know what saving system you use sql or ini.
Second you find user account by name and change bank money amount.
sql
PHP код:
new query[80];
mysql_format(con,query,sizeof(query),"UPDATE players SET BankMoney='%d' WHERE Name='%e'",amount,inputtext);
mysql_tquery(con,query);
ini(y_ini)
PHP код:
new string[80];
format(string,sizeof(string),"users/%s.ini",inputtext);
new INI:file = INI_Open(string);
if(file != INI_NO_FILE){
INI_SetTag(file,"info");
INI_WriteInt(file,"BankMoney",amount);
INI_Close(file);
}else{
//msg not found
}
Posts: 39
Threads: 18
Joined: Jan 2015
Reputation:
0
i dont get it 100%
i use ini so
how i make dialog work with this?
Posts: 455
Threads: 29
Joined: Apr 2014
You have to understand what is dialog output and variables.
PHP код:
new MoneyAmout[MAX_PLAYERS];
//dialog1
PHP код:
if( pInfo[playerid][BankMoney] < strval(inputtext) ) return SendClientMessage(playerid,-1,"You dont have enough money!");
MoneyAmout[playerid]=strval(inputtext);
ShowPlayerDialog(playerid,dialog2,DIALOG_STYLE_INPUT,"User name","Enter user name","Transfer","Close");
//dialog2
PHP код:
//for anti-scamming :)
if( pInfo[playerid][BankMoney] < MoneyAmout[playerid] ) return SendClientMessage(playerid,-1,"You dont have enough money!");
pInfo[playerid][BankMoney]-=MoneyAmout[playerid];
new string[80];
format(string,sizeof(string),"users/%s.ini",inputtext);
new INI:file = INI_Open(string);
if(file != INI_NO_FILE){
INI_SetTag(file,"info");
INI_WriteInt(file,"BankMoney",initial+MoneyAmout[playerid]);
INI_Close(file);
}else{
SendClientMessage(playerid,-1,"This user doesnt exsist!");
}
initial - you have to get initial money from other user too and then you can add amount.