U3Games

SAMP | Desarrollo & Soporte => Desarrollo de Servidores => Filterscripts => Mensaje iniciado por: Swarlog en Ene 30, 2023, 11:15 PM

Título: Sistema de Examenes
Publicado por: Swarlog en Ene 30, 2023, 11:15 PM
● Información Adicional:

Se trata de sistema de variables de aciertos. Al usar el comando "/Profesor" te saldrán varios dialogs haciendo preguntas sobre script. Una vez terminado el examen el script comprobara la cantidad de aciertos y te dará tu nota.

● Código:

/*
        Sistema Profesor Pawn By Badyx
                                                        */

/*      Creditos:

        Badyx               Idea, Script y tester.

        Datos:

        Tiempo              30 minutos sin prisa.
        Bugs                No conocidos.

        Informacion adicional:

        Todo el sistema esta por dialog.

        Un único comando /Profesor.
        No deben de tener en uso los dialogs desde el 2000 al    2005.

        Imagenes:


       

*/
#include <a_samp>

new Acierto[MAX_PLAYERS];

#define Comenzar 5000
#define Pregunta2 5001
#define Pregunta3 5002
#define Pregunta4 5003
#define Pregunta5 5004
#define Pregunta6 5005

#if defined FILTERSCRIPT

#else

main(){}

#endif

public OnPlayerConnect(playerid)
{
    Acierto[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

    if (strcmp("/Profesor", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid,Comenzar, DIALOG_STYLE_LIST, "¿Cual de estas opciones seria correcta para definir una variable?", "NeW MiVaRiAbLe[MaX_PlAyErId]\nnew MiVariable[playerid]\nnew MiVariable[MAX_PLAYERS]", "Responder", "");
        return 1;
    }

   
    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == Comenzar)
    {
    if(response)
    {
    if(listitem == 0)
    {
        ShowPlayerDialog(playerid,Pregunta2, DIALOG_STYLE_LIST, "¿Como definirias una variable bool?", "new bool:MiVariable[MAX_PLAYERS];\nnew booludo:MiVariable[MAX_PLAYERS];\nnew MiVariable[MAX_PLAYERS]", "Responder", "");

    }
    if(listitem == 1)
    {
        ShowPlayerDialog(playerid,Pregunta2, DIALOG_STYLE_LIST, "¿Como definirias una variable bool?", "new bool:MiVariable[MAX_PLAYERS];\nnew booludo:MiVariable[MAX_PLAYERS];\nnew MiVariable[MAX_PLAYERS]", "Responder", "");
    }
    if(listitem == 2)
    {
        Acierto[playerid] += 1;
       
        ShowPlayerDialog(playerid,Pregunta2, DIALOG_STYLE_LIST, "¿Como definirias una variable bool?", "new bool:MiVariable[MAX_PLAYERS];\nnew booludo:MiVariable[MAX_PLAYERS];\nnew MiVariable[MAX_PLAYERS]", "Responder", "");
    }
    }
    return 1;
    }
   
    if(dialogid == Pregunta2)
    {
    if(response)
    {
    if(listitem == 0)
    {
        Acierto[playerid] += 1;
        ShowPlayerDialog(playerid,Pregunta3, DIALOG_STYLE_LIST, "¿Como sumarias la cantidad 5 a una variable bool?", "MiVariable[playerid] = 5;\nMiVariable[playerid] += 5;\nSeria imposible", "Responder", "");
    }
   
    if(listitem == 1)
    {
        ShowPlayerDialog(playerid,Pregunta3, DIALOG_STYLE_LIST, "¿Como sumarias la cantidad 5 a una variable bool?", "MiVariable[playerid] = 5;\nMiVariable[playerid] += 5;\nSeria imposible", "Responder", "");
    }
   
    if(listitem == 2)
    {
        ShowPlayerDialog(playerid,Pregunta3, DIALOG_STYLE_LIST, "¿Como sumarias la cantidad 5 a una variable bool?", "MiVariable[playerid] = 5;\nMiVariable[playerid] += 5;\nSeria imposible", "Responder", "");
    }
    }
    return 1;
    }
   
   
    if(dialogid == Pregunta3)
    {
    if(response)
    {
    if(listitem == 0)
    {
        ShowPlayerDialog(playerid,Pregunta4, DIALOG_STYLE_LIST, "¿Como sumarias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] = 5;\nMiVariable[playerid] += 5;\nMiVariable[playerid] += false =5;", "Responder", "");

    }
    if(listitem == 1)
    {
        ShowPlayerDialog(playerid,Pregunta4, DIALOG_STYLE_LIST, "¿Como sumarias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] = 5;\nMiVariable[playerid] += 5;\nMiVariable[playerid] += false =5;", "Responder", "");

    }
    if(listitem == 2)
    {
        Acierto[playerid] += 1;
       
        ShowPlayerDialog(playerid,Pregunta4, DIALOG_STYLE_LIST, "¿Como sumarias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] = 5;\nMiVariable[playerid] += 5;\nMiVariable[playerid] += false =5;", "Responder", "");
    }
    }
    return 1;
    }
   
    if(dialogid == Pregunta4)
    {
    if(response)
    {
    if(listitem == 0)
    {
        ShowPlayerDialog(playerid,Pregunta5, DIALOG_STYLE_LIST, "¿Como setearias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] = 5;\nMiVariable[playerid] == 5;\nMiVariable[playerid] -= 5;", "Responder", "");

    }
   
    if(listitem == 1)
    {
        Acierto[playerid] += 1;
       
        ShowPlayerDialog(playerid,Pregunta5, DIALOG_STYLE_LIST, "¿Como setearias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] = 5;\nMiVariable[playerid] == 5;\nMiVariable[playerid] -= 5;", "Responder", "");

    }

    if(listitem == 2)
    {
        ShowPlayerDialog(playerid,Pregunta5, DIALOG_STYLE_LIST, "¿Como setearias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] = 5;\nMiVariable[playerid] == 5;\nMiVariable[playerid] -= 5;", "Responder", "");

    }
    }
    return 1;
}


    if(dialogid == Pregunta5)
    {
    if(response)
    {
    if(listitem == 0)
    {
        Acierto[playerid] += 1;
        ShowPlayerDialog(playerid,Pregunta6, DIALOG_STYLE_LIST, "¿Como restarias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] += 5;\nMiVariable[playerid] == 5;\nMiVariable[playerid] -= 5;", "Responder", "");
    }

    if(listitem == 1)
    {
        ShowPlayerDialog(playerid,Pregunta6, DIALOG_STYLE_LIST, "¿Como restarias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] += 5;\nMiVariable[playerid] == 5;\nMiVariable[playerid] -= 5;", "Responder", "");
    }

    if(listitem == 2)
    {
        ShowPlayerDialog(playerid,Pregunta6, DIALOG_STYLE_LIST, "¿Como restarias la cantidad 5 a una variable tipo new MiVariable[MAX_PLAYERS];?", "MiVariable[playerid] += 5;\nMiVariable[playerid] == 5;\nMiVariable[playerid] -= 5;", "Responder", "");
    }
    }
    return 1;
}

    if(dialogid == Pregunta6)
    {
    if(response)
    {
    if(listitem == 0)
    {
        ComprobarNota(playerid);
    }

    if(listitem == 1)
    {
        ComprobarNota(playerid);
    }

    if(listitem == 2)
    {
        Acierto[playerid] += 1;
        ComprobarNota(playerid);
    }
    }
    return 1;
    }

    return 1;
}


forward ComprobarNota(playerid);
public ComprobarNota(playerid)
{
    new string[100];
    LimpiarChat(playerid,60);
    format(string, sizeof(string), "[Profesor] Tu nota es de %d", Acierto[playerid]);
    SendClientMessage(playerid, -1, string);
    switch(Acierto[playerid])
    {
    case 0:    SendClientMessage(playerid, -1, "[Profesor] Mejor pegate un tiro");
    case 1:    SendClientMessage(playerid, -1, "[Profesor] Solo una palabra. (Burro)");
    case 2: SendClientMessage(playerid, -1, "[Profesor] Eres malo hasta decir basta");
    case 3: SendClientMessage(playerid, -1, "[Profesor] ¿Realmente no te da verguenza?");
    case 4: SendClientMessage(playerid, -1, "[Profesor] Deberias replantearte si el script es lo tuyo");
    case 5: SendClientMessage(playerid, -1, "[Profesor] Enhorabuena, eres el puto amo del script");
    }
    Acierto[playerid] = 0;
    return 1;
}

forward LimpiarChat(playerid, Lineas);
public LimpiarChat(playerid, Lineas)
{
    if (IsPlayerConnected(playerid))
    {
        for(new i=0; i<Lineas; i++)
        {
            SendClientMessage(playerid, -1, " ");
        }
    }
    return 1;
}