Dialog bug
#1

PHP код:
    if(dialogid == DIALOG_BANK)
    {
        if(
response)
        {
            switch(
listitem)
            {
            case 
0:
            {
                if(
dini_Int(file"HasBankAccount") == 0)
                {
                    
ShowPlayerDialog(playeridDIALOG_BANK_ACCOUNTCREATEDIALOG_STYLE_MSGBOX"{FFFFFF}Confirmation""{FFFFFF}Are you sure you want to create an account?\nCreating an account costs $5000.""Confirm""Cancel");
                }
                else
                {
                    
SendClientMessage(playerid, -1"You already have an account!");
                }
            }
            case 
1:
            {
                
            }
        }
            return 
1;
    }
        if(
dialogid == DIALOG_BANK_ACCOUNTCREATE)
    {
        if(
response)
        {
              
GivePlayerMoney(playerid, -5000);
              
dini_IntSet(file"HasBankAccount"1);
              
SendClientMessage(playeridCOLOR_GREEN"Congratulations, you've created a bank account!");
        }
        return 
1;
    }
        
}
    return 
1;

Basically everything works except that if you click on "confirm" in the second dialog it won't send you that message or do anything that in that block (check DIALOG_BANK_ACCOUNTCREATE.
Can you please post a fix and tell me what I did wrong?
Reply
#2

Do you have something like this?

Код:
new pname[MAX_PLAYER_NAME], path[200];
GetPlayerName(playerid, pname, sizeof(pname));
format(path, sizeof(path), "/file/%s.ini", pname);
Reply
#3

Quote:
Originally Posted by Miladinovic
Посмотреть сообщение
Do you have something like this?

Код:
new pname[MAX_PLAYER_NAME], path[200];
GetPlayerName(playerid, pname, sizeof(pname));
format(path, sizeof(path), "/file/%s.ini", pname);
yeah
Reply
#4

you do not need return 1; here but i don't understand, it won't do anything?

Код:
if(response) 
{ 
              GivePlayerMoney(playerid, -5000); 
              dini_IntSet(file, "HasBankAccount", 1); 
              SendClientMessage(playerid, COLOR_GREEN, "Congratulations, you've created a bank account!"); 
} 
return 1;
Reply
#5

Can you post full script?
Reply
#6

Quote:
Originally Posted by Miladinovic
Посмотреть сообщение
you do not need return 1; here but i don't understand, it won't do anything?

Код:
if(response) 
{ 
              GivePlayerMoney(playerid, -5000); 
              dini_IntSet(file, "HasBankAccount", 1); 
              SendClientMessage(playerid, COLOR_GREEN, "Congratulations, you've created a bank account!"); 
} 
return 1;
still nothing, it just doesnt do any of those functions

u asked if i have something like %s.ini, yes i do:
PHP код:
public OnPlayerConnect(playerid)
{
    
// We get their name and format the file name
    
new pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(filesizeof(file), "%s.ini"pName);
    if(!
dini_Exists(file)){ // account doesn't exist
    
GivePlayerMoney(playerid10000);
    
pAdmin[playerid] = 0;
    
dini_Create(file);
    
dini_IntSet(file"Money"GetPlayerMoney(playerid)) && dini_IntSet(file"Admin"pAdmin[playerid] = 0);
    }
    else
    {
    
GivePlayerMoney(playeriddini_Int(file"Money"));
    
pAdmin[playerid] = dini_Int(file"Admin");
    
dini_IntSet(file"Money"GetPlayerMoney(playerid));
    
dini_IntSet(file"Admin"pAdmin[playerid]);
    } 
Reply
#7

Can you place enum Info?
And you need this code in OnDialogResponse

new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(file, sizeof(file), "%s.ini", pName);
Reply
#8

Are you sure that you have anything else Save? Like Admin and Money?
Reply
#9

Quote:
Originally Posted by Miladinovic
Посмотреть сообщение
Are you sure that you have anything else Save? Like Admin and Money?
Yeah I got both of them too.
Reply
#10

can you place it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)