Jump to content

[PAWN] Crearea unui sistem de Anti Spam-Flood


Ragnar47
 Share

Recommended Posts

*Nume: Ragnar47

*Descriere Script: Anti flood

*Poze: -

*Codul (sursa):

[1] - Anti-Flood pentru boți spam
O

nPlayerConnect:
if(CountIP(GetIP(playerid)) > 2 && !IsPlayerNPC(playerid))
{
    Kick(playerid);
    return 1;
}
la sfârșitul gamemode-ului:
stock CountIP(ipaddress[])
{
    new ipcount = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !strcmp(GetIP(i),ipaddress))
        {
            ipcount++;
        }
    }
    return ipcount;
}

stock GetIP(playerid)
{
    new ip[16];
    GetPlayerIp(playerid,ip,sizeof(ip));
    return ip;
}


[2] - Anti-Flood pentru Kill-Spam
Majoritatea care folosesc acest program, nu se și loghează pe server, așa ca la OnPlayerDeath puneți următorul cod

if(gPlayerLogged[playerid] == 0) // schimbati in variabila voastra de login
    {
Kick(playerid);
    } Dacă totuși e logat puteți folosi următorul script
//la inceputul scriptului
new Avertizari[MAX_PLAYERS];

//la onplayerconnect / onplayerdisconnect
Avertizari[playerid] = 0;

//la onplayerdeath
if(killerid != INVALID_PLAYER_ID && killerid != playerid)
{
if(GetDistanceBetweenPlayers(playerid,killerid) > 100)
    {
      if(GetPlayerWeapon(killerid) != reason)
      {
                      Avertizari[playerid]++;
                      if(Avertizari[playerid] > 2)
                      {
                                Kick(playerid);
                      }
      }
    }


} [3] - Anti-Flood ZCMD

#include <zcmd>

new timeSpam[MAX_PLAYERS];
new ZcmdSpam[MAX_PLAYERS];

la OnplayerConnect/onplayerdisconnect
ZcmdSpam[playerid] = 0;

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(GetTickCount() - timeSpam[playerid] < 1000)
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "Nu mai face spam!");
      ZcmdSpam[playerid]++;
      if(ZcmdSpam[playerid] > 3)
      {
            Kick(playerid);
      }
      return 0;
  }
  timeSpam[playerid] = GetTickCount();
  return 1;}


[4] - Anti-Exit Car SPAM

public OnPlayerExitVehicle(playerid, vehicleid)
{
  if(gPlayerLogged[playerid] == 0) // variabila care verifica daca userul este logat
    {


Kick(playerid);
}
} Dacă aveți server fără login:

new ExitTime[MAX_PLAYERS];
new ExitNumber[MAX_PLAYERS];

//la onplayerconnect / onplayerdisconnect
ExitTime[playerid] = 0;
ExitNumber[playerid] = 0;
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(GetTickCount() - ExitTime[playerid] < 1000)
    {
      ExitNumber[playerid]++;
      if(ExitNumber[playerid] > 3)
      {
            Kick(playerid);
      }
      return 0;
    }
    ExitTime[playerid] = GetTickCount();
}

Daca ai intrebari, nu ezita sa le pui in acest topic.

Daca te-a ajutat acest tutorial poti lasa un +1.

Edited by Ragnar47
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • 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.