SA-MP Forums Archive
Dialog doesn't respond. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog doesn't respond. (/showthread.php?tid=645882)



Dialog doesn't respond. - MarkNelson - 06.12.2017

Hello everyone. Well, i have a problem with my latest server update and i can't fix it.. i've tried billion times to fix it but i've failed..
I'm trying to make a perk system but with dialogs.
the problem is, the dialog doesn't respond after selecting an item from it.
everything is fine in the script no IDs conflicting and there are no lost identations
In addition to that, i defined the dialog and i changed return 1; to return 0; but the same shit is happening.. nothing works.
Could you help me please?
the code is fine but there is a problem idk what is it cuz the compiler doesn't show me any error or warning
and i'm not using any filterscript which uses dialogs too.
Sorry for my bad english...


Re: Dialog doesn't respond. (Help please..) - AlexMSK - 06.12.2017

Post the code


Re: Dialog doesn't respond. (Help please..) - MarkNelson - 06.12.2017

Код HTML:
if(response)
                {
                    switch(dialogid == 1101)
                    {
                        case 1:
                        {
                            switch(listitem)
                            {
                                
                                case 0:
                                {
                                    
                                    if(undead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 Undead Perk..");
                                    if(GetPlayerMoney(playerid) < 25000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
                                    GivePlayerMoney(playerid, -25000);
                                    SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $25.000, to use it type /undead");
                                    undead[playerid] = 1;
                                    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                                    
                                }
                                case 1:
                                {
                                    if(explose[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 One Shoot Explose Perk..");
                                    if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
                                    GivePlayerMoney(playerid, -50000);
                                    SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $50.000, to use it type /oe");
                                    explose[playerid] = 1;
                                    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                                    
                                }
                                case 2:
                                {
                                    if(shoot[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 One Shoot Kill Perk..");
                                    if(GetPlayerMoney(playerid) < 70000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
                                    GivePlayerMoney(playerid, -70000);
                                    SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $70.000, to use it type /ok");
                                    shoot[playerid] = 1;
                                    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                                    
                                }
                                case 3:
                                {
                                    if(tank[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 Tank Perk..");
                                    if(GetPlayerMoney(playerid) < 350000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
                                    GivePlayerMoney(playerid, -350000);
                                    SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $350.000, to use it type /tank");
                                    tank[playerid] = 1;
                                    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                                    
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 0;
}
i've defined everything, this is the perk dialog. I've noticed that the other dialogs works well but the new one isn't working (Perks Dialog)


Re: Dialog doesn't respond. (Help please..) - AlexMSK - 06.12.2017

remove return 0 and post the ShowPlayerDialog on command or where ever you're using it


Re: Dialog doesn't respond. (Help please..) - MarkNelson - 06.12.2017

Код HTML:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
	if(pickupid == perks)
	{
       ShowPlayerDialog(playerid, 1101, DIALOG_STYLE_LIST, "Perks Counter", "Undead Perk ($25.000)\nOne Shoot Explose ($50.000)\nOne Shoot Kill ($70.000)\nTank Perk($350.000)", "Purchase", "Close");
	}
	return 1;
}



Re: Dialog doesn't respond. (Help please..) - AlexMSK - 06.12.2017

Alright that looks fine, just remove the return 0; and it'll work i guess.

PHP код:
                    if(dialogid == 1101)
                    {
                        switch(
listitem)
                        {
                            case 
0:
                            {
                                if(
undead[playerid] == 1) return SendClientMessage(playeridCOLOR_RED,"You can't buy more than 1 Undead Perk..");
                                if(
GetPlayerMoney(playerid) < 25000) return SendClientMessage(playeridCOLOR_RED"You don't have enough cash.");
                                
GivePlayerMoney(playerid, -25000);
                                
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $25.000, to use it type /undead");
                                
undead[playerid] = 1;
                                
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                            }
                            case 
1:
                            {
                                if(
explose[playerid] == 1) return SendClientMessage(playeridCOLOR_RED,"You can't buy more than 1 One Shoot Explose Perk..");
                                if(
GetPlayerMoney(playerid) < 50000) return SendClientMessage(playeridCOLOR_RED"You don't have enough cash.");
                                
GivePlayerMoney(playerid, -50000);
                                
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $50.000, to use it type /oe");
                                
explose[playerid] = 1;
                                
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                            }
                            case 
2:
                            {
                                if(
shoot[playerid] == 1) return SendClientMessage(playeridCOLOR_RED,"You can't buy more than 1 One Shoot Kill Perk..");
                                if(
GetPlayerMoney(playerid) < 70000) return SendClientMessage(playeridCOLOR_RED"You don't have enough cash.");
                                
GivePlayerMoney(playerid, -70000);
                                
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $70.000, to use it type /ok");
                                
shoot[playerid] = 1;
                                
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                            }
                            case 
3:
                            {
                                if(
tank[playerid] == 1) return SendClientMessage(playeridCOLOR_RED,"You can't buy more than 1 Tank Perk..");
                                if(
GetPlayerMoney(playerid) < 350000) return SendClientMessage(playeridCOLOR_RED"You don't have enough cash.");
                                
GivePlayerMoney(playerid, -350000);
                                
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $350.000, to use it type /tank");
                                
tank[playerid] = 1;
                                
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                            }
                        }
                    } 



Re: Dialog doesn't respond. (Help please..) - Kane - 06.12.2017

Don't use "if(response)" outside of a dialog. By that I mean:

PHP код:
public OnDialogResponse()
{
    if(
response)
    {
        if(
dialogid == DIALOG_ID)
        {
            return;
        }
    }
    return 
0;

Quote:

Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback.

Returning zero couldn't be the problem.


Re: Dialog doesn't respond. (Help please..) - AlexMSK - 06.12.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Don't use "if(response)" outside of a dialog. By that I mean:

PHP код:
public OnDialogResponse()
{
    if(
response)
    {
        if(
dialogid == DIALOG_ID)
        {
            return;
        }
    }
    return 
0;



Returning zero couldn't be the problem.
It can be the problem, you can try it out and see.


Re: Dialog doesn't respond. (Help please..) - Kane - 06.12.2017

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
It can be the problem, you can try it out and see.
How could it be the problem if he isn't using a filterscript?

https://sampwiki.blast.hk/wiki/OnDialogResponse

Read the return values for the callback.


Re: Dialog doesn't respond. (Help please..) - MarkNelson - 06.12.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
How could it be the problem if he isn't using a filterscript?

https://sampwiki.blast.hk/wiki/OnDialogResponse

Read the return values for the callback.
Well, i use cases and when i follow your steps it shows me 4 errors..