Jump to content
  • 0

Reaction


Deejaybwg

Question

Pe serverul meu am niste concursuri ("Cine scrie primul .... castiga ...$ si ....score).

Daca tin mult serverul deschis (1ora-2) incep si apar de foarte multe ori concursurile.. Se face un spam foarte mare si mereu trebuie sa dau restart la server ca sa se rezolve problema. Ce fac sa nu se mai faca spam-ul acesta si sa nu mai trebuiasca sa dau restart de fiecare data knd se intampla asta ?

www.youtube.com/thebwgg

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

/*

Release:

    » Reaction-Test Filterscript

Author:

        » » deejay.bwg «

Last Update:

        » 25/05/2010

ChangeLog:

        » v0.1a:

- Initial release

Bugs:

        » No bugs

Version:

» v0.1a

Functions:

» /

Credits:

        » /

*/

#include <a_samp>

#if !defined Loop

#define Loop(%0,%1) \

for(new %0 = 0; %0 != %1; %0++)

#endif

#if !defined function

#define function%0(%1) \

forward%0(%1); public%0(%1)

#endif

#if !defined PURPLE

#define PURPLE \

    0xBF60FFFF

#endif

#if !defined GREEN

#define GREEN \

    0x94D317FF

#endif

#if !defined TIME

#define TIME \

    100000

#endif

new

xCharacters[][] =

{

    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",

"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",

    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",

"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",

    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"

},

xChars[16] = "",

xReactionTimer,

xCash,

xScore,

bool: xTestBusy

;

public OnFilterScriptInit()

{

xReactionTimer = SetTimer("xReactionTest", TIME, 1);

return 1;

}

public OnFilterScriptExit()

{

KillTimer(xReactionTimer);

return 1;

}

public OnPlayerText(playerid, text[])

{

switch(xTestBusy)

{

    case true:

    {

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

{

    new

        string[128],

        pName[MAX_PLAYER_NAME]

;

GetPlayerName(playerid, pName, sizeof(pName));

format(string, sizeof(string), "{DCAB00}{01DBCA}[WIN]: {FFFFFF}%s  a scris primul  '{01DBCA}%s' {FFFFFF} si a castigat {01DBCA}%d$ + %d score.", pName, xChars, xCash, xScore);

    SendClientMessageToAll(GREEN, string);

    GivePlayerMoney(playerid, xCash);

SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);

xReactionTimer = SetTimer("xReactionTest", TIME, 1);

    xTestBusy = false;

}

}

}

return 1;

}

function xReactionProgress()

{

    switch(xTestBusy)

{

    case true:

    {

    new

        string[128]

;

format(string, sizeof(string), "{C0C0C0}{01DBCA}[sERVER]:{FFFFFF}Nimeni nu {FFFFFF}a castigat {01DBCA}%d$ + {01DBCA}%d score. »", xCash, xScore);

    SendClientMessageToAll(PURPLE, string);

        xReactionTimer = SetTimer("xReactionTest", TIME, 1);

        }

}

return 1;

}

function xReactionTest()

{

new

xLength = (random(8) + 2),

string[128]

;

xCash = (random(10000) + 20000);

xScore = (random(2)+4);

format(xChars, sizeof(xChars), "");

Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);

format(string, sizeof(string), "{C0C0C0}{01DBCA}[REAC]:{FFFFFF} Cine scrie primul'{01DBCA} {01DBCA}%s {FFFFFF}' castiga {01DBCA}%d$ + {01DBCA}%d score. »", xChars, xCash, xScore);

SendClientMessageToAll(PURPLE, string);

KillTimer(xReactionTimer);

xTestBusy = true;

SetTimer("xReactionProgress", 50000, 0);

return 1;

}

www.youtube.com/thebwgg

Link to comment
Share on other sites

Pai pe toate alea care le-am postat le folosesc :|

Ce nu întelegi? Si nu e greu deloc sa faci unul singur...

Faci asa:

ÃŽn primul rand definim un time:

#define time1 120000
1. Pui 3 forward-uri noi la începutul gamemodului (îl bagi în gm):
forward ReactionTest();
forward ReactionWin(playerid);
forward SetBack();
Apoi bagi niste variabile tot sus (dupa altele cu new):
new reactionstr[9]; //randomly generated string
new reactioninprog; //what status the reactiontest is at
new reactionwinnerid; //id of the current reactiontest winner
new reactiongap; //timer to restart ReactionTest()
new raddon[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
2. Pui asta de mai jos la OnGameModeInit:
SetTimer("ReactionTest", time1, 0);
3. Dupa public OnPlayerText(playerid, text[]) { pui astea:
    if (!strcmp(text, reactionstr, false))
    {
    if (reactioninprog == 2) ReactionWin(playerid);
    if (reactioninprog == 1)
    {
    if (reactionwinnerid == playerid)
    {
    SendClientMessage(playerid, 0x247C1BFF, "You've already won 'Reactiontest'!");
    }
    else
    {
    SendClientMessage(playerid, 0x247C1BFF, "You are too slow!.");
    }
    }
    return 1;
    }
4. La finalul scriptului , chiar jos de tot daca vrei, pui functiile:
public ReactionTest()
{
reactionstr = "";
KillTimer(reactiongap);
new str[256];
new random_set[] = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoO0pPqQ0rRsStTuUvVwWxXyYzZ1234567890";
for (new i = 0; i < raddon[random(sizeof(raddon))]; i++)
{
reactionstr[i] = random_set[random(sizeof(random_set))];
}
reactioninprog = 2;
format(str, sizeof(str), "Primul care scrie %s castiga 12.000$ si 5 puncte", reactionstr);
SendClientMessageToAll(0x57ffff82,str);
}

public ReactionWin(playerid)
{
GivePlayerMoney(playerid, 12000);
SetPlayerScore(playerid, GetPlayerScore(playerid)+5);
SetTimer("SetBack", 30, 0);
new reactionwinner[256];
new tempstring[256];
reactionwinnerid = playerid;
GetPlayerName(playerid, reactionwinner, sizeof(reactionwinner));
format(tempstring, sizeof(tempstring), "%s has won the reactiontest!", reactionwinner);
SendClientMessageToAll(0x57ffff82, tempstring);
reactiongap = SetTimer("ReactionTest", time1, 0);
}

public SetBack()
{
reactioninprog = 1;
}

5. Si gata !! Enjoy you ReactionTest script.

PS: Daca faci totul cum trebuie, n-ar trebui sa apara probleme.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.