Jump to content
  • 0

pomoc [ HELP ]Dialog


TheRohlikar

Dotaz

Zdravím,

fakt nechápu v čem je problém :(

Mám vytvořený dialogy :

 

( Dialog 1 - Nastaví proměnou )

 

 

dcmd_stop(playerid,params[])

{

#pragma unused params

if(flashveh[playerid] == 1 || (flashnick[playerid] == 1))

{

ShowPlayerDialog(playerid,5,DIALOG_STYLE_LIST,"[ VIP ]Flashes","Zrušit Aut. Color Vehicle\nZrušit Aut. Color Nick","Vybrat","Zrušit");

}

return 1;

}

 

 

( Dialog 2 - Nastaví Barvu Nicku )

 

 

dcmd_vbarnick(playerid,params[])

{

#pragma unused params

if(vip[playerid] == 0) return SCM(playerid,0xFFFFFFFF,"{FF0000}[ VIP - ERROR ]{00FF00}Nejste VIP uživatel!");

ShowPlayerDialog(playerid,6,DIALOG_STYLE_LIST,"[ VIP ]-Barva Nicku","Bílá\nŽlutá\nZlatá\nOranžová\nRůžová\nČervená\nFialová\nSvětle Modrá\nTmavě Modrá\nSvětle Zelená\nTmavě Zelená\nHnědá\nStříbrná\nŠedá\nČerná","Vybrat","Zrušit");

return 1;

}

 

 

OnDialogResponse:

 

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

if(dialogid == 5)

{

if(response == 1)

{

if(listitem == 0)

{

flashveh[playerid] = 0;

}

else if(listitem == 1)

{

flashnick[playerid] = 0;

}

}

return 1;

}

if(dialogid == 6)

{

if(response == 1)

{

if(listitem == 0)

{

SetPlayerColor(playerid,Bila);

}

else if(listitem == 1)

{

SetPlayerColor(playerid,Zluta);

}

else if(listitem == 2)

{

SetPlayerColor(playerid, Zlata);

}

else if(listitem == 3)

{

SetPlayerColor(playerid, Oranzova);

}

else if(listitem == 4)

{

SetPlayerColor(playerid, Ruzova);

}

else if(listitem == 5)

{

SetPlayerColor(playerid, Cervena);

}

else if(listitem == 6)

{

SetPlayerColor(playerid, Fialova);

}

else if(listitem == 7)

{

SetPlayerColor(playerid, Svetle_Modra);

}

else if(listitem == 8)

{

SetPlayerColor(playerid, Modra);

}

else if(listitem == 9)

{

SetPlayerColor(playerid, Svetle_Zelena);

}

else if(listitem == 10)

{

SetPlayerColor(playerid, DarkGreen);

}

else if(listitem == 11)

{

SetPlayerColor(playerid, Hneda);

}

else if(listitem == 12)

{

SetPlayerColor(playerid, Stribrna);

}

else if(listitem == 13)

{

SetPlayerColor(playerid, Cerna);

}

}

return 1;

}

return 0;

}

 

 

Žádný Dialog neudělá to co má :(

Link to comment
Share on other sites

8 odpovědí na tuto otázku

Recommended Posts

  • 0
  • Majitel

Za prvé: Callbacku OnDialogResponse je úplně jedno co dostane za return, nezpracuje je..

Za druhé: Používání statementů if...else if, je extrémně pomalý, může dosahovat i několika sekund..

 

Takže bych to předělal pokud možno na switche a trochu zohlednil, protože v takový prasárně aby se jen prase vyznalo..

Link to comment
Share on other sites

  • 0

Má to byť takto

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 5)
{
if(response == 1)
{
if(listitem == 0)
{
flashveh[playerid] = 0;
}
else if(listitem == 1)
{
flashnick[playerid] = 0;
}
}
}


if(dialogid == 6)
{
if(response == 1)
{
if(listitem == 0)
{
SetPlayerColor(playerid,Bila);
}
else if(listitem == 1)
{
SetPlayerColor(playerid,Zluta);
}
else if(listitem == 2)
{
SetPlayerColor(playerid, Zlata);
}
else if(listitem == 3)
{
SetPlayerColor(playerid, Oranzova);
}
else if(listitem == 4)
{
SetPlayerColor(playerid, Ruzova);
}
else if(listitem == 5)
{
SetPlayerColor(playerid, Cervena);
}
else if(listitem == 6)
{
SetPlayerColor(playerid, Fialova);
}
else if(listitem == 7)
{
SetPlayerColor(playerid, Svetle_Modra);
}
else if(listitem == 8)
{
SetPlayerColor(playerid, Modra);
}
else if(listitem == 9)
{
SetPlayerColor(playerid, Svetle_Zelena);
}
else if(listitem == 10)
{
SetPlayerColor(playerid, DarkGreen);
}
else if(listitem == 11)
{
SetPlayerColor(playerid, Hneda);
}
else if(listitem == 12)
{
SetPlayerColor(playerid, Stribrna);
}
else if(listitem == 13)
{
SetPlayerColor(playerid, Cerna);
}
}
}
return 1;
}

 

GL :)

Link to comment
Share on other sites

  • 0
Za prvé: Callbacku OnDialogResponse je úplně jedno co dostane za return, nezpracuje je..

Za druhé: Používání statementů if...else if, je extrémně pomalý, může dosahovat i několika sekund..

 

Takže bych to předělal pokud možno na switche a trochu zohlednil, protože v takový prasárně aby se jen prase vyznalo..

 

Já to právěže přes switche umím a ikde tu TuT není ne ? Pokud ano, daj mi ho :d

Link to comment
Share on other sites

  • 0

Nechci sýčkovat ale není problém i tady:

 

if(flashveh[playerid] == 1 || (flashnick[playerid] == 1))

 

if(flashveh[playerid] == 1 || flashnick[playerid] == 1)

 

Ačkoli asi budou běhat obě verze.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...