Author Topic: Antiskin  (Read 424 times)

0 Members and 1 Guest are viewing this topic.

Offline surfersat

  • Major(1)
  • Posts: 19
Antiskin
« on: March 07, 2019, 12:25:15 pm »
*  Unit antiSkin
*  Version: 1
*  Server version: 2.8.1
*  Script Core v.: 3
*  Creation date: 22.02.2019
*  Written by SaTaNiC

This script avoid players to join a game wearing banned clothes combinations (like Mayor default skin)

Offline soldat-game

  • Camper
  • ***
  • Posts: 360
  • GG: 10210041
Re: Antiskin
« Reply #1 on: March 07, 2019, 04:06:27 pm »
Good idea but:
there is no need to use Explode can use TStringList
Procedure ..(..); TStringList
var Temp:TStringList;
begin
Temp := File.CreateStringListFromFile(Path);
Next can use of string list Temp[1..*]

Add color ranges - just change one color number to be on the white list and the color will be almost the same. And the player will join the game :D

Code: [Select]
function isBanned(shirtColor:string; pantsColor:string): Boolean;
var
c: integer;
shirtList: TStringList;
pantsList: TStringList;
begin
shirtList := File.CreateStringListFromFile('antiSkin/shirt.txt');
pantsList := File.CreateStringListFromFile('antiSkin/pants.txt');
for c := 0 to shirtList.count do begin
if ((shirtColor = shirtList[c]) and (pantsColor = pantsList[c])) then begin
result:=true;
break;
end else begin
result:=false;
end;
end;
end;
« Last Edit: March 07, 2019, 04:20:00 pm by soldat-game »
Hey, I wrote messages on these topics (https://forums.soldat.pl/index.php?topic=45088.0
https://forums.soldat.pl/index.php?topic=45068.0), about deleting this message in this topic.
https://forums.soldat.pl/index.php?topic=45088.0

"So nothing was done hahahahahaha" Rekt admins remove this all time why? It does not break the rules.

Offline surfersat

  • Major(1)
  • Posts: 19
Re: Antiskin
« Reply #2 on: March 07, 2019, 04:19:21 pm »
Thank you!

I think in color range but not sure how to implement that, maybe in future versions.

Greetings!

Offline soldat-game

  • Camper
  • ***
  • Posts: 360
  • GG: 10210041
Re: Antiskin
« Reply #3 on: March 07, 2019, 04:49:41 pm »
Thank you!

I think in color range but not sure how to implement that, maybe in future versions.

Greetings!

Code: [Select]
{
*  Unit antiSkin
*  Version: 1
*  Server version: 2.8.1
*  Script Core v.: 3
*  Creation date: 22.02.2019
*  Written by SaTaNiC
}
const
BigTextLayer = 5;
UseLowerCase = true;

function isBanned(shirtColor:string; pantsColor:string): Boolean;
var i: integer; shirtList, pantsList: TStringList;
begin
result := false;
shirtList := File.CreateStringListFromFile('antiSkin/shirt.txt'); pantsList := File.CreateStringListFromFile('antiSkin/pants.txt');
for i := 0 to shirtList.count-1 do if (shirtColor = shirtList[i]) and (pantsColor = pantsList[i]) then begin
result := true;
break;
end;
shirtList.Free; pantsList.Free;
end;

procedure JoinTeam(Player: TActivePlayer; Team: TTeam);
begin
if (isBanned(IntToStr(Player.ShirtColor), IntToStr(Player.PantsColor))) then begin
Player.BigText(BigTextLayer,'Por favor cambia tu skin',500,$FF0000,0.20,20,200);
if Player.Team <> 5 then Player.Team := 5;
WriteLn('[*] antiSkin-> ID:' + IntToStr(Player.ID) + ' NICK:' + Player.Name + ' Shirt:' + IntToStr(Player.ShirtColor) + ' Pants:' + IntToStr(Player.PantsColor) + ' esta baneado');
end else WriteLn('[*] antiSkin-> ID:' + IntToStr(Player.ID) + ' NICK:' + Player.Name + ' Shirt:' + IntToStr(Player.ShirtColor) + ' Pants:' + IntToStr(Player.PantsColor) + ' entro');
end;

function OnCommandAntiSkin(Player: TActivePlayer; Command: string): Boolean;
var i: byte; TempName: string;
begin
result:=false;
if lowercase(copy(Command, 1, 9)) = '/antiskin' then begin
if UseLowerCase=true then TempName := lowercase(copy(Command, 11, 24)) else TempName := copy(Command, 11, 24);
for i := 1 to Game.MaxPlayers do if Players[i].Active then begin
if lowercase(Players[i].Name) = TempName then begin
if not (isBanned(IntToStr(Players[i].ShirtColor), IntToStr(Players[i].PantsColor))) then begin
WriteLnFile('antiSkin/shirt.txt', IntToStr(Players[i].ShirtColor));
WriteLnFile('antiSkin/pants.txt', IntToStr(Players[i].PantsColor));
WriteLn('[*] antiSkin-> '+Player.Name+' ha baneado el skin de '+Players[i].Name);
Player.Tell('[*] antiSkin-> '+Players[i].Name+' skin baneado');
Players[i].BigText(BigTextLayer,'Tu skin ha sido baneado',500,$FF0000,0.20,20,200);
if Player.Team <> 5 then Players[i].Team := 5;
end else Player.Tell('[*] antiSkin-> '+Players[i].Name+' skin ya estaba baneado');
Exit;
end;
end;
Player.Tell('[*] antiSkin-> Error, intenta nuevamente');
end;
end;

var i: byte;
begin
for i := 1 to Game.MaxPlayers do Players[i].OnCommand := @OnCommandAntiSkin;
for i := 0 to 5 do Game.Teams[i].OnJoin := @JoinTeam;
end.

See full and added a few amendments
Hey, I wrote messages on these topics (https://forums.soldat.pl/index.php?topic=45088.0
https://forums.soldat.pl/index.php?topic=45068.0), about deleting this message in this topic.
https://forums.soldat.pl/index.php?topic=45088.0

"So nothing was done hahahahahaha" Rekt admins remove this all time why? It does not break the rules.

Offline soldat-game

  • Camper
  • ***
  • Posts: 360
  • GG: 10210041
Re: Antiskin
« Reply #4 on: March 07, 2019, 05:03:16 pm »
I've added the color range here
Can edit in const, Color is a number, add a number to the color to increase or decrease the range of colors.
   PlusShirtColor = 10;
   MiniusShirtColor = 10;
   PlusPantsColor = 10;
   MiniusPantsColor = 10;

Code: [Select]
{
*  Unit antiSkin
*  Version: 1.0.1
*  Server version: 2.8.1
*  Script Core v.: 3
*  Creation date: 07.03.2019
*  Written by SaTaNiC set by Dominik
}

const
BigTextLayer = 5;
UseLowerCase = true;
PlusShirtColor = 10;
MiniusShirtColor = 10;
PlusPantsColor = 10;
MiniusPantsColor = 10;

var
i: byte;

function isBanned(shirtColor, pantsColor:longint): Boolean;
var i: integer; shirtList, pantsList: TStringList;
begin
result := false;
shirtList := File.CreateStringListFromFile('antiSkin/shirt.txt'); pantsList := File.CreateStringListFromFile('antiSkin/pants.txt');
for i := 0 to shirtList.count-1 do if (shirtColor >= (strtoint(shirtList[i])-MiniusShirtColor)) and (shirtColor <= (strtoint(shirtList[i])+PlusShirtColor)) and (pantsColor >= (strtoint(pantsList[i])-MiniusPantsColor)) and (pantsColor <= (strtoint(pantsList[i])+PlusPantsColor)) then begin
result := true;
break;
end;
shirtList.Free; pantsList.Free;
end;

procedure JoinTeam(Player: TActivePlayer; Team: TTeam);
begin
if (isBanned(Player.ShirtColor, Player.PantsColor)) then begin
Player.BigText(BigTextLayer,'Por favor cambia tu skin',500,$FF0000,0.20,20,200);
if Player.Team <> 5 then Player.Team := 5;
WriteLn('[*] antiSkin-> ID:' + IntToStr(Player.ID) + ' NICK:' + Player.Name + ' Shirt:' + IntToStr(Player.ShirtColor) + ' Pants:' + IntToStr(Player.PantsColor) + ' esta baneado');
end else WriteLn('[*] antiSkin-> ID:' + IntToStr(Player.ID) + ' NICK:' + Player.Name + ' Shirt:' + IntToStr(Player.ShirtColor) + ' Pants:' + IntToStr(Player.PantsColor) + ' entro');
end;

function OnCommandAntiSkin(Player: TActivePlayer; Command: string): Boolean;
var i: byte; TempName: string;
begin
result:=false;
if lowercase(copy(Command, 1, 9)) = '/antiskin' then begin
if UseLowerCase=true then TempName := lowercase(copy(Command, 11, 24)) else TempName := copy(Command, 11, 24);
for i := 1 to Game.MaxPlayers do if Players[i].Active then begin
if lowercase(Players[i].Name) = TempName then begin
if not (isBanned(Players[i].ShirtColor,Players[i].PantsColor)) then begin
WriteLnFile('antiSkin/shirt.txt', IntToStr(Players[i].ShirtColor));
WriteLnFile('antiSkin/pants.txt', IntToStr(Players[i].PantsColor));
WriteLn('[*] antiSkin-> '+Player.Name+' ha baneado el skin de '+Players[i].Name);
Player.Tell('[*] antiSkin-> '+Players[i].Name+' skin baneado');
Players[i].BigText(BigTextLayer,'Tu skin ha sido baneado',500,$FF0000,0.20,20,200);
if Player.Team <> 5 then Players[i].Team := 5;
end else Player.Tell('[*] antiSkin-> '+Players[i].Name+' skin ya estaba baneado');
Exit;
end;
end;
Player.Tell('[*] antiSkin-> Error, intenta nuevamente');
end;
end;

begin
for i := 1 to Game.MaxPlayers do Players[i].OnCommand := @OnCommandAntiSkin;
for i := 0 to 5 do Game.Teams[i].OnJoin := @JoinTeam;
end.
« Last Edit: March 07, 2019, 05:05:35 pm by soldat-game »
Hey, I wrote messages on these topics (https://forums.soldat.pl/index.php?topic=45088.0
https://forums.soldat.pl/index.php?topic=45068.0), about deleting this message in this topic.
https://forums.soldat.pl/index.php?topic=45088.0

"So nothing was done hahahahahaha" Rekt admins remove this all time why? It does not break the rules.

Offline surfersat

  • Major(1)
  • Posts: 19
Re: Antiskin
« Reply #5 on: March 07, 2019, 06:15:16 pm »
Excellent Dominik!

I will try this on my server later.

Greetings!