Bank system
#5

I have almost got it working now.
This is the command:

pawn Код:
dcmd_bank(playerid,params[])
{
    new amount, name[24], file[256];
    if(PlayerInfo[playerid][Logged] == 0) return 0;
    if(strcmp(params,"all",false) == 0) return SendClientMessage(playerid,WHITE,"Test");
    if(sscanf(params,"i",amount)) return SendClientMessage(playerid,WHITE,"USAGE: /Bank <Amount>");
   
    if(amount > GetPlayerMoney(playerid) || amount <= 0) return SendClientMessage(playerid,WHITE,"Invalid amount.");
    GetPlayerName(playerid,name,24);
    format(file,sizeof(file),"cool/users/%s.txt",name);
    PlayerInfo[playerid][BMoney] += amount;
    dini_IntSet(file,"BMoney",PlayerInfo[playerid][BMoney]);
    format(file,sizeof(file),"You have stored $%d dollars into your bank account. Your current balance is $%d.",amount,PlayerInfo[playerid][BMoney]);
    SendClientMessage(playerid,LIGHTBLUE,file);
    GivePlayerMoney(playerid,-amount);
    return 1;
}
I made it just send a test if it works, so far this is what happens:
if I type "/bank 1000" it will deposit $1000 dollars, and if I type "/bank all" it will return the message "Test".
The only problem is that if I type "/bank", without anything else, instead of returning, "USAGE: /Bank <Amount>", it returns "Test".
Can anyone help me finish it?
Reply


Messages In This Thread
Bank system - by mrcoolballs - 22.03.2011, 09:58
Re: Bank system - by mrcoolballs - 22.03.2011, 10:15
Re: Bank system - by Stigg - 22.03.2011, 10:49
Re: Bank system - by Mike Garber - 22.03.2011, 10:50
Re: Bank system - by mrcoolballs - 22.03.2011, 11:43
Re: Bank system - by Zh3r0 - 22.03.2011, 12:09
Re: Bank system - by mrcoolballs - 22.03.2011, 12:31
Re: Bank system - by Zh3r0 - 22.03.2011, 12:33
Re: Bank system - by mrcoolballs - 22.03.2011, 12:49
Re: Bank system - by Zh3r0 - 22.03.2011, 13:19

Forum Jump:


Users browsing this thread: 1 Guest(s)