SA-MP Forums Archive
Why is this dialog spacing this much? - 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: Why is this dialog spacing this much? (/showthread.php?tid=442052)



Why is this dialog spacing this much? - SomebodyAndMe - 05.06.2013

Alright so I've made a script that should display a dialog if the house is for sale to either choose to enter the house, or to purchase it.
Now when I press enter while being in range in that area, it starts spacing.

Here is a video describing the problem better, and you see the 'spacing':

[ame]http://www.youtube.com/watch?v=d71mNgXDNKc[/ame]


Now this is the code:
pawn Код:
if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
    {
        if(PInfo[playerid][InHouseID] > 0)
        {
            new intid = HInfo[PInfo[playerid][InHouseID]][Interior];
            new hid = PInfo[playerid][InHouseID];
            if(IsPlayerInRangeOfPoint(playerid, 3, Interiors[intid][IntX], Interiors[intid][IntY], Interiors[intid][IntZ]))
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerVirtualWorld(playerid, 0);
                SetPlayerPos(playerid, HInfo[hid][eX], HInfo[hid][eY], HInfo[hid][eZ]);
                PInfo[playerid][InHouseID] = 0;
                return 1;
            }
        }
        for(new i = 0; i < sizeof(HInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 1.5, HInfo[i][eX],HInfo[i][eY],HInfo[i][eZ]))
            {
                if(HInfo[i][ForSale] == 1)
                {
                    new string[70];
                    format(string, sizeof(string), "Currently visiting %s's house", HInfo[i][OwnedBy]);
                    ShowPlayerDialog(playerid, DIALOG_FORSALEHOUSE1, DIALOG_STYLE_LIST, string, "Enter House\nPurchase House", "Ok", "Cancel");
                    return 1;
                }
                else
                if(!strcmp(HInfo[i][OwnedBy],"None"))
                {
                    new string[70];
                    format(string, sizeof(string), "Currently visiting %s's house", HInfo[i][OwnedBy]);
                    ShowPlayerDialog(playerid, DIALOG_FORSALEHOUSE1, DIALOG_STYLE_LIST, string, "Enter House\nPurchase House", "Ok", "Cancel");
                    PInfo[playerid][LastDialogHouse] = i;
                    return 1;
                }
            }
        }
    }
What is wrong with the code spacing that dialog so much


Re: Why is this dialog spacing this much? - Richie© - 05.06.2013

What under dialogresponse on dialogid: DIALOG_FORSALEHOUSE1 ?


Re: Why is this dialog spacing this much? - SomebodyAndMe - 05.06.2013

Nothing yet:

pawn Код:
case DIALOG_FORSALEHOUSE1:
        {
            if(!response)
            {
               
            }
            else
            {

            }
        }



Re: Why is this dialog spacing this much? - Richie© - 05.06.2013

Did you try only
pawn Код:
if(newkeys & KEY_SECONDARY_ATTACK)



Re: Why is this dialog spacing this much? - thefatshizms - 05.06.2013

If I understand, when entering the checkpoint, the dialog continues to pop up (when you click enter) ?

If I'm correct, this is because it's inside the loop.


Re: Why is this dialog spacing this much? - SomebodyAndMe - 05.06.2013

No, you have to press either enter or F to let it pop up.

When I press enter (in the checkpoint) it should give me the dialog, but instead when I press it it shows, and when I release it, it's gone.

Quote:
Originally Posted by Richie©
Посмотреть сообщение
Did you try only
pawn Код:
if(newkeys & KEY_SECONDARY_ATTACK)
I did.


Re: Why is this dialog spacing this much? - SomebodyAndMe - 06.06.2013

Not fixed yet.
Anyone who could help me with this?


Re: Why is this dialog spacing this much? - SimpalK - 06.06.2013

Put this near defines
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))



Re: Why is this dialog spacing this much? - SomebodyAndMe - 06.06.2013

Quote:
Originally Posted by SimpalK
Посмотреть сообщение
Put this near defines
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
That won't matter.

It's that ENTER is doing weird shit. and F is working fine, although it has the same key binding.