Little bank system help
#1

Hello so i created a little bank system in my script, the problem is when i type /withdraw <amount> it not showing a message that i have withdrawn or i don't have that much to withdraw and same thing in /deposit <amount>, and when i /checkbalance it says 0$..

PHP код:
CMD:deposit(playeridparams[])
{
    new 
string[256];
    new 
type;
    {
    if(
sscanf(params"i"type)) return SendClientMessage(playerid0xf8f8f8fff"Syntax: {f00f00}/deposit <amount>");
    if(
type == 0)
    if(
GetPlayerMoney(playerid) < type)
    {
    
GivePlayerMoney(playerid,-type);
    
PlayerInfo[playerid][pBankAccount] += type;
    
format(stringsizeof(string), "[BANK]: {Ffffff}You have successfully deposited {f00f00}$%d {FFFFFF}to your bank account."type);
    
SendClientMessage(playerid0xf8f8f8fffstring);
    }
    else 
SendClientMessage(playerid0xf8f8f8fff"ERROR: {FFFFFF}You do not have that much amount in your hand");
    }
    return 
1;
}
CMD:withdraw(playerid,params[])
{
   new 
string[256];
   new 
type;
   {
   if(
sscanf(params"i"type)) return SendClientMessage(playerid0xf8f8f8fff"Syntax: {f00f00}/withdraw <amount>");
   if(
type == 0)
   if(
PlayerInfo[playerid][pBankAccount] >= type)
   {
   
PlayerInfo[playerid][pBankAccount] -= type;
   
GivePlayerMoney(playeridtype);
   
format(stringsizeof(string), "[BANK]: {FFFFFF}You have successfully withdrawn {f00f00}$%d {FFFFFF}from your bank account."type);
   
SendClientMessage(playerid0xF8f8f8fffstring);
   }
   else 
SendClientMessage(playerid0xF8f8f8ffF"ERROR: {FFFFFF}You do not have that much amount in your account");
   }
   return 
1;
}
CMD:checkbalance(playerid,params[])
{
   new 
string[256];
   
format(stringsizeof(string), "[BANK] {FFFFFF}You currently have $%d In your bank account."PlayerInfo[playerid][pBankAccount]);
   
SendClientMessage(playerid,0xf8f8f8fff,string);
   return 
1;

Usiing Y_INI.
Reply
#2

Quote:
PHP код:
if(type == 0
Why are those there? It makes it so that pretty much anything below those lines can only be reached if the amount to deposit or withdraw is 0. Moreover, why do you call it "type" instead of "money" or "cash" or "amount"?
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Why are those there? It makes it so that pretty much anything below those lines can only be reached if the amount to deposit or withdraw is 0. Moreover, why do you call it "type" instead of "money" or "cash" or "amount"?
Do you suggest to change type to amount and remove if(type == 0)?
Reply
#4

Obviously you took it from ( https://sampforum.blast.hk/showthread.php?tid=377615 ). Just take a look a nd made it like this!
Reply
#5

Thank you Bolex_,

OT: i take it from a tut not from scripting help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)