It shows again... [Dialog]
#1

Hello!

I got another issue, when i pick up a pickup that shows me a dialog, it does show me the dialog correctly but when the function OnDialogresponse is trying to work, the 1st dialog comes again, so the 2nd dialog doesn't show (It just shows like 2 seconds, then the 1st dialog comes again)

PHP код:
        if(pickupid == ATM1)
        {
            
ShowPlayerDialog(playeridATMDIALOG_STYLE_LIST,"ATM","Deposit\nWithdraw\nCurrent Balance\n{FF0000}Attempt Robbery{FF0000}","Ok","Close");
        } 
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{    if(
dialogid == ATM)
      {
        if(
response)
        {
        if(
listitem == 0//Deposit
        
{
        
ShowPlayerDialog(playeridDepositDIALOG_STYLE_INPUT,"ATM","Enter the amount of cash you want to deposit","Deposit","Cancel");
        }
        if(
listitem == 1//Withdraw
        
{
        
ShowPlayerDialog(playeridWithdrawDIALOG_STYLE_INPUT,"ATM","Enter the amount of cash you want to withdraw ","Withdraw","Cansel");
        }
        if(
listitem == 2//Balance
        
{
        
ShowPlayerDialog(playeridBalanceDIALOG_STYLE_MSGBOX,"ATM","Your cash : ...","Ok","Close");
        }
        if(
listitem == 3//Attemp roberry
        
{
        
SendClientMessage(playerid,COLOR_GREEN,"This Feature is currently dissabled");
        }
       }
      } 
Thanks in advance
Reply
#2

Would I would do is create a timer sufficient to complete the dialogs but if they exit the dialog it creates a 5 second timer and kills the other so the player can leave the given area.
Reply
#3

Is your DIALOGs defined.. properly?
Reply
#4

can you show me how did you create your pickup?
Reply
#5

Why Not Just create a timer for a callback to detect if player in that area of ur pickup but no pick there but put a detect if(playerinpointrangeofpoint etc
And use a KillTimer For that timer and When player Hits either responses that closes or ends the dialogs Restart the timer to repeat.. Simple might be tomuch timers. maybe no clue but thats what came to my mind..

pawn Код:
new CheckplayerTimer;
forward CheckLocation(playerid);

public OnGameModeInit()
{
       CheckPlayerTimer = SetTimer("CheckLocation"2000);
       return 1;
}

public CheckLocation(playerid)
{
      if(IsPlayerInRangeOfPoint(playerid, 5.0,X,Y,Z)) // Checking if Player Near This Cordinates
      {
             ShowPlayerDialog(playerid, ATM, DIALOG_STYLE_LIST,"ATM","Deposit\nWithdraw\nCurrent Balance\n{FF0000}Attempt Robbery{FF0000}","Ok","Close");
             KillTimer(CheckPlayerLocation);
       }
       return 1;
}
Now For The Dialogs

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{    if(dialogid == ATM)
      {
        if(response)
        {
        if(listitem == 0) //Deposit
        {
        ShowPlayerDialog(playerid, Deposit, DIALOG_STYLE_INPUT,"ATM","Enter the amount of cash you want to deposit","Deposit","Cancel");
        }
        if(listitem == 1) //Withdraw
        {
        ShowPlayerDialog(playerid, Withdraw, DIALOG_STYLE_INPUT,"ATM","Enter the amount of cash you want to withdraw ","Withdraw","Cansel");
        }
        if(listitem == 2) //Balance
        {
        ShowPlayerDialog(playerid, Balance, DIALOG_STYLE_MSGBOX,"ATM","Your cash : ...","Ok","Close");
        }
        if(listitem == 3) //Attemp roberry
        {
        SendClientMessage(playerid,COLOR_GREEN,"This Feature is currently dissabled");
        }
       }
      CheckPlayerTimer = SetTimer("CheckingLocation",5000,true); // If the player clicks Close For this dialog add then in to the others after deposit or when player Clicks Close
      }
If Need any Further Help Pm Me or Message In your Thread.. Hope it helps
Reply
#6

Milito, you're dumb, my friend.

I've faced this problem before, you should make a bool or a normal variable. Here's an example.

pawn Код:
new BankPicked[MAX_PLAYERS char]; // This is my own variable in my script, you can change it into anything you want.

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == BankT11 || pickupid == BankT12 || pickupid == BankT13) // Bank financial transaction pickups
    {
        if(BankPicked[playerid] == 0)
        {
            ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "blablabla","blablabla","Select","Cancel");
            BankPicked[playerid] =1;
        }
        return 1;
    }
    return 1;
}
So it's like in OnDialogResponse callback, if a player cancels the first dialog, you need to set the variable to 0. Same goes to after the player has used the second dialog (or another dialog). If you still don't understand, PM me. I hope you do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)