22.03.2011, 11:43
I have almost got it working now.
This is the command:
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?
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;
}
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?