28.02.2012, 00:25
Hi guys once again im here, im making a little bank system, i made: when player press f on the money machine he will be send a message if he doesnt have a bank account, else it will show a menu for account management, but the problem is that even if i pass the first dialog, it will not show me the management dialog.
CODE:
Hope you can help me.
CODE:
pawn Код:
new HasBankAccount[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 833.5995, 3.2540, 1004.1797))
{
if(HasBankAccount[playerid] == 0)
{
ShowPlayerDialog(playerid, DIALOG_FUNCIONA, DIALOG_STYLE_MSGBOX, "Banco Nacional De Los Santos", " {90EE90}Crear Cuenta", "Selecionar", "Cancelar"); // dont have account dialog
}
else if(HasBankAccount[playerid] == 1)
{
ShowPlayerDialog(playerid, DIALOG_BANKMENU2, DIALOG_STYLE_LIST, "Banco Nacional De Los Santos", "{FF0000}Investir\n{FFFF00}Depositar\n{0000FF}Sacar", "Selecionar", "Cancelar"); // account management dialog
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_FUNCIONA)
{
if(response)
{
new Query[128];
new Pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Pname, sizeof(Pname));
format(Query, sizeof(Query), "INSERT bankaccount(AccountOwner, Cash) VALUES ('%s', 5000)", Pname);
mysql_query(Query);
strmid(AccountInfo[playerid][Owner], Pname, 0, 25, 25);
AccountInfo[playerid][Cash] = 5000;
SendClientMessage(playerid, COLOR_AQUA, "Usted ha recibido 5000 en su cuenta bancaria por crear una cuenta en nuestro banco");
HasBankAccount[playerid] = 1;
return 1;
}
}
else if(dialogid == DIALOG_BANKMENU2)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid, COLOR_AQUA, "IT WORKS! :D"); // command to see if it works, LOL
}
if(listitem == 1)
{
ShowPlayerDialog(playerid, DIALOG_BANKDEPOSITAR, DIALOG_STYLE_INPUT, "Depositar", "Escribe una cuantia", "Depositar", "Cancelar");// other dialog i will not specify
}
if(listitem == 2)
{
ShowPlayerDialog(playerid, DIALOG_BANKSACAR, DIALOG_STYLE_INPUT, "Sacar", "Escribe una cuantia", "Sacar", "Cancelar"); // same
}
return 1;
}
}
}