Dialog selection problem - what is wrong [REP ++ ]
#1

Hello guys. I am working on a command called /gps which should show me 2 types of categories: 1. 24/7 Stores and 2.Clothing Store.
If i press on 24/7 Stores are showed 2 businesses because 2 of 24/7 Store are stored in my db.
If i press on Clothing Stores are showed 2businesses because 2 of Clothing Store are stored in my db.
All working fine up here.
I tried to do the next: When you click the specific business to put a checkpoint on it. My next problem is that always the first business ( first listitem ) it puts the checkpoint to the first 24/7 Store ( business id 1 )
Per example if i am at the Clothing Stores there are showed 2 clothing stores. If i click the one it put's wrong checkpoint ( points at clothing store 1) if i click the 2 it's putting checkpoint correctly to the 2nd binco store.
Look at my script:
pawn Код:
new SelBusiness[MAX_PLAYERS];
pawn Код:
CMD:gps(playerid, params[])
{

    ShowPlayerDialog(playerid,113,DIALOG_STYLE_LIST,"Locations:","Driving School (DMV)\nLos Santos\nLas Venturas\nVehicle Mod Shops\nPaintball\nDealership","Select","Cancel");
    SelBusiness[playerid] = 0;
    return 1;
}
pawn Код:
if(dialogid == 113)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SCM(playerid, COLOR_TEAL,"Server has set you a checkpoint to Driving School!");
                    SetPlayerCheckpoint(playerid,1219.6129,-1814.2854,16.5938,4.0);
                }
                case 1:
                {
                    ShowPlayerDialog(playerid, 6543, DIALOG_STYLE_LIST, "Los Santos Locations", "24/7 Stores\nClothing Stores", "Checkpoint", "Cancel");
                }
            }
        }
    }
All working fine , distance calculating fine , the only problem is setting the checkpoint to the selected listitem.
pawn Код:
case 6543:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        new szString[980];
                        new szDialogString[128];
                        for(new xf = 0; xf < MAX_BUSINESSES; xf++)
                        {
                            if(businessVariables[xf][bType] == 69)
                            {
                                if(businessVariables[xf][bType] == 69)
                                {
                                    format(szDialogString, 128, "24/7 Store");
                                }
                                new Float: fDistance = GetPlayerDistanceFromPoint(playerid, businessVariables[xf][bExteriorPos][0], businessVariables[xf][bExteriorPos][1], businessVariables[xf][bExteriorPos][2]);
                                format(szString, sizeof(szString), "%s\n%s (%.0fm away)", szString,szDialogString, fDistance);
                            }
                        }
                        ShowPlayerDialog(playerid, 6542, DIALOG_STYLE_LIST, "24/7 Store", szString, "Checkpoint", "Cancel");
                    }
                    case 1:
                    {
                        new szString[980];
                        new szDialogString[128];
                        for(new xf = 0; xf < MAX_BUSINESSES; xf++)
                        {
                            if(businessVariables[xf][bType] == 34)
                            {
                                if(businessVariables[xf][bType] == 34)
                                {
                                    format(szDialogString, 128, "Clothing Store");
                                }
                                new Float: fDistance = GetPlayerDistanceFromPoint(playerid, businessVariables[xf][bExteriorPos][0], businessVariables[xf][bExteriorPos][1], businessVariables[xf][bExteriorPos][2]);
                                format(szString, sizeof(szString), "%s\n%s (%.0fm away)", szString,szDialogString, fDistance);
                            }
                        }
                        ShowPlayerDialog(playerid, 6542, DIALOG_STYLE_LIST, "Clothing Store", szString, "Checkpoint", "Cancel");
                    }
                }
            }
        }
And the important part of setting up the checkpoint! :
pawn Код:
case 6542:
        {
            if(response)
            {
                        new item = listitem +1;
                        SelBusiness[playerid] = item;
                        new Float: Position[3];
                        GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
                        SetPlayerCheckpoint(playerid, businessVariables[SelBusiness[playerid]][bExteriorPos][0], businessVariables[SelBusiness[playerid]][bExteriorPos][1], businessVariables[SelBusiness[playerid]][bExteriorPos][2], 1.0);
                }
            }
        }
What could be wrong ? i tried many different things ..
Thanks for helping me ! I give rep who resolvs the problem.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)