Dialog help.Not working when click an option.
#1

PHP код:
//line 1
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
#else
main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}
#endif
public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/buyaccessories"cmdtexttrue10) == 0)
    {
          
ShowPlayerDialog(playerid,3300,DIALOG_STYLE_LIST,"What is that you want","Motorcycle Helmet green($50)\nMotorcycle Helmet black($50)\nMotorcycle Helmet blue($50)\nMotorcycle Helmet purple($50)\nTopHat green($50)\nTopHat black($50)\nTopHat purple($50)\nTopHat yellow($50)","Purchase","Cancel");
        return 
1;
    }
  if(!
strcmp(cmdtext"/editattachedobject"true))
    {
        
EditAttachedObject(playerid0); // second parameter (0) is the slot we used in SetPlayerAttachedObject
        // so if you have used SetPlayerAttachedObject like this SetPlayerAttachedObject(playerid, 1, 1337, 2);
        // then your EditAttachedObject function should be like this EditAttachedObject(playerid, 1); to edit the attached object in the slot 1
        
SendClientMessage(playerid0xFFFFFFFF"SERVER: You now edit your attached object on index slot 0!");
        return 
1;
    }
       if(!
strcmp(cmdtext"/removeattachedobject"true))
    {
        
RemovePlayerAttachedObject(playerid,0);
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 3300)//our dialog!
    
{
        if(
response)// They pressed the first button.
        
{
            switch(
listitem)
            {
                 case 
0:// The first item listed
                
{
                       if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                       
GivePlayerMoney(playerid, -50);
                       
SetPlayerAttachedObject(playerid0189762);
                }
                case 
1// The second item listed
                
{
                    if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -50);
                    
SetPlayerAttachedObject(playerid0189762);
                }
                case 
2// The third item listed
                
{
                    if(
GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -3);
                    
SetPlayerAttachedObject(playerid0189762);
                }
                   case 
3// The forth item listed
                
{
                    if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -50);
                   
SetPlayerAttachedObject(playerid0189762);
                }
                   case 
4// The forth item listed
                
{
                    if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -50);SetPlayerAttachedObject(playerid31897620.101, -0.00.02.090.6083.71.051.210xF500ED);
                    
SetPlayerAttachedObject(playerid0194672);
                }
                   case 
5// The forth item listed
                
{
                    if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -50);
                    
SetPlayerAttachedObject(playerid0194872);
                }
                case 
6// The forth item listed
                
{
                    if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -50);
                    
SetPlayerAttachedObject(playerid0194872);
                }
                case 
7// The forth item listed
                
{
                    if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -50);
                    
SetPlayerAttachedObject(playerid0194872);
                }
            }
          }
    }
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
//line 143 
Hello,
I wanted to ask that why this dialog does not work?The thing is that the dialog opens but when I click on a option,it does not respond and nothing happens.Please help.
Here are the warnings,please look into them I think these are causing problem.Or you may need them.
PHP код:
C:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\helmet.pwn(61) : warning 217loose indentation
C
:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\helmet.pwn(69) : warning 217loose indentation
C
:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\helmet.pwn(107) : warning 217loose indentation
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
3 Warnings

ThAnKs!
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 3300)//our dialog!
    {
        if(response == 1)// They pressed the first button.
        {
            switch(listitem)
            {
                case 0:// The first item listed
                {
                       if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                       GivePlayerMoney(playerid, -50);
                       SetPlayerAttachedObject(playerid, 0, 18976, 2);
                }
                case 1: // The second item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 0, 18976, 2);
                }
                case 2: // The third item listed
                {
                    if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -3);
                    SetPlayerAttachedObject(playerid, 0, 18976, 2);
                }
                case 3: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 0, 18976, 2);
                }
                case 4: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
                    SetPlayerAttachedObject(playerid, 0, 19467, 2);
                }
                case 5: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 0, 19487, 2);
                }
                case 6: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 0, 19487, 2);
                }
                case 7: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 0, 19487, 2);
                }
            }
            return 1;
        }
        if(response == 0)
        {
            ShowPlayerDialog(playerid,-1,-1,"","","","");
            return 1;
        }
    }
    return 1;
}
At the top of your script, put #pragma tabsize 0

This should work for you.
Reply
#3

Untested. Hope this should work I added the else statement here:
pawn Код:
//line 1
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}


public OnFilterScriptExit()
{
    return 1;
}


#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}
#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}


public OnGameModeExit()
{
    return 1;
}


public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buyaccessories", cmdtext, true, 10) == 0) {
        ShowPlayerDialog(playerid,3300,DIALOG_STYLE_LIST,"What is that you want","Motorcycle Helmet green($50)\nMotorcycle Helmet black($50)\nMotorcycle Helmet blue($50)\nMotorcycle Helmet purple($50)\nTopHat green($50)\nTopHat black($50)\nTopHat purple($50)\nTopHat yellow($50)","Purchase","Cancel");
        return 1;
    }
    if(!strcmp(cmdtext, "/editattachedobject", true)) {
        EditAttachedObject(playerid, 0);          // second parameter (0) is the slot we used in SetPlayerAttachedObject
// so if you have used SetPlayerAttachedObject like this SetPlayerAttachedObject(playerid, 1, 1337, 2);
// then your EditAttachedObject function should be like this EditAttachedObject(playerid, 1); to edit the attached object in the slot 1
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You now edit your attached object on index slot 0!");
        return 1;
    }
    if(!strcmp(cmdtext, "/removeattachedobject", true)) {
        RemovePlayerAttachedObject(playerid,0);
        return 1;
    }
    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 3300) {                        //our dialog!
        if(response) {                            // They pressed the first button.
            switch(listitem) {
                case 0:                           // The first item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);
                        SetPlayerAttachedObject(playerid, 0, 18976, 2);
                    }
                }
                case 1:                           // The second item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);
                        SetPlayerAttachedObject(playerid, 0, 18976, 2);
                    }
                }
                case 2:                           // The third item listed
                {
                    if(GetPlayerMoney(playerid) < 3) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -3);
                        SetPlayerAttachedObject(playerid, 0, 18976, 2);
                    }
                }
                case 3:                           // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);
                        SetPlayerAttachedObject(playerid, 0, 18976, 2);
                    }
                }
                case 4:                           // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
                        SetPlayerAttachedObject(playerid, 0, 19467, 2);
                    }
                }
                case 5:                           // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);
                        SetPlayerAttachedObject(playerid, 0, 19487, 2);
                    }
                }
                case 6:                           // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);
                        SetPlayerAttachedObject(playerid, 0, 19487, 2);
                    }
                }
                case 7:                           // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) {
                        return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    }
                    else {
                        GivePlayerMoney(playerid, -50);
                        SetPlayerAttachedObject(playerid, 0, 19487, 2);
                    }
                }
            }
        }

    }
    return 1;
}


public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}


//line 143
Reply
#4

Thanks both +rep for both.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)