Author Topic: Alternative TKscript v1.1  (Read 9532 times)

0 Members and 1 Guest are viewing this topic.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Alternative TKscript v1.1
« on: April 17, 2007, 10:08:13 am »
Script Name: Alternative TKscript
Script Description: A drastically improved version of bmekim's TKscript, providing several vote options if a player is teamkilled
Original Author(s): bmekim, work continued by Avarax
Core Version: 2.5.4
Code:



Code Example (Showing some punishment options)
Code: [Select]
procedure OnPlayerSpeak(Name,Text: string);
var
id: integer;
begin
id := NameToId(Name);
if (Text = '!1') or (Text = '!2') or (Text = '!3') or (Text = '!4') then begin
if (killLog[id] > 0) and (voteTime[id] <> 0) then begin
if (Text = '!1') then begin
SayToPlayer(killLog[id], Name +' has forgiven you');
end
else if (Text = '!2') then begin
SayToPlayer(killLog[id], Name +' has chosen to kill you');
Command('/kill ' + inttostr(killLog[id]));
BanPoint(killLog[id]);
end
else
if (Text = '!3') then begin
  BanPoint(killLog[id]);
  case (strtoint(FormatDate('zzz')) div 50) of
    0: SayToPlayer(killLog[id],'TKers have a small penis!');
    1: SayToPlayer(killLog[id],'Trashcat is not amused!');
    2: SayToPlayer(killLog[id], IDtoName(id) + 'hates you! >:(');
    3: SayToPlayer(killLog[id],'Leo himself is coming to rape you tonight.');
    4: SayToPlayer(killLog[id],'Everytime you teamkill, god kills a kitten');
    5: SayToPlayer(killLog[id],'Teamkilling makes Boogieman haunt you.');    
    6: SayToPlayer(killLog[id],'Watch your damn fire!');
    7: Command('/say ' + IDtoName(killLog[id]) + ' has a small penis!');
    8: SayToPlayer(killLog[id],'You now have 1337/' + inttostr(banpointMax) + ' banpoints');
    9: SayToPlayer(killLog[id],'If it TKs, we can kick it!');
    10: SayToPlayer(killLog[id],'Son of a *****!');
    11: SayToPlayer(killLog[id],IDtoName(id) + ' wants your number. <3');
    12: begin SayToPlayer(killLog[id],'SURPRISE!!'); Command('/setteam5 ' + inttostr(killLog[id])); end;
    13: SayToPlayer(killLog[id],'You evil teamkilling *****!');
    14: SayToPlayer(killLog[id],'tOMFG NOOB!!1!1');
    15: SayToPlayer(killLog[id],'<(Oo)<   <(OO)>   >(oO)>');
    16: SayToPlayer(killLog[id],'Poopface.');
    17: SayToPlayer(killLog[id],'TKing leads to bans, did you know?');
    18: SayToPlayer(killLog[id],'Son of a *****!');
    19: begin SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); SayToPlayer(killLog[id],'SPAM'); end;
  end;
end
else
    begin
  If survival then begin
  SayToPlayer(killLog[id], Name +' has chosen to kill you on next respawn');
  spawnKill[killLog[id]] := 1;
  BanPoint(killLog[id]);
end;
{else begin
  SayToPlayer(killLog[id], Name +' has chosen to temporary remove you from the game');
  BanPoint(killLog[id]);
  previousteam[killLog[id]]:=IDtoTeam(killLog[id]);
  Command('/setteam5 ' + inttostr(killLog[id]));
  removetimer[killLog[id]]:=removalTime;
end;}
end;
SayToPlayer(id, 'Vote successful');
killLog[id] := 0;
voteTime[id] := 0;
end
else begin
SayToPlayer(id, 'You can not vote at the moment.');
killLog[id] := 0;
voteTime[id] := 0;
end;
end
else
  If copy(text,1,10) = '!banpoints' then
    SayToPlayer(id,'You currently have ' + inttostr(banpointCount[id]) + '/' + inttostr(banpointMax) + ' banpoints');
end;

Code Example (Showing the teambalance part)
Code: [Select]
procedure Balance(PreventLoop,pointerA,pointerB: integer);
var i: integer;
    notdone: boolean;
begin
  If PreventLoop < 33 then begin
notdone:=true;
i:=32;
If (iif(AlphaPlayers > 0,AlphaPlayers-1,AlphaPlayers) > BravoPlayers) then
  If pointerA > 0 then begin
    Command('/setteam2 ' + inttostr(lastJoinedA.e[pointerA]));
    Command('/kill ' + inttostr(lastJoinedA.e[pointerA]));
    pointerA:=pointerA-1;
    If PreventLoop = 1 then
      Command('/say Teams balanced.');
    Balance(PreventLoop+1,pointerA,pointerB);
  end
  else
    while (notdone) and (i > 0) do begin
    If IDtoTeam(i)=1 then begin      
      notdone:=false;
      Command('/setteam2 ' + inttostr(i));
      Command('/kill ' + inttostr(i));
      If PreventLoop = 1 then
        Command('/say Teams balanced.');
      Balance(PreventLoop+1,pointerA,pointerB);
    end
    else
      i:=i-1;
  end
