23.10.2016, 17:21
i am getting errors when adding these codes to on playerdialog response,
actually its a fs code and i want to add in my gm which has many co functions of ondialogue response
actually its a fs code and i want to add in my gm which has many co functions of ondialogue response
PHP код:
{
switch( dialogid )
{
case DIALOG_BANK:
{
if(response)
{
if(listitem == 0)
{
new str[128];
format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",bankBalance[playerid]);
ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back");
}
if(listitem == 1)
{
new str[128];
format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",bankBalance[playerid]);
ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back");
}
if(listitem == 2)
{
new str[128];
format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :",bankBalance[playerid]);
ShowPlayerDialog(playerid,DIALOG_TRANSFER1,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back");
}
if(listitem == 3)
{
new str[128];
format(str, sizeof(str), "Your current bank balance is: $%d", bankBalance[playerid]);
ShowPlayerDialog(playerid, DIALOG_BALANCE, DIALOG_STYLE_MSGBOX, "Bank account", str, "Back", "");
}
}
}
case DIALOG_DEPOSIT:
{
if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
else if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!");
else if(!IsNumeric(inputtext))
{
new str[128];
format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",bankBalance[playerid]);
ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back");
SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
}
else
{
new str[128];
PInfo[playerid][Money]=PInfo[playerid][Money]-= strval(inputtext);
format(str, sizeof(str), "You have deposited $%d into your account. New balance: $%d", inputtext, bankBalance[playerid]);
SendClientMessage(playerid, 0x008000FF, str);
}
}
case DIALOG_WITHDRAW:
{
if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
else if(strval(inputtext) > bankBalance[playerid]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount in your bank");
else if(!IsNumeric(inputtext))
{
new str[128];
format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",bankBalance[playerid]);
ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back");
SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
}
else
{
new str[128];
new inputext = strval(inputtext);
new pCash[MAX_PLAYERS];
bankBalance[playerid] -= inputext;
PInfo[playerid][Money]=PInfo[playerid][Money]+= inputext;
format(str, sizeof(str), "You have withdrawn $%d out of your account. New balance: $%d", inputext, bankBalance[playerid]);
SendClientMessage(playerid, 0x008000FF, str);
}
}
case DIALOG_TRANSFER1:
{
if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
else if(strval(inputtext) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Not Online");
else if(!IsNumeric(inputtext))
{
new str[128];
format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :", bankBalance[playerid]);
ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back");
SendClientMessage(playerid,COLOR_RED,"Please Use ID Not Name");
}
else
{
new chosenpid = strval(inputtext);
new str[128];
format(str,sizeof(str),"Balance : %d\nChosen Player ID : %d\nNow Enter The Amount You Want To Transfer",bankBalance[playerid],chosenpid);
ShowPlayerDialog(playerid,DIALOG_TRANSFER2,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back");
}
}
case DIALOG_TRANSFER2:
{
new chosenpid = strval(inputtext);
if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
else if(strval(inputtext) > bankBalance[playerid]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank To Transfer");
else if(!IsNumeric(inputtext))
{
new str[128];
format(str,sizeof(str),"Chosen Player ID : %d\nNow Enter The Amount You Want To Transfer",chosenpid);
ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back");
SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
}
else
{
new pCash[MAX_PLAYERS];
bankBalance[playerid] -= strval(inputtext);
pCash[chosenpid] += strval(inputtext);
new str[128];
format(str,sizeof(str),"You Transfered $%d To ID %d's Bank Account",strval(inputtext),chosenpid);
SendClientMessage(playerid, 0x008000FF, str);
new str2[128];
format(str2,128,"Your New Balance Is : $%d",bankBalance[playerid]);
SendClientMessage(playerid,0x008000FF,str2);
new str3[128];
format(str3,128,"ID : %d Transfered $%d To Your Bank Account",playerid,strval(inputtext));
SendClientMessage(chosenpid,0x008000FF,str3);
new str4[128];
format(str4, 128, "Your New Balance : $%d",pCash[chosenpid]);
SendClientMessage(chosenpid, 0x008000FF, str4);
ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
}
}
case DIALOG_BALANCE:
{
if(response)
{
ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
}
}
}
return 1;
}