SA-MP Forums Archive
[Ajuda] Perguntas aleatorios - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Perguntas aleatorios (/showthread.php?tid=651192)



Perguntas aleatorios - FabioGTP - 15.03.2018

Gente no meu sistema de auto escola й possivel eu fazer um sistema de perguntas aleatorias inves de cair as mesmas questхes para todos os players cair tudo diferente mais as mesmas perguntas porйm em ordem aleatorio, o sistema й feito em dialog...


Re: Perguntas aleatorios - FerrariL - 15.03.2018

Use a funзгo Random : https://sampwiki.blast.hk/wiki/Random


Re: Perguntas aleatorios - [BOPE]Seu._.Madruga - 16.03.2018

Bola de Cristal STATE SERVICE OFF


Re: Perguntas aleatorios - FabioGTP - 19.03.2018

Quote:
Originally Posted by FerrariL
Посмотреть сообщение
como vou fazer isso com dialog?


Re: Perguntas aleatorios - FerrariL - 19.03.2018

Como vai ser a dialog,o usuario vai digitar nela ?


Re: Perguntas aleatorios - FerrariL - 19.03.2018

Vou quebrar seu galho,isso aqui й uma base... Nгo testei estou sem GTA nem com pawno para compilar,se der erro avise.
PHP код:
enum Perguntas
{
    
Nome[40],
    
Resposta[10]
};
new 
Quiz[][Perguntas] = 
{
    {
"Em que ano estamos ? ","2018"},
    {
"Minha idade й ?""1800"}
}
new 
Randomico,
    
Str[40];
CMD:quiz(playerid)
{
    
Randomico random(sizeof(Quiz));
    
    
format(Str,sizeof(Str),"Pergunta : %s ",Quiz[Randomico][Nome]);
    
ShowPlayerDialog(playeridID_DIALOGDIALOG_STYLE_INPUT"Perguntas",Str"Enviar","");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == ID_DIALOG)
    {
        if(
inputtext != Quiz[Randomico][Resposta])
        {
            
SendClientMessage(playerid,-1,"Vocк errou a pergunta");
        }else{
            
SendClientMessage(playerid,-1,"Acertou");
        }
    }
    return 
1;