Anti-Waffen-Cheaten System

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Ich habe ein Antiwaffenhack System angefangen nun komm ich nicht weiter wie ich es checken soll ?


    enum SpielerDaten
    {
    bool:WeaponGived,
    Weapons[13],
    Ammos[13]


    stock GetWeaponSlot(weaponid){
    new slot;
    if(weaponid == 0 || weaponid == 1) { slot = 0; }
    else if(weaponid >= 2 && weaponid <= 9) { slot = 1; }
    else if(weaponid >= 22 && weaponid <= 24) { slot = 2; }
    else if(weaponid >= 25 && weaponid <= 27) { slot = 3; }
    else if(weaponid == 28 || weaponid == 29 || weaponid == 32) { slot = 4; }
    else if(weaponid == 30 || weaponid == 31) { slot = 5; }
    else if(weaponid == 33 || weaponid == 34) { slot = 6; }
    else if(weaponid >= 35 && weaponid <= 38) { slot = 7; }
    else if((weaponid >= 16 && weaponid <= 18) || weaponid == 39) { slot = 8; }
    else if(weaponid >= 41 && weaponid <= 43) { slot = 9; }
    else if(weaponid >= 10 && weaponid <= 15) { slot = 10; }
    else if(weaponid >= 44 && weaponid <= 46) { slot = 11; }
    else if(weaponid) { slot = 12; }
    else { slot = 0; }
    return slot;
    }




    Mysql Speichern und Loaden


    for(new slot=0;slot<13;slot++)
    {
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot1", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot2", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot3", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot4", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot5", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot6", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot7", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot8", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot9", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot10", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot11", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot12", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo1", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo2", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo3", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo4", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo5", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo6", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo7", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo8", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo9", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo10", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo11", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo12", "Name", PlayerInfo[playerid][pName]);
    }
    for(new slot=0;slot<13;slot++)
    {
    mysql_SetInt("accounts", "Waffenslot1", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot2", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot3", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot4", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot5", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot6", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot7", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot8", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot9", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot10", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot11", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenslot12", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo1", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo2", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo3", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo4", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo5", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo6", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo7", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo8", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo9", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo10", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo11", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Waffenammo12", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
    }







    Function AntiGivePlayerWeapon(playerid, weaponid, ammo)
    {
    if(IsPlayerConnected(playerid) && (weaponid && ammo))
    {
    PlayerInfo[playerid][WeaponGived] = true;
    PlayerInfo[playerid][Weapons][GetWeaponSlot(weaponid)] = weaponid;
    PlayerInfo[playerid][Ammos][GetWeaponSlot(weaponid)] += ammo;
    GivePlayerWeapon(playerid, weaponid, ammo);
    PlayerInfo[playerid][WeaponGived] = false;
    }
    return 1;
    }


    Function AntiResetPlayerWeapons(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    ResetPlayerWeapons(playerid);
    PlayerInfo[playerid][WeaponGived] = true;
    for(new slot=0;slot<13;slot++)
    {
    PlayerInfo[playerid][Weapons][slot] = 0;
    PlayerInfo[playerid][Ammos][slot] = 0;
    }
    PlayerInfo[playerid][WeaponGived] = false;
    }
    return 1;
    }



    Und wie soll ich es Checken ?



    MFG
    SuTroX

  • Hier ich hab mal eins geschrieben:
    http://utiny.tk/p/OY1


    Alle GivePlayerWeapon auf SL_GivePlayerWeapon ändern
    einzigstes Problem:
    wenn ein User Waffen erhält von Script (also mit SL_Give..),
    die Munition leer schießt und dann sich die exakt gleiche Waffe nochmal ercheatet, dann wird das nicht erkannt.


    Dies kann man, denke ich, leicht fixxen,
    einfach in dem Timer abfragen ob die Munition leer (= 0) ist, dann die pWaffe[playerid][slot] auf 0 setzten.


    Hab ich nicht gemacht, weil es irgendwie nicht funktioniert hat.


    Wer eine Lösung für das Problem hat, möge er mich daran teilhaben lassen ;)


    mfg


  • Welchen Timer soll ich nutzen


    new weapons[13][2];
    for (new k = 0; k < 13; k++)
    {
    GetPlayerWeaponData(i, k, weapons[k][0], weapons[k][1]);
    if(weapons[k][0] != 0 && pWaffen[i][k] == 0)Ban(playerid);
    }
    if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK){
    Ban(playerid);
    }


    z.B


    CheckPlayerWeapons()
    und dann MAX_PLAYERS oder


    CheckPlayerWeapons(playerid)


    weil da ja steht einmal (i) und einmal (playerid)


    new weapons[13][2];
    for (new k = 0; k < 13; k++)
    {
    GetPlayerWeaponData(i, k, weapons[k][0], weapons[k][1]);
    if(weapons[k][0] != 0 && pWaffen[i][k] == 0)Ban(playerid);
    }
    if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
    {
    Ban(playerid);
    }

  • da hast du Recht :D
    ich hab das Ban(playerid) schnell hingeschrieben, weil ich eine andere Funktion habe ;)
    natürlich muss das ein i sein ^^


    du packst dass in einen 1-SekundenTimer ;)



    /e
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    //Hier rein ^^
    }