[Ajuda] Maneiras de fazer isso?
#1

Fala meus jovens, estou aqui para pedir uma ajudinha. Bom, eu queria perguntar se alguйm tem algum link de um Tutorial explicando como criaria Dialogs com o botгo "Prуximo" e nгo precisar criar outros dialogs, ou seja, usando Loops.

Na verdade, eu sei fazer isso, mas queria saber outra maneira, sempre procuro otimizar meus scripts e ver novas formas de se fazer aзхes, e com isso, "escolher" a certa ou mais prбtica.

Veja o mйtodo que usei, usando Loops e adicionando itens a partir de "enum":

PHP код:
#include <a_samp>
#include <zcmd>
#define FILTERSCRIPT
enum _PropIntInfo
{
    
pIntName[80],
    
pID_Int,
    
Float:pPositions[4]
}
new 
IntMaxValue[MAX_PLAYERS][3];
new const 
_GetIntProps[][_PropIntInfo] = {
    {{
"24/7 1"}, {17}, {-25.63,-187.06,1003.54,0.97}},
    {{
"24/7 2"}, {10}, {5.92,-30.63,1003.54,357.19}},
    {{
"24/7 3"}, {18}, {-30.86,-90.48,1003.54,357.81}},
    {{
"24/7 4"}, {16}, {-25.89,-139.36,1003.54,2.99}},
    {{
"24/7 5"}, {4}, {-27.31,-29.27,1003.55,2.99}},
    {{
"24/7 6"}, {6}, {-27.30,-56.22,1003.54,359.52}},
    {{
"Shamal (Nave)"}, {1}, {1.44,23.43,1199.59,354.32}},
    {{
"Andromada (Aviгo)"}, {9}, {315.66,986.72,1958.51,357.79}},
    {{
"Loja de Armas - 1"}, {1}, {285.95,-40.73,1001.51,296.66}},
    {{
"Loja de Armas - 2"}, {4}, {285.57,-85.25,1001.51,359.96}},
    {{
"Loja de Armas - 3"}, {6}, {296.70,-111.21,1001.51,2.80}},
    {{
"Loja de Armas - 4"}, {7}, {315.60,-142.50,999.60,4.34}},
    {{
"Loja de Armas - 5"}, {6}, {316.52,-167.70,999.59,4.34}},
    {{
"Loja de Armas - Cabines"}, {7}, {303.55,-142.13,1004.06,88.01}},
    {{
"Loja de Armas - Pista"}, {7}, {298.50,-141.64,1004.05,88.01}},
    {{
"Sala de orзamento do motel"}, {12}, {446.56,507.34,1001.41,355.81}},
    {{
"Motel Jefferson"}, {15}, {2215.57,-1150.24,1025.79,264.95}},
    {{
"Loja de Apostas - Loteria"}, {3}, {833.48,7.50,1004.17,87.77}},
    {{
"Sex Shop"}, {3}, {-99.98,-24.04,1000.71,3.31}},
    {{
"Fбbrica de Carne"}, {1}, {964.39,2108.34,1011.03,90.08}},
    {{
"Loja do Zero"}, {6}, {-2239.44,137.10,1035.41,269.43}},
    {{
"Porгo de Caligula"}, {1}, {2170.55,1618.65,999.97,271.16}},
    {{
"Escritуrio do Woozie"}, {1}, {-2158.66,641.91,1052.37,179.38}},
    {{
"Binco (Loja de Roupas)"}, {15}, {207.73,-110.57,1005.13,3.60}},
    {{
"Didier Sachs (Loja de Roupas)"}, {14}, {204.33,-166.69,1000.52,3.60}},
    {{
"Prolaps (Loja de Roupas)"}, {3}, {207.05,-138.80,1003.50,3.60}},
    {{
"Suburban (Loja de Roupas)"}, {1}, {203.77,-48.49,1001.80,1.50}},
    {{
"Victim (Loja de Roupas)"}, {5}, {226.49,-7.99,1002.21,84.39}},
    {{
"Zip (Loja de Roupas)"}, {18}, {161.52,-95.08,1001.80,357.62}},
    {{
"Alhambra"}, {17}, {493.39,-22.72,1000.67,357.62}},
    {{
"Bar"}, {11}, {501.98,-69.15,998.75,187.02}},
    {{
"Bar Lil' pobre"}, {18}, {-228.54,1401.24,27.76,272.87}},
    {{
"Lanchonete do Jay"}, {4}, {458.89,-88.63,999.55,90.99}},
    {{
"Mundo de Coq"}, {1}, {446.50,-6.78,1000.73,173.52}},
    {{
"Burger shot"}, {10}, {363.79,-74.42,1001.50,314.96}},
    {{
"Clucki'n Bell"}, {9}, {365.07,-10.41,1001.85,356.17}},
    {{
"Well Stacked Pizza"}, {5}, {372.35,-132.67,1001.49,4.15}},
    {{
"Rusty Browns Rosquinhas"}, {17}, {377.13,-192.59,1000.63,0.08}},
    {{
"Quarto da Denise"}, {1}, {244.26,304.89,999.14,271.09}},
    {{
"Quarto da Katie"}, {2}, {267.77,305.10,999.14,264.03}},
    {{
"Quarto da Helena"}, {3}, {292.17,309.97,999.14,93.12}},
    {{
"Quarto da Michelle"}, {4}, {302.55,301.86,999.14,2.44}},
    {{
"Quarto da Barbara"}, {5}, {322.16,302.79,999.14,5.41}},
    {{
"Quarto da Millie"}, {6}, {344.85,305.12,999.14,272.39}},
    {{
"Represa Sherman"}, {17}, {-959.53,1952.08,9.00,179.16}},
    {{
"Prefeitura LS"}, {3}, {388.89,173.70,1008.38,92.83}},
    {{
"Area 51"}, {0}, {223.01,1872.59,13.73,267.50}},
    {{
"Academia LS"}, {5}, {772.40,-4.40,1000.72,1.96}},
    {{
"Academia SF"}, {6}, {774.21,-48.92,1000.58,1.96}},
    {{
"Academia LV"}, {7}, {773.95,-76.71,1000.65,358.51}},
    {{
"Casa do CJ"}, {3}, {2496.21,-1693.39,1014.74,179.43}},
    {{
"Mansгo do Madd Dogg"}, {5}, {1263.19,-785.38,1091.90,272.80}},
    {{
"Casa do Ryder"}, {2}, {2455.36,-1705.34,1013.50,24.01}},
    {{
"Casa do Sweet"}, {1}, {2525.97,-1679.54,1015.49,270.27}},
    {{
"Fбbrica de Crack"}, {2}, {2543.44,-1304.13,1025.07,179.74}}
};
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 666)
    {
        if(
response)
        {
            new 
Xup IntMaxValue[playerid][0]+listitem;
            switch(
listitem)
            {
                case 
.. 9:
                {
                    
SetPlayerInterior(playerid_GetIntProps[Xup][pID_Int]);
                    
SetPlayerPos(playerid_GetIntProps[Xup][pPositions][0], _GetIntProps[Xup][pPositions][1], _GetIntProps[Xup][pPositions][2]);
                    
SetPlayerFacingAngle(playerid,  _GetIntProps[Xup][pPositions][3]);
                    
SendClientMessage(playerid, -1_GetIntProps[Xup][pIntName]);
                }
                case 
10:
                {
                    
IntMaxValue[playerid][2]++; //Next
                    
CallViewListInts(playerid);
                }
            }
        }
        else 
//Cancelar ou Voltar
        
{
            if(
IntMaxValue[playerid][2] > 0//Se o jogador estiver na pбgina 1 ou mais...
             
{
                 
IntMaxValue[playerid][2]--; //Back
                
CallViewListInts(playerid);
            }
        }
        return 
1;
    }
    return 
0;
}
stock CallViewListInts(playerid)
{
    
/*
    IntMaxValue[playerid][0] - Seria o MIN do Loop
    IntMaxValue[playerid][1] - Seria o MAX do Loop
    IntMaxValue[playerid][2] - Nъmero da Pбgina que o jogador estб
    */
    
IntMaxValue[playerid][0] = IntMaxValue[playerid][2]*10//Aqui multiplica o MIN do Loop pelo nъmero da pбgina, se por acaso eu estiver na pбgina 2, entгo: 2*10=20
    
IntMaxValue[playerid][1] = IntMaxValue[playerid][2]*10+10//Aqui multiplica o MAX do Loop pelo nъmero da pбgina e adiciona +10, se por acaso eu estiver na pбgina 2, entгo: 20*10=20+10=30
    
    
if(IntMaxValue[playerid][1] >= sizeof(_GetIntProps)) IntMaxValue[playerid][1] = sizeof(_GetIntProps);
    new 
StringDialog[400], Strizs[128];
    for(new 
IntMaxValue[playerid][0]; IntMaxValue[playerid][1]; ++i)
    {
        
format(Strizssizeof(Strizs), "%s\n"_GetIntProps[i][pIntName]);
        
strcat(StringDialogStrizs);
    }
    
    if(!(
IntMaxValue[playerid][1] >= sizeof(_GetIntProps))) strcat(StringDialog"{FF0080}Prуximo >>");
     if(
IntMaxValue[playerid][2] <= 0ShowPlayerDialog(playerid666DIALOG_STYLE_LIST"Lista de Interiores"StringDialog"Escolher""Cancelar");
    else 
ShowPlayerDialog(playerid666DIALOG_STYLE_LIST"Lista de Interiores"StringDialog"Escolher""Voltar");
    return 
1;
}
CMD:ints(playerid)
{
    
IntMaxValue[playerid][2] = 0;
    
CallViewListInts(playerid);
    return 
1;

Obrigado desde jб.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)