Advertisement
Deaderik

Untitled

Feb 5th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.65 KB | Gaming | 0 0
  1. // MojeAntiBanObcházeníScript.sma
  2.  
  3. #include <a_samp>
  4.  
  5. new PlayerBanData[MAX_PLAYERS][2]; // [0] - IP adresa, [1] - Unikátní identifikátor účtu
  6. new BanList[MAX_PLAYERS][2]; // [0] - IP adresa, [1] - Unikátní identifikátor účtu
  7.  
  8. public OnPlayerConnect(playerid)
  9. {
  10.     new ip[16];
  11.     GetPlayerIp(playerid, ip, sizeof(ip));
  12.     new accountid[MAX_PLAYER_NAME];
  13.     GetPlayerName(playerid, accountid, sizeof(accountid));
  14.  
  15.     // Kontrola na straně serveru při připojení
  16.     if (IsPlayerBanned(playerid, ip, accountid)) {
  17.         SendPlayerMessageToPlayer(playerid, COLOR_RED, "Jste zabanován. Obcházení banu není povoleno.");
  18.         Kick(playerid);
  19.     }
  20.  
  21.     return OnPlayerConnect(playerid);
  22. }
  23.  
  24. public OnPlayerDisconnect(playerid, reason)
  25. {
  26.     // Uvolnění dat hráče po odpojení
  27.     PlayerBanData[playerid][0] = "N/A";
  28.     PlayerBanData[playerid][1] = "N/A";
  29.    
  30.     return OnPlayerDisconnect(playerid, reason);
  31. }
  32.  
  33. public IsPlayerBanned(playerid, ip[], accountid[])
  34. {
  35.     // Kontrola banlistu na základě IP adresy a unikátního identifikátoru účtu
  36.     for (new i = 0; i < MAX_PLAYERS; i++) {
  37.         if (BanList[i][0] == ip || BanList[i][1] == accountid) {
  38.             return true; // Hráč je na banlistu
  39.         }
  40.     }
  41.  
  42.     return false; // Hráč není na banlistu
  43. }
  44.  
  45. // Funkce pro přidání hráče na banlist
  46. public AddPlayerToBanList(playerid, ip[], accountid[])
  47. {
  48.     // Přidání hráče na banlist
  49.     BanList[playerid][0] = ip;
  50.     BanList[playerid][1] = accountid;
  51.    
  52.     // Další kroky, např. uložení do databáze nebo aktualizace
  53. }
  54.  
  55. // Další opatření můžete přidat podle potřeby
Tags: anti ban
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement