Advertisement
Guest User

anti bravo

a guest
Jul 18th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 3.90 KB | None | 0 0
  1.  
  2. const
  3.   Color = $FFD700;
  4.  
  5. var
  6.   Enable: boolean;
  7.   BravoMaps: tstringarray;
  8.   Warnings : array[1..32] of integer;
  9.  
  10.  
  11. //Split by DorkeyDear aka Curt
  12. function Split(const Source: string; const Delimiter: string): tstringarray;
  13. var
  14.   i,x,d: integer;
  15.   s: string;
  16. begin
  17.   d := Length(Delimiter);
  18.   x := 0;
  19.   i := 1;
  20.   SetArrayLength(Result,1);
  21.   while i <= Length(source) do begin
  22.     s := Copy(Source,i,d);
  23.     if s = Delimiter then begin
  24.       Inc(i,d);
  25.       Inc(x,1);
  26.       SetArrayLength(result,x + 1);
  27.     end else begin
  28.       Result[x] := Result[x] + Copy(s,1,1);
  29.       Inc(i,1);
  30.     end;
  31.   end;
  32. end;
  33.  
  34. procedure ActivateServer();
  35.     begin
  36.         Enable := true;
  37.         BravoMaps := Split(LowerCase(ReadFile('scripts/MoveTeam/bravomaps.txt')),Chr(13) + Chr(10));
  38.     end;
  39.    
  40.     procedure OnJoinGame(ID, Team: byte);
  41.     var
  42.         i: integer;
  43.     begin
  44.         for i := 0 to ArrayHigh(BravoMaps) do if LowerCase(BravoMaps[i]) = LowerCase(CurrentMap) then begin
  45.             WriteConsole(ID, 'Bu bir bravo map, bravo olabilirsiniz.',Color);
  46.             DrawText(ID,'Bur bir bravo map,' + #13#10 + 'bravo olabilirsiniz.',330,Color,0.09,20,370);
  47.         end;
  48.     end;
  49.  
  50. procedure OnLeaveGame(ID, Team: byte;Kicked: boolean);
  51.    
  52.     begin
  53.  
  54.     Warnings[ID] := 0; 
  55.    
  56.     end;
  57.    
  58.     procedure DisableBravo;
  59.     begin
  60.         Enable := true;
  61.     end;
  62.  
  63. procedure EnableBravo;
  64.     begin
  65.         Enable := false;
  66.     end;
  67.    
  68. procedure OnMapChange(NewMap: String);
  69.  
  70.     var
  71.         i,b : integer;
  72.  
  73.     begin
  74.         for b := 1 to 32 do if GetPlayerStat(b,'Team') = 2 then Command('/setteam1 ' + IntToStr(b));
  75.         for i := 0 to ArrayHigh(BravoMaps) do if LowerCase(BravoMaps[i]) = LowerCase(NewMap) then begin
  76.             WriteConsole(0, 'Bu bir bravo map, bravo olabilirsiniz.',Color);
  77.             DrawText(0,'Bu bir bravo map,' + #13#10 + 'bravo olabilirsiniz.',330,Color,0.09,20,370);
  78.             EnableBravo;
  79.         end;
  80.     end;
  81.  
  82.    
  83. procedure OnJoinTeam(ID, Team: byte);
  84.  
  85. var
  86.   i: integer;
  87.    
  88.     begin
  89.            
  90.             for i := 0 to ArrayHigh(BravoMaps) do if LowerCase(BravoMaps[i]) = LowerCase(CurrentMap) then begin
  91.                 Enable := false;
  92.     end;
  93.    
  94.     begin
  95.  
  96.         if (Team <> 1) and (Team <> 5) then begin
  97.         if Enable = true then begin
  98.             Command('/setteam1 ' + IntToStr(ID));
  99.             WriteConsole(ID, 'Bravoya girme!',Color);
  100.             Warnings[ID] := Warnings[ID] + 1
  101.             WriteConsole(ID, 'Spam engellemek icin, yalnizca 4 defa takim degisebilirsiniz.! ' + IntToStr(Warnings[ID]) + '/4',Color);
  102.         if Warnings[ID] = 4 then
  103.             KickPlayer(ID);
  104.         if Warnings[ID] = 4 then
  105.             Warnings[ID] := 0;
  106.             end
  107.             else
  108.         if (Team <> 1) and (Team <> 5) then begin
  109.         if Enable = false then begin
  110.             WriteConsole(ID, 'Bravo oldun kotuye kullanma!',Color);
  111.        
  112.            
  113.  
  114.                 end;
  115.             end;
  116.         end;
  117.     end;
  118. end;
  119.  
  120. function OnCommand(ID: Byte; Text: string): boolean;
  121.  
  122. var
  123. b : byte;
  124.  
  125.     begin
  126.  
  127.         if Text = '/kapali' then begin
  128.             DisableBravo;
  129.             WriteConsole(0, 'Bravo girisleri kapatildi.',Color);
  130.             for b := 1 to 32 do if GetPlayerStat(b,'Team') = 2 then Command('/setteam1 ' + IntToStr(b));
  131.  
  132.     end
  133.  
  134.     else
  135.  
  136.         if Text = '/aktif' then begin
  137.             EnableBravo;
  138.             WriteConsole(0, 'Bravo girisleri acildi!',Color);
  139.  
  140. end;
  141.  
  142.     begin
  143.  
  144.         if Text = '/bmapharita' then begin
  145.         BravoMaps := Split(LowerCase(ReadFile('scripts/MoveTeam/bravomaps.txt')),Chr(13) + Chr(10));
  146.         WriteConsole(ID, 'Bravo haritalari yuklendi!',Color);
  147.         end;
  148.        
  149.                 begin
  150.     if Copy(lowercase(Text),0,8) = '/ekleb' then begin
  151.             if WriteLnFile('scripts/MoveTeam/bravomaps.txt',Copy(Text,10,length(Text))) then
  152.                 WriteConsole(ID, Copy(Text,11,length(Text)) + 'bravo haritalarina eklendi',Color);
  153.                 BravoMaps := Split(LowerCase(ReadFile('scripts/MoveTeam/bravomaps.txt')),Chr(13) + Chr(10));
  154.         end else
  155.             if Text = '/eklecb' then begin
  156.                 WriteLnFile('scripts/MoveTeam/bravomaps.txt','' + CurrentMap);
  157.                 WriteConsole(ID, CurrentMap + ' bravo haritalarina eklendi',Color);
  158.                 BravoMaps := Split(LowerCase(ReadFile('scripts/MoveTeam/bravomaps.txt')),Chr(13) + Chr(10));
  159.             end;
  160.         end;
  161.     end;
  162. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement