Jump to content
  • 0

Problema reaction test


d@rK

Question

Daca scriu {FFFFFF} cand e reaction testul castig si imi da banii :|

Eu vreau sa mearga doar daca scrii acel text!

Pawno: (FS)

[pawn]

#include <a_samp>

#define COLOR_YELLOW 0xFFFF00AA

#define COLOR_BLUE 0x0000BBAA

#define ReactionGap 90000

#define green 0x33FF33AA

#define blue 0x00FFFFAA

new ReactionConsole;

new ReactionGenerator[9];

new ReactionProgress;

new ReactionWinnerid;

new ReactionTime;

new PlayerCash;

new bool: UsedText;

forward ReactionTest();

forward ReactionWin(playerid);

forward SetBack();

public OnFilterScriptInit()

{

        ReactionConsole = SetTimer("ReactionTest", ReactionGap, 1);

        return 1;

}

public OnFilterScriptExit()

{

    KillTimer(ReactionConsole);

        return 1;

}

public OnPlayerText(playerid, text[])

{

        if(!strcmp(text, ReactionGenerator, false))

        {

                if(ReactionProgress == 2) ReactionWin(playerid);

                if(ReactionProgress == 1)

                {

                        if(ReactionWinnerid == playerid)

                        {

                        SendClientMessage(playerid,COLOR_YELLOW,"Ai castigat deja Fast Eventul!");

                        }

                        else

                        {

                        SendClientMessage(playerid,COLOR_BLUE,"Prea incet!");

                        }

                }

                return 1;

        }

        return 1;

}

public ReactionTest()

{

        ReactionGenerator = "";

        KillTimer(ReactionTime);

        new str[256];

        new random_set[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

        for (new i = 0; i < 8; i++)

                {

  ReactionGenerator = random_set[random(sizeof(random_set))];

                }

        PlayerCash = (random(5000) + 5000);

        ReactionProgress = 2;

        format(str,sizeof(str),"Primul care scrie %s castiga $%d !",ReactionGenerator, PlayerCash);

        SendClientMessageToAll(COLOR_BLUE,str);

        KillTimer(ReactionConsole);

        UsedText = true;

        SetTimer("ReactionResult", 300000, 0);

}

public ReactionWin(playerid)

{

        CallRemoteFunction ( "GivePlayerCash", "ii", playerid, PlayerCash );

        SetTimer("SetBack",300,0);

        new reactionwinner[256];

        ReactionWinnerid = playerid;

        new tempstring[256];

        GetPlayerName(playerid,reactionwinner,sizeof(reactionwinner));

        format(tempstring,sizeof(tempstring),"{00CED1}%s {FF7F50}a castigat Eventul Rapiditatii si a primit {00CED1}$%d !",reactionwinner, PlayerCash);

        SendClientMessageToAll(green,tempstring);

        ReactionConsole = SetTimer("ReactionTest", ReactionGap, 1);

UsedText = false;

}

public SetBack()

{

        ReactionProgress = 1;

}

forward ReactionResult();

public ReactionResult()

{

switch(UsedText)

{

  case true:

            {

            new string[128];

            format(string, sizeof(string), "A expirat timpul.");

            SendClientMessageToAll(green, string);

          ReactionConsole = SetTimer("ReactionTest", ReactionGap, 1);

      }

}

return 1;

}

[/pawn]

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.