Little Help with Command -
Adarsh007 - 10.07.2015
Hello,
I am Trying to Create a Command /givebank for admin. With that Command We can Give Money to Player's Bank Account.
Well. the problem is Whenever I try to give money it says. "Amount 0". at last Even It not give money in bank and Sometimes it give money to player (GivePlayerMoney).
Here is the Command - (Not working)
Код:
dcmd_givebank(playerid,params[])
{
new ID;
new Cashs;
new string[128];
if(sscanf(params,"ui",ID,Cash))
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[INFO]{FFFFFF}: /givebank (Player Name/ID) (Amount)");
return 1;
}
if(ID == INVALID_PLAYER_ID)
{
format(string,sizeof(string),"The Player ID (%d) is not connected to the server.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsSpawned[ID] == 0)
{
format(string,sizeof(string),"%s(%d) is must be alive and spawned in order to give them cash.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
BankCash[ID] +=Cashs;
format(string,sizeof(string),"[ADMIN CASH] %s(%d) has given you Bank Cash. Amount: %d",PlayerName(playerid),playerid,Cashs);
SendClientMessage(ID,COLOR_ADMIN,string);
format(string,sizeof(string),"[ADMIN CASH] You have given %s(%d) Bank Cash. Amount: %d.",PlayerName(ID),ID,Cashs);
SendClientMessage(playerid,COLOR_ADMIN,string);
printf("[ADMIN CASH] Admin %s(%d) have given %s(%d) Bank Cash. Amount: %d.",PlayerName(playerid),playerid, PlayerName(ID),ID,Cashs);
return 1;
}
I am creating the above command with the of Bank Deposit Dialog [(Source) Deposit Dialog Working ! When a Player Deposit Money in Bank]
Код:
if(dialogid == DIALOG_BANK_DEPOSIT)
{
if(response == 1)
{
new value =strval(inputtext);
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}Please enter the amount you wish to deposit from your account.");
ShowPlayerDialog(playerid,DIALOG_BANK_DEPOSIT,DIALOG_STYLE_INPUT,"Deposit Money","Please enter the amount you wish to deposit","Ok","Cancel");
return 1;
}
if(value < 0 || value > 10000000)
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}Please enter a value between $0 and $10000000.");
ShowPlayerDialog(playerid,DIALOG_BANK_DEPOSIT,DIALOG_STYLE_INPUT,"Deposit Money","Please enter the amount you wish to deposit","Ok","Cancel");
return 1;
}
if(GetPlayerCash(playerid) < value)
{
SendClientMessage(playerid,COLOR_ERROR,"{CACA00}[ERROR]{FFFFFF}You do not have that amount of money in your pockets to deposit into the bank.");
ShowPlayerDialog(playerid,DIALOG_BANK_DEPOSIT,DIALOG_STYLE_INPUT,"Deposit Money","Please enter the amount you wish to deposit","Ok","Cancel");
return 1;
}
BankCash[playerid] +=value;
GivePlayerCash(playerid,-value);
TextDrawSetString(MessageTD[playerid],"FUNDS DEPOSITED");
TextDrawShowForPlayer(playerid,MessageTD[playerid]);
MessageTDTime[playerid] =5;
format(string,sizeof(string),"Account Holder: %s(%d).\nBranch Location: Los Santos.\nDeposit Amount: $%d.\nNew Balance: $%d.",pname,playerid,value,BankCash[playerid]);
ShowPlayerDialog(playerid,DIALOG_BANK_BALANCE,DIALOG_STYLE_MSGBOX,"Bank Balance",string,"Ok","Cancel");
format(string,sizeof(string),"2[BANK ACTION] %s(%d) has deposited $%d into his bank account.",pname,playerid,value);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
return 1;
}
}
Re: Little Help with Command -
Adarsh007 - 10.07.2015
anyhelp ?
Re: Little Help with Command -
woot - 10.07.2015
Your variable is called
Cashs but in sscanf you wrote
Cash
Re: Little Help with Command -
Adarsh007 - 10.07.2015
ohk
Thanks Let me Check if it Works now
EDIT : WORKING ! THANKS !

+Repped