14.05.2010, 18:39
Hi! I tried to make an organisation bank, but it kinda went wrong :b When i do /odeposit it says i deposited 5$ and the org bank contains 5$. But it dosen't save/put the amount into the file o.O
Here are the 3 cmds, hopefully someone know what's wrong.
Btw, i'm new to dini.
Here are the 3 cmds, hopefully someone know what's wrong.
Btw, i'm new to dini.
Код:
dcmd_odeposit(playerid,params[]) { new cash; if(pi[playerid][pMember] == 0) return 0; if(sscanf(params,"d",cash)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /odeposit [ammount]"); else if(GetPlayerMoney(playerid) < cash) return SendClientMessage(playerid,COLOUR_RED,"Error: You do not have enough cash"); else if(cash <= 0) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't deposit under 1$!"); { if(pi[playerid][pMember] == 1) { new string[128]; format(file,sizeof(file),"LSDPB.ini"); GivePlayerMoney(playerid,-cash); Obank = dini_Int(file,"Obank"); Obank += cash; dini_IntSet(file,"Obank", Obank); format(string,sizeof(string),"You deposited $%i, and you now have $%i in your Organisation bank!",cash,Obank); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } if(pi[playerid][pMember] == 2) { new string[128]; format(file,sizeof(file),"GSFB.ini"); GivePlayerMoney(playerid,-cash); Obank = dini_Int(file,"Obank"); Obank += cash; dini_IntSet(file,"Obank", Obank); format(string,sizeof(string),"You deposited $%i, and you now have $%i in your Organisation bank!",cash,Obank); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } } return 1; } dcmd_owithdraw(playerid,params[]) { new cash; Obank = dini_Int(file,"Obank"); if(pi[playerid][pRank] != 4) return 0; if(sscanf(params,"d",cash)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /odeposit [ammount]"); else if(Obank < cash) return SendClientMessage(playerid,COLOUR_RED,"Error: Too low amount in Bank!"); else if(cash <= 0) return SendClientMessage(playerid,COLOUR_RED,"Error: You can't withdraw under 1$!"); { if(pi[playerid][pMember] == 1) { new string[128]; format(file,sizeof(file),"LSDPB.ini"); GivePlayerMoney(playerid,GetPlayerMoney(playerid)+cash); Obank = dini_Int(file,"Obank"); Obank -= cash; dini_IntSet(file,"Obank", Obank); format(string,sizeof(string),"You withdrawed $%i, and your organisation now have $%i in the bank!",cash,Obank); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } if(pi[playerid][pMember] == 2) { new string[128]; format(file,sizeof(file),"GSFB.ini"); GivePlayerMoney(playerid,GetPlayerMoney(playerid)+cash); Obank = dini_Int(file,"Obank"); Obank -= cash; dini_IntSet(file,"Obank", Obank); format(string,sizeof(string),"You deposited $%i, and your organisation now have $%i in the bank!",cash,Obank); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } } return 1; } dcmd_obalance(playerid,params[]) { #pragma unused params if(pi[playerid][pMember] == 0) return 0; { if(pi[playerid][pMember] == 1) { new string[128]; format(file,sizeof(file),"LSDPB.ini"); Obank = dini_Int(file,"Obank"); format(string,sizeof(string),"Your organisation have $%i in the bank!",Obank); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } if(pi[playerid][pMember] == 2) { new string[128]; format(file,sizeof(file),"GSFB.ini"); Obank = dini_Int(file,"Obank"); format(string,sizeof(string),"Your organisation have $%i in the bank!",Obank); SendClientMessage(playerid,COLOUR_GREEN,string); return 1; } } return 1; }