else
If (iif(BravoPlayers > 0,BravoPlayers-1,BravoPlayers) > AlphaPlayers) then
  If pointerB > 0 then begin
    Command('/setteam1 ' + inttostr(lastJoinedB.e[pointerB]));
    Command('/kill ' + inttostr(lastJoinedB.e[pointerB]));
    pointerB:=pointerB-1;
    If PreventLoop = 1 then
      Command('/say Teams balanced.');
    Balance(PreventLoop+1,pointerA,pointerB);
  end
  else
    while (notdone) and (i > 0) do begin
    If IDtoTeam(i)=2 then begin
      notdone:=false;
      Command('/setteam1 ' + inttostr(i));
      Command('/kill ' + inttostr(i));
      If PreventLoop = 1 then
        Command('/say Teams balanced.');      
      Balance(PreventLoop+1,pointerA,pointerB);
    end
    else
      i:=i-1;
  end
    else
    begin
      for i:=1 to 32 do begin
        lastJoinedA.e[i]:=0;
        lastJoinedB.e[i]:=0;
      end;
      lastJoinedA.l:=0;
      lastJoinedB.l:=0;
    end;  
end;
end;



This script features:

-banpoint system with customizable amount of maximum banpoints and bantime
-up to four vote options for teamkill victims:

     !1 - Forgive player (No banpoint)
     !2 - Kill player now + Banpoint
     !3 - Evil random message + Banpoint
     !4 - Kill player next round + Banpoint (Survival mode only)


-recursive autoteambalance script that trys to /setteam teamunbalancers first (deactivatable in the config)


The banpoints and vote system work like this:
If a player is TKed, he is shown the three or four vote options mentioned above and gets 30 seconds to decide how to treat the TKer. Once the 30 seconds are over and the player didn't decide, the script will autoforgive the TKer.
Once a player reached the maximum banpointcount, he is banned for several minutes.
The current banpoints of each player can be viewn with "!banpoints" and are reset at the beginning of a new map. IP based saving of the banpoints is not yet featured because the OnLeaveGame procedure doesn't work correctly.

Included is a "TKconfig.ini" that has to be placed in the main server folder and contains customizable values for maximum banpoints (default = 5) and bantime (default = 20 minutes)

To install the script, simply extract it to the soldat server folder. It will not overwrite other scripts.

Get it!

Known bugs:[/color]

-Teambalance tries to /setteam and /kill a player ID who already left eons ago
-On rare occasions, the teamkill-vote pops up when a player kills an actual opponent
-The "Kill next round" sometimes triggers before the round ended (unknown reason)

The first two bugs i mentioned are (I'm pretty sure about that) probably caused by corrupt Player_Team_X variables and thus can't be fixed by me.
« Last Edit: April 17, 2007, 10:54:40 am by Avarax »
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Alternative TKscript v1.1
« Reply #1 on: April 17, 2007, 10:45:05 am »
Maybe you should remove the "Leo himself is coming to rape you tonight." sentence :P

p.s The link doesn't work  :o

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Alternative TKscript v1.1
« Reply #2 on: April 17, 2007, 10:46:38 am »
:X

nah, i'll leave it as an "easter egg", Michal M. style. :D


however Leo, you should mention with what a satisfaction you have been using this script on your server for quite some time now already :D
« Last Edit: April 17, 2007, 10:48:15 am by Avarax »
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Alternative TKscript v1.1
« Reply #3 on: April 17, 2007, 10:50:36 am »
The script is great and except from the bugs you mentioned above it works perfectly :) Thanks again for a great work :)

p.s You should fix the download link :P

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Alternative TKscript v1.1
« Reply #4 on: April 17, 2007, 10:55:15 am »
omg, that happens to me like 50% of the time when i upload something... copy+paste ftw... fixed
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline spkka

  • Camper
  • ***
  • Posts: 469
Re: Alternative TKscript v1.1
« Reply #5 on: April 17, 2007, 07:39:35 pm »
haha jus when i asked leo ;)
Thnx gr8 work!!


Date Posted: April 17, 2007, 05:57:46 PM
hmm i runned into some errors a few minutes ago..

(01:54:36) [Spkka] !stats
(01:54:37) 
  • Run-time error (OnPlayerSpeak "else if s='~' then result:=result+'%7E'"): Exception: Invalid pointer operation

(01:54:42) [Spkka] !stats
(01:54:43) 
  • Run-time error (OnPlayerSpeak "else if s='~' then result:=result+'%7E'"): Exception: Invalid pointer operation

(01:54:55) [Spkka] !stats
(01:54:55) 
  • Run-time error (OnPlayerSpeak "killLog[LeaveID] := 0;"): Exception: Access violation at address 00402921 in module 'soldatserver.exe'. Read of address 042390CC


Is it my crappy script combining?
would ya like to check attachements?

Date Posted: April 17, 2007, 08:01:53 PM
nevermind works now somehow with no errors :S
:D

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Alternative TKscript v1.1
« Reply #6 on: April 27, 2007, 01:48:34 pm »
This script only promotes TKing.

What people do (and I just had this happen to me in Avarax RS) is they will just keep shooting you provoking you to TK them so that they can do some vote against you. And if you never do then you haven't won because you have no HP - it's a lose/lose situation.

I recommend just making so that they lose twice the damage they do to you.

Or possibly provide certain vote options depending on how much damage they do to you.
« Last Edit: April 27, 2007, 01:52:53 pm by mikembm »

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Alternative TKscript v1.1
« Reply #7 on: April 28, 2007, 03:57:58 am »
that's a rather rare occasion, we expirienced on Leo's that TKs went down. there are enough honest people aswell that use "!1" in given situations. the script will be totally reworked with 2.6.0
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Alternative TKscript v1.1
« Reply #8 on: April 28, 2007, 12:13:03 pm »
You don't understand what I'm saying. If somebody knows the script is on the server and you piss them off then they will bring you to like 10% health trying to get you to TK them so they can give you ban points. And you either 1) TK them and and then you are at the wrath of their vote or 2) play every round at 10% health. This kind of thing happened with my version also in the servers it was in. It's why I will be making a new TK script if this does not address this problem.

Offline Quantifier

  • Major
  • *
  • Posts: 70
Re: Alternative TKscript v1.1
« Reply #9 on: April 28, 2007, 05:31:44 pm »
mikembm: take a look at this script. It will hopefully deal with teamhurting issue.

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Alternative TKscript v1.1
« Reply #10 on: April 28, 2007, 06:40:03 pm »
mikembm: take a look at this script. It will hopefully deal with teamhurting issue.

Yes I have seen it before and it's pretty much what I made but simpler. Like I said though - This script may reduce team killing but at the same time provokes team wounding. Fair trade off? I don't think so.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Alternative TKscript v1.1
« Reply #11 on: April 28, 2007, 06:42:21 pm »
i'll improve this script A LOT with 2.6.0, as i said before ;Q
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Alternative TKscript v1.1
« Reply #12 on: April 29, 2007, 02:44:45 am »
Doesn't work with 2.6, server doesn't start

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Alternative TKscript v1.1
« Reply #13 on: April 29, 2007, 03:48:37 am »
Doesn't work with 2.6, server doesn't start
Because this is a script for 1.3.1....

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Alternative TKscript v1.1
« Reply #14 on: April 29, 2007, 09:12:35 am »
lemme finish my RPG script first... that's all i'll spend my time on now
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Freedom

  • Major
  • *
  • Posts: 97
  • Veritas Vincit
Re: Alternative TKscript v1.1
« Reply #15 on: August 14, 2007, 01:00:28 pm »
Huh, when you fix it?
It doesn't work! (i have Soldat 1.4.2 and dedicated server 2.6.2)
Cum pare contendere anceps est, cum superiore furiosum, cum inferiore sordidum.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Alternative TKscript v1.1
« Reply #16 on: August 14, 2007, 01:10:59 pm »
Core Version: 2.5.4

fixing this script for 2.6.2 would take quite lot of work, but I believe Toumaz overworked it for the LRS servers so you might wanna ask him.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Slazenger

  • Soldier
  • **
  • Posts: 100
Re: Alternative TKscript v1.1
« Reply #17 on: February 28, 2008, 12:34:19 pm »
It doesn't work it keeps saying:
08-02-28 18:31:14 scripts -> [Error] (34:17): Unknown identifier 'Player_Team_1'
gg

Offline KeYDoN

  • Major
  • *
  • Posts: 60
Re: Alternative TKscript v1.1
« Reply #18 on: February 28, 2008, 01:02:26 pm »
try to replace the existing 'function IDtoTeam(PlayerID: integer):integer;' at lines 30-66
with this one:
Code: [Select]
function IDtoTeam(PlayerID: integer):integer;
begin
 Result:= GetPlayerStat(PlayerID,'team');
end;

Offline Slazenger

  • Soldier
  • **
  • Posts: 100
Re: Alternative TKscript v1.1
« Reply #19 on: February 28, 2008, 01:55:04 pm »
(19:54:41) 
  • [Error] tkscript -> (OnJoinTeam): Not enough parameters

I get this when I do what KeYDoN said