Szerző Téma: Anti Flood  (Megtekintve 1003 alkalommal)

Nem elérhető Nátha

  • 1036
    • Profil megtekintése
Anti Flood
« Dátum: 2012. Június 06. - 13:47:50 »
0 Show voters
Kellene egy olyan script hogyha ír valaki a chat re akkor 3 másodperc után írhassa a következõt. Ha meg nem várja meg a 3 másodpercet és írna akkor meg írja ki neki pirossal hogy Kérlek írj lassabban !

Nem elérhető Gabor..

  • 1883
  • Gabor..
    • Profil megtekintése
Anti Flood
« Válasz #1 Dátum: 2012. Június 06. - 14:01:50 »
0 Show voters

#include   <     a_samp    >
public OnFilterScriptInit( )
{
    SetTimer( \"Update\", 3000, true );
}
public OnPlayerConnect( playerid )
{
    SetPVarInt( playerid, \"Flood\", 0 );
    return 1;
}
public OnPlayerText( playerid, text[] )
{
    SetPVarInt( playerid, \"Flood\", GetPVarInt( playerid, \"Flood\" ) + 1 );
    if( GetPVarInt( playerid, \"Flood\" ) > 1 )
    {
        SendClientMessage( playerid, 0xFF0000AA, \"HIBA: 3 Másodpercenként küldhetsz üzenetet, Írj lassabban!\" );
    }
    return 0;
}
forward Update( playerid );
public Update( playerid )
{
    foreach(Player, i)
    {
        if( GetPVarInt( i, \"Flood\" ) > 0  )
        {
           SetPVarInt( i, \"Flood\", 0 );
        }
    }
}

Most gyors írtam egyet, nem biztos, hogy jó, nem teszteltem.
« Utoljára szerkesztve: 2012. Június 06. - 15:56:24 írta Gabor.. »

Nem elérhető Nátha

  • 1036
    • Profil megtekintése
Anti Flood
« Válasz #2 Dátum: 2012. Június 06. - 14:08:27 »
0 Show voters
Nekem úgy kellene hogyha 3 másodpercen belül akar írni valamit az ne jelenjen meg a chat en és akkor írja ki neki hogy Kérlek írj lassabban !
« Utoljára szerkesztve: 2012. Június 06. - 14:09:58 írta Nátha »

Nem elérhető Norby

  • 1575
    • Profil megtekintése
Anti Flood
« Válasz #3 Dátum: 2012. Június 06. - 15:55:18 »
0 Show voters
#include   <     a_samp    >
public OnFilterScriptInit( )
{
    SetTimer( \"Update\", 3000, true );
}
public OnPlayerConnect( playerid )
{
    SetPVarInt( playerid, \"Flood\", 0 );
    return 1;
}
public OnPlayerText( playerid, text[] )
{
    SetPVarInt( playerid, \"Flood\", GetPVarInt( playerid, \"Flood\" ) + 1 );
    if( GetPVarInt( playerid, \"Flood\" ) > 1 )
    {
        SendClientMessage( playerid, 0xFF0000AA, \"HIBA: 3 Másodpercenként küldhetsz üzenetet, Írj lassabban!\" );
    }
    return 0;
}
forward Update( playerid );
public Update( playerid )
{
    foreach(Player, i)
    {
        if( GetPVarInt( i, \"Flood\" ) > 0  )
        {
           SetPVarInt( i, \"Flood\", 0 );
        }
    }
}

 
Így... Az OnPlayerText-nél return 0; ne térjen vissza!

Nem elérhető Nátha

  • 1036
    • Profil megtekintése
Anti Flood
« Válasz #4 Dátum: 2012. Június 06. - 18:34:41 »
0 Show voters
De most meg error os:
 
C:\\Documents and Settings\\Robi\\Asztal\\Új mappa (4)\\new.pwn(28) : error 017: undefined symbol \"foreach\"
C:\\Documents and Settings\\Robi\\Asztal\\Új mappa (4)\\new.pwn(30) : error 017: undefined symbol \"i\"
C:\\Documents and Settings\\Robi\\Asztal\\Új mappa (4)\\new.pwn(32) : error 017: undefined symbol \"i\"
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase
 
3 Errors.

Nem elérhető Gabor..

  • 1883
  • Gabor..
    • Profil megtekintése
Anti Flood
« Válasz #5 Dátum: 2012. Június 06. - 18:37:51 »
0 Show voters
#include   <     a_samp    >
#include   <     foreach   >
public OnFilterScriptInit( )
{
    SetTimer( \"Update\", 3000, true );
}
public OnPlayerConnect( playerid )
{
    SetPVarInt( playerid, \"Flood\", 0 );
    return 1;
}
public OnPlayerText( playerid, text[] )
{
    SetPVarInt( playerid, \"Flood\", GetPVarInt( playerid, \"Flood\" ) + 1 );
    if( GetPVarInt( playerid, \"Flood\" ) > 1 )
    {
        SendClientMessage( playerid, 0xFF0000AA, \"HIBA: 3 Másodpercenként küldhetsz üzenetet, Írj lassabban!\" );
    }
    return 0;
}
forward Update( playerid );
public Update( playerid )
{
    foreach(Player, i)
    {
        if( GetPVarInt( i, \"Flood\" ) > 0  )
        {
           SetPVarInt( i, \"Flood\", 0 );
        }
    }
}

Szükséges hozzá foreach.inc!

Anti Flood
« Válasz #6 Dátum: 2012. Június 06. - 18:48:53 »
0 Show voters
baseaf.inc
 
#include <a_samp>
static iPlayerChatTime[MAX_PLAYERS];
stock
IsPlayerFlooding(playerid)
{
if(GetTickCount() - iPlayerChatTime[playerid] < 2000)
    return 1;
return 0;
}
public
OnPlayerText(playerid, text[])
{
// Is the player flooding?
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
    SendClientMessage(playerid, 0xFF0000FF, \"* You can only send a message once every two seconds.\");
    return 0;
}
iPlayerChatTime[playerid] = GetTickCount();
// bla bla..
 
    return 1;
}
public
OnPlayerDisconnect(playerid, reason)
{
iPlayerChatTime[playerid] = 0;
return 1;
}
public
OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, \"* You can only use commands once every two seconds.\");
    return 1;
}
iPlayerChatTime[playerid] = GetTickCount();
// command .....
 
return 0;
}

 
Legelsõ filterszkript-be -ként kell beleírni\\betenni.
server.cfg
filterscripts baseaf (többi szkript neve)
« Utoljára szerkesztve: 2012. Június 06. - 18:56:29 írta ɐʞzssǝlosz »

Nem elérhető Nátha

  • 1036
    • Profil megtekintése
Anti Flood
« Válasz #7 Dátum: 2012. Június 06. - 19:14:35 »
0 Show voters
baseaf.inc
    #include <a_samp>
     
    static iPlayerChatTime[MAX_PLAYERS];
     
    stock
            IsPlayerFlooding(playerid)
    {
            if(GetTickCount() - iPlayerChatTime[playerid] < 2000)
                return 1;
     
            return 0;
    }
     
    public
            OnPlayerText(playerid, text[])
    {
            // Is the player flooding?
            if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
            {
                SendClientMessage(playerid, 0xFF0000FF, \"* You can only send a message once every two seconds.\");
                return 0;
            }
            iPlayerChatTime[playerid] = GetTickCount();
    // bla bla..
     
     
        return 1;
    }
     
    public
            OnPlayerDisconnect(playerid, reason)
    {
            iPlayerChatTime[playerid] = 0;
            return 1;
    }
     
    public
            OnPlayerCommandText(playerid, cmdtext[])
    {
            if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
            {
                    SendClientMessage(playerid, 0xFF0000FF, \"* You can only use commands once every two seconds.\");
                return 1;
            }
            iPlayerChatTime[playerid] = GetTickCount();
    // command .....
     
     
            return 0;
    }

 
Legelsõ filterszkript-be -ként kell beleírni\\betenni.
server.cfg
filterscripts baseaf (többi szkript neve)
[/quote]
Kösz, mûködik ! ;D
« Utoljára szerkesztve: 2012. Június 06. - 19:16:42 írta Nátha »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal