Beiträge von DMA

    Zurzeit gibt es 2 Datein.
    Die eine ist die config.txt (nicht zwingend erforderlich).
    Die andere die blacklist.txt in ihr werden alle Namen und IPe eingetragen die kickt werden sollen.
    Der Health Cheat Check wird noch ausgebaut, hatte "keine Lust".
    Der Money Cheat Check prüft ob der Player das Geld vom Script erhalten hat.
    Dazu muss man allerdings nun TransferMoney nutzen.

    ANTI Cheat System (0.0.3 Alpha)
    /* ANTI Cheat System by DMA
    Script in Year 2008 */
    #include <a_samp>
    /* Version: FilterScript
    Mod: Public */
    #define maxmodi 12
    #define blackpath "/ANTI/blacklist.txt"
    #define configpath "/ANTI/config.txt"
    #define MAX_LINE_LENG 70
    #define MAX_FORM_LENG 256
    /* read Modi:
    IP_READ
    NAME_READ
    CFG_READ
    CLS_READ */
    #define IP_READ 0
    #define NAME_READ 1
    #define CFG_READ 2
    #define CLS_READ 3
    /* Modi list:
    0 = blacklist
    1 = Anti Health
    2 = Money
    3 = Car Spawn */
    new bool:modi[maxmodi];
    /* Valid Car Spawn */
    new maxcar;
    #define MAX_CAR 750
    new validcar[MAX_CAR];
    stock AddVehicle(modelid, Float:x, Float:y, Float:z, Float:r, color1, color2, respawn)
    {
    maxcar = CreateVehicle(modelid, x, y, z, r, color1, color2, respawn);
    validcar[maxcar] = 1;
    return maxcar;
    }
    /* Global Vars for ANTI Cheat System */
    new playerMoney[MAX_PLAYERS];
    /*Forward */
    forward GlobalTimer();
    forward OnPlayerCheat(playerid, sys);
    /* Functions */
    stock TransferMoney(playerid, money)
    {
    playerMoney[playerid] += money;
    GivePlayerMoney(playerid, money);
    }


    public GlobalTimer()
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(modi[1] == true)
    {
    new Float:Heal;
    GetPlayerHealth(i, Heal);
    if(Heal > 100.0 && Heal < 0 || Heal == -1)
    {
    SendClientMessageToAll(0xFF6900AA, "Kick for Health Cheat");
    OnPlayerCheat(i, 1);
    Kick(i);
    }
    }
    if(modi[2] == true)
    {
    new pmoney = GetPlayerMoney(i);
    if(pmoney != playerMoney[i])
    {
    OnPlayerCheat(i, 2);
    }
    }
    }
    }


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" ANTI Cheat System (c) by DMA");
    print("--------------------------------------\n");
    SetTimer("GlobalTimer", 1000, 1);
    return 1;
    }


    public OnFilterScriptExit()
    {
    print("\n ANTI Cheat System - DOWN -\n");
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    if(modi[0] == true && fexist(blackpath))
    {
    new File:blacklist = fopen(blackpath, io_read);
    new reader[MAX_LINE_LENG];
    new gmod, bumper;
    while(fread(blacklist, reader, MAX_LINE_LENG))
    {
    bumper = 0;
    if(!strcmp(";", reader, true, 1))
    {
    bumper = 1;
    }
    if(!strcmp("@IP", reader, true, 3) && bumper != 1)
    {
    gmod = IP_READ;
    }
    if(!strcmp("@NAME", reader, true, 5) && bumper != 1)
    {
    gmod = NAME_READ;
    }
    if(bumper != 1 && gmod == IP_READ)
    {
    new ipcore[16];
    GetPlayerIp(playerid, ipcore, sizeof(ipcore));
    if(!strcmp(ipcore, reader, true))
    {
    SendClientMessageToAll(0xFF6900AA, "IP blacklist");
    Kick(playerid);
    }
    }
    else if(bumper != 1 && gmod == NAME_READ)
    {
    new getname[16];
    GetPlayerName(playerid, getname, 16);
    if(!strcmp(getname, reader, true))
    {
    SendClientMessageToAll(0xFF6900AA, "Name blacklist");
    OnPlayerCheat(playerid, 0);
    Kick(playerid);
    }
    }
    }
    fclose(blacklist);
    }
    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    if(validcar[vehicleid] != 1 && modi[3] == true)
    {
    SendClientMessageToAll(0xFF6900AA, "Vehicle Cheat");
    DestroyVehicle(vehicleid);
    }
    return 1;
    }


    public OnRconCommand(cmd[])
    {
    if(!strcmp(cmd, "openconfig", true))
    {
    new File:config = fopen(configpath, io_read);
    new reader[MAX_LINE_LENG], bumper, gmod;
    while(fread(config, reader, MAX_LINE_LENG))
    {
    bumper = 0;
    if(!strcmp(";", reader, true, 1))
    {
    bumper = 1;
    }
    if(!strcmp("@OPEN", reader, true, 5) && bumper != 1)
    {
    gmod = CFG_READ;
    }
    if(gmod == CFG_READ && bumper != 1)
    {
    if(!strcmp(reader, "blacklist ", true, 10))
    {
    if(!strcmp(reader[10], "true", true))
    {
    modi[0] = true;
    SendRconCommand("echo Blacklist True");
    }
    else if(!strcmp(reader[10], "false", true))
    {
    modi[0] = false;
    SendRconCommand("echo Blacklist False");
    }
    }
    if (!strcmp(reader, "health ", true, 7))
    {
    if(!strcmp(reader[7], "true", true))
    {
    modi[1] = true;
    SendRconCommand("echo HealthCheat True");
    }
    else if(!strcmp(reader[7], "false", true))
    {
    modi[1] = false;
    SendRconCommand("echo HealthCheat False");
    }
    }
    if (!strcmp(reader, "money ", true, 6))
    {
    if(!strcmp(reader[6], "true", true))
    {
    modi[2] = true;
    SendRconCommand("echo MoneyCheat True");
    }
    else if(!strcmp(reader[6], "false", true))
    {
    modi[2] = false;
    SendRconCommand("echo MoneyCheat False");
    }
    }
    if (!strcmp(reader, "vehicle ", true, 8))
    {
    if(!strcmp(reader[8], "true", true))
    {
    modi[3] = true;
    SendRconCommand("echo VehicleCheat True");
    }
    else if(!strcmp(reader[8], "false", true))
    {
    modi[3] = false;
    SendRconCommand("echo VehicleCheat False");
    }
    }
    }
    }
    fclose(config);
    return 1;
    }
    if(!strcmp(cmd, "loaded", true))
    {
    if(modi[0] == true)
    {
    SendRconCommand("echo Blacklist");
    }
    if(modi[1] == true)
    {
    SendRconCommand("echo Health");
    }
    return 1;
    }
    if(!strcmp(cmd, "money", true))
    {
    if(modi[2] == false)
    {
    modi[2] = true;
    SendRconCommand("echo Money Aktiv");
    }
    else
    {
    modi[2] = true;
    SendRconCommand("echo Money Deaktiv");
    }
    return 1;
    }
    if(!strcmp(cmd, "health", true))
    {
    if(modi[1] == false)
    {
    modi[1] = true;
    SendRconCommand("echo Health Aktiv");
    }
    else
    {
    modi[1] = false;
    SendRconCommand("echo Health deaktiv");
    }
    return 1;
    }
    if(!strcmp(cmd, "vehicle", true))
    {
    if(modi[3] == false)
    {
    modi[3] = true;
    SendRconCommand("echo Vehicle Aktiv");
    }
    else
    {
    modi[3] = false;
    SendRconCommand("echo Vehicle deaktiv");
    }
    return 1;
    }
    if(!strcmp(cmd, "blacklist", true))
    {
    if(modi[0] == false)
    {
    modi[0] = true;
    SendRconCommand("echo Blacklist Aktiv");
    }
    else
    {
    modi[0] = false;
    SendRconCommand("echo Blacklist Deaktiv");
    }
    return 1;
    }
    if(!strcmp(cmd, "addtoblacklist", true, 14))
    {
    new File:blacklist = fopen(blackpath, io_append);
    new writer[MAX_LINE_LENG];
    format(writer, sizeof(writer), "\r\n@NAME\r\n%s", cmd[15]);
    fwrite(blacklist, writer);
    fclose(blacklist);
    SendRconCommand("echo User eingetragen");
    return 1;
    }
    if(!strcmp(cmd, "showblacklist", true))
    {
    new File:blacklist = fopen(blackpath, io_read);
    new reader[MAX_LINE_LENG], formater[MAX_FORM_LENG];
    while(fread(blacklist, reader, MAX_LINE_LENG))
    {
    format(formater, sizeof(formater), "echo %s", reader);
    SendRconCommand(formater);
    }
    fclose(blacklist);
    return 1;
    }
    return 1;
    }


    public OnPlayerCheat(playerid, sys)
    {
    if(sys == 2)
    {
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, playerMoney[playerid]);
    }
    return 1;
    }
    Installation:
    Den Sourcecode Compilieren und folgende Datein erstellen:
    /ANTI/config.txt
    /ANTI/blacklist.txt


    Config.txt:

    Code
    ;Config Sample
    @OPEN
    blacklist true


    blacklist.txt:

    Code
    @NAME
    ;NAMEN Ban
    DMAchen
    @IP
    127.0.0.1


    Gegebenenfalls die blacklist.txt bearbeiten.


    Changelog:

    Code
    0.0.1 Callback & Blacklist
    0.0.2 Datei & Callback erweiterung
    0.0.3 Rcon Commands hinzugefügt & Datei "system" ausgebaut


    Callback:
    OnPlayerCheat(playerid, sys)
    playerid == Cheater ID
    sys == Modus


    Modus:

    Code
    0 = Blacklist
    1 = Health Cheat
    2 = Money Cheat


    Quelltext bei Money Cheat umschreiben.
    GivePlayerMoney ist nun TransferMoney.


    System ist Pre-Alpha und wird noch ausgebaut.


    Datein:
    blacklist.txt
    name ist der Befehl zum Starten einer Bann liste für Usernames
    ; ist der Befehl für einen Einzeilen Kommentar
    @IP ist der Befehl zum Starten einer Bann liste für IP's.


    config.txt
    ; Einzeilen Kommentar
    open start
    blacklist true Aktiviert Blacklist