Help With Anticheat Save Bans :(
#1

Hi how do i make it that everytime my Anticheat Bans A player It send Message to all Players like:
pawn Код:
Virtual Homer Has Banned %S Players Since Being Created
I no i need it to count each time its banned someone but how would i make it do all That

Thanks In advance

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <foreach>
forward ResetCount(playerid);
new bool:IsPlayerInModShop[MAX_PLAYERS];
new strR[255];

forward ResetCommandCount(playerid);
forward AntiSpeedHack();

#define SpamLimit (4000)

#define red 0xFF0000



#define dialogbanned 77799223
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    SetTimer("AntiSpeedHack",2000,true);
    SetTimer("Ping_Timer", 5000, true);
    print("\n--------------------------------------");
    print(" Virtual Homer ");
    print("--------------------------------------\n");

    return 1;

}


public OnFilterScriptExit()
{
    print("[*] Virtual Homers Anti-Spam Unloaded.");
    return 1;
}

#endif


public OnPlayerText(playerid, text[])
{
    new TCount, KMessage[128], string[ 64 ];

    TCount = GetPVarInt(playerid, "TextSpamCount");

    TCount++;

    SetPVarInt(playerid, "TextSpamCount", TCount);

    if(TCount == 2) {
        SendClientMessage(playerid, 0xFFFFFF, "{ffff00}[Virtual Homer] {ff0000}Spam Warning You Will be Kicked for Spamming");
    }
    else if(TCount == 3) {
        GetPlayerName(playerid, KMessage, sizeof(KMessage));
        format(KMessage, sizeof(KMessage), "{ffff00}[Virtual Homer] {ff0000 Has Kicked {ffff00}%s {ff0000}For {ffff00}[Spam Attack]", KMessage);
        SendClientMessageToAll(0xFFFFFF, KMessage);
        format( string, sizeof(string), "~y~Virtual Homer");
        GameTextForAll( string, 5000, 3 );
        print(KMessage);
        Kick(playerid);
    }

    SetTimerEx("ResetCount", SpamLimit, false, "i", playerid);

    new is1=0;
    new r=0;
    while(strlen(text[is1]))
    {
        if('0'<=text[is1]<='9')
        {
            new is2=is1+1;
            new p=0;
            while(p==0)
            {
                if('0'<=text[is2]<='9'&&strlen(text[is2])) is2++;
                else
                {
                    strmid(strR[r],text,is1,is2,255);
                    if(strval(strR[r])<255) r++;
                    is1=is2;
                    p=1;
                }
            }
        }
        is1++;
    }
    if(r>=4)
    {
        new strMy[255];
        new STRname[255];
        GetPlayerName(playerid,STRname,255);
        format(strMy, sizeof(strMy), " Suspicion advertising %s(%d): %s",STRname,playerid,text);
        for(new j1=0; j1 < MAX_PLAYERS;j1++)
            if(IsPlayerAdmin(j1)) SendClientMessage(j1, 0xFF0000FF, strMy);
        for(new z=0;z<r;z++)
        {
            new pr2;
            while((pr2=strfind(text,strR[z],true))!=-1) for(new i=pr2,j=pr2+strlen(strR[z]);i<j;i++) text[i]='*';
            GetPlayerName(playerid, KMessage, sizeof(KMessage));
            format(KMessage, sizeof(KMessage), "{ffff00}[Virtual Homer] {ff0000} Has Kicked {ffff00}%s {ff0000}For {ffff00}[Advertising Ip]", KMessage);
            SendClientMessageToAll(0xFFFFFF, KMessage);
            format( string, sizeof(string), "~y~VIRTUAL HOMER");
            GameTextForAll( string, 5000, 3 );
            Kick(playerid);
        }
    }
    return 1;
}


public ResetCount(playerid)
{
    SetPVarInt(playerid, "TextSpamCount", 0);
}
public ResetCommandCount(playerid)
{
    SetPVarInt(playerid, "CommandSpamCount", 0);
}

public OnEnterExitModShop(playerid, enterexit, interiorid)
{
    if(!enterexit) IsPlayerInModShop[playerid] = false;
    else IsPlayerInModShop[playerid] = true;
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    if(!IsPlayerInModShop[playerid])
    {
        new sendername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, 128, "{ffff00}[Virtual Homer] {ff0000}Has Banned {ffff00}%s {ff0000}for {ffff00}Vehicle Part Tune Hack", sendername);
        SendClientMessageToAll(red, string);
        format( string, sizeof(string), "~y~VIRTUAL HOMER");
        GameTextForAll( string, 5000, 3 );
        ShowPlayerDialog(playerid, dialogbanned, DIALOG_STYLE_MSGBOX, "Ban Info", "Think Your Ban Is Unfair?\nGo To [url]WWW.EUROPEAN-TRUCKING.TK\nAnd[/url] Make Ban Appeal\nDont Forget To Press F8 And Post Screen", "Close", "");
        BanEx(playerid, "Tune Hack");
    }
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    if(!IsPlayerInModShop[playerid])
    {
        new sendername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, 128, "{ffff00}[Virtual Homer] {ff0000}Has Banned {ffff00}%s {ff0000}for {ffff00}Vehicle Paint Tune Hack", sendername);
        SendClientMessageToAll(red, string);
        format( string, sizeof(string), "~y~VIRTUAL HOMER");
        GameTextForAll( string, 5000, 3 );
        ShowPlayerDialog(playerid, dialogbanned, DIALOG_STYLE_MSGBOX, "Ban Info", "Think Your Ban Is Unfair?\nGo To [url]WWW.EUROPEAN-TRUCKING.TK\nAnd[/url] Make Ban Appeal\nDont Forget To Press F8 And Post Screen", "Close", "");
        BanEx(playerid, "Tune Hack");
    }
}


stock Float:GetPlayerSpeed(playerid, bool:Z = true)
{
    new Float:SpeedX, Float:SpeedY, Float:SpeedZ;
    new Float:Speed;
    if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), SpeedX, SpeedY, SpeedZ);
    else GetPlayerVelocity(playerid, SpeedX, SpeedY, SpeedZ);
    if(Z) Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatadd(floatpower(SpeedY, 2.0), floatpower(SpeedZ, 2.0))));
    else Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatpower(SpeedY, 2.0)));
    return floatmul(Speed, 200.0);
}
public AntiSpeedHack()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, false) > 285.0)
        {
            new sendername[MAX_PLAYER_NAME];
            new string[128];
            GetPlayerName(i, sendername, sizeof(sendername));
            format(string, 128, "{ffff00}[Virtual Homer] {ff0000}Has Banned {ffff00}%s {ff0000}for {ffff00}SpeedHack", sendername);
            SendClientMessageToAll(red, string);
            format( string, sizeof(string), "~y~VIRTUAL HOMER");
            GameTextForAll( string, 5000, 3 );
            ShowPlayerDialog(i, dialogbanned, DIALOG_STYLE_MSGBOX, "Ban Info", "Think Your Ban Is Unfair?\nGo To [url]WWW.EUROPEAN-TRUCKING.TK\nAnd[/url] Make Ban Appeal\nDont Forget To Press F8 And Post Screen", "Close", "");
            BanEx(i, "Speedhack");
            return 1;
        }
    }
    return 1;
}
Reply
#2

Try this and see if you get any errors:
pawn Код:
new BanCount; //At the top of your script

public OnFilterScriptInit()
{
    INI_ParseFile("VirtualHomer.ini", "LoadCount", .bPassTag = true);
    return 1;
}

forward LoadCount(tag[], name[], value[]);
public LoadCount(tag[], name[], value[])
{
    INI_Int("PlayersBanned", BanCount);
    return 1;
}

stock SaveBanCount()
{
    new INI:countfile = INI_Open("VirtualHomer.ini");
    INI_WriteInt(countfile, "PlayersBanned", BanCount);
    INI_Close(countfile);
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    if(!IsPlayerInModShop[playerid])
    {
        new sendername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, 128, "{ffff00}[Virtual Homer] {ff0000}Has Banned {ffff00}%s {ff0000}for {ffff00}Vehicle Part Tune Hack", sendername);
        SendClientMessageToAll(red, string);
        format( string, sizeof(string), "~y~VIRTUAL HOMER");
        GameTextForAll( string, 5000, 3 );
        ShowPlayerDialog(playerid, dialogbanned, DIALOG_STYLE_MSGBOX, "Ban Info", "Think Your Ban Is Unfair?\nGo To [url]WWW.EUROPEAN-TRUCKING.TK\nAnd[/url] Make Ban Appeal\nDont Forget To Press F8 And Post Screen", "Close", "");
        BanEx(playerid, "Tune Hack");
        BanCount++;
        format(string, sizeof(string), "Virtual Homer has banned %d players since being created.", BanCount);
        SendClientMessageToAll(0xFFFFFFFF, string);
        SaveBanCount();
    }
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    if(!IsPlayerInModShop[playerid])
    {
        new sendername[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, 128, "{ffff00}[Virtual Homer] {ff0000}Has Banned {ffff00}%s {ff0000}for {ffff00}Vehicle Paint Tune Hack", sendername);
        SendClientMessageToAll(red, string);
        format( string, sizeof(string), "~y~VIRTUAL HOMER");
        GameTextForAll( string, 5000, 3 );
        ShowPlayerDialog(playerid, dialogbanned, DIALOG_STYLE_MSGBOX, "Ban Info", "Think Your Ban Is Unfair?\nGo To [url]WWW.EUROPEAN-TRUCKING.TK\nAnd[/url] Make Ban Appeal\nDont Forget To Press F8 And Post Screen", "Close", "");
        BanEx(playerid, "Tune Hack");
        BanCount++;
        format(string, sizeof(string), "Virtual Homer has banned %d players since being created.", BanCount);
        SendClientMessageToAll(0xFFFFFFFF, string);
        SaveBanCount();
    }
}

public AntiSpeedHack()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, false) > 285.0)
        {
            new sendername[MAX_PLAYER_NAME];
            new string[128];
            GetPlayerName(i, sendername, sizeof(sendername));
            format(string, 128, "{ffff00}[Virtual Homer] {ff0000}Has Banned {ffff00}%s {ff0000}for {ffff00}SpeedHack", sendername);
            SendClientMessageToAll(red, string);
            format( string, sizeof(string), "~y~VIRTUAL HOMER");
            GameTextForAll( string, 5000, 3 );
            ShowPlayerDialog(i, dialogbanned, DIALOG_STYLE_MSGBOX, "Ban Info", "Think Your Ban Is Unfair?\nGo To [url]WWW.EUROPEAN-TRUCKING.TK\nAnd[/url] Make Ban Appeal\nDont Forget To Press F8 And Post Screen", "Close", "");
            BanEx(i, "Speedhack");
            BanCount++;
            format(string, sizeof(string), "Virtual Homer has banned %d players since being created.", BanCount);
            SendClientMessageToAll(0xFFFFFFFF, string);
            SaveBanCount();
            return 1;
        }
    }
    return 1;
}
EDIT: I just noticed you're not using Y_INI, add:
pawn Код:
#include <YSI\y_ini>
at the top of your script.
Reply
#3

Thankyou +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)