Author Topic: "Jail" Script  (Read 3882 times)

0 Members and 6 Guests are viewing this topic.

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
"Jail" Script
« on: June 13, 2008, 07:52:11 pm »
Script Name:  Imprison Script by Iq Unlimited
Script Description: /imprison <ID> <Time of Imprisonment in seconds> sticks a player into spectator and gmutes them for a set amount of time in seconds. "prisoners" can not leave spectator or the script sets them back and if they leave the server they get banned.[/b]
Original Author(s): Iq Unlimited
Core Version:
 The latest one?
Code:
Code: [Select]
procedure AppOnIdle(Ticks: integer);
var
 i: integer;
begin
for i := 1 to 12 do
  if prisontime[i] > 0 then begin
    prisontime[i] := prisontime[i] - 1;
  end else if prisontime[i] = 0 then begin
    if prisonerbool[i] = true then begin
      prisonerbool[i] := false;
      Command('/ungmute ' + inttostr(prisonerint[i]));
      WriteConsole(prisonerint[i],'You are now free!',Color);
WriteConsole(0, GetPlayerStat(prisoner, 'Name') + ' has been freed!',Color);
    end;
  end;
end;


function OnCommand(ID: Byte; Text: string): boolean;
begin
if (GetPiece(Text, ' ', 0)) = '/imprison' then begin
  if (GetPiece(Text, ' ', 1)) <> '' then begin
    if strtoint((GetPiece(Text, ' ',1))) < maxedplayers then begin
      prisoner := StrToInt(GetPiece(Text, ' ', 1));
      prisonerint[prisoner] := StrToInt(GetPiece(Text, ' ', 1));
      prisonerbool[prisoner] := true;
      Command('/setteam5 ' + (GetPiece(Text, ' ', 1)));
      Command('/gmute ' + (GetPiece(Text, ' ', 1)));
        if (GetPiece(Text, ' ', 2)) <> '' then begin
          prisontime[prisoner] := StrToInt((GetPiece(Text, ' ', 2)));
        end else prisontime[prisoner] := defaulttime;
      WriteConsole(0,' ' + GetPlayerStat(prisoner, 'Name') + ' has been sent to jail for ' + inttostr(prisontime[prisoner]) + ' seconds.',Color);
      WriteConsole(prisonerint[prisoner],'You are now a prisoner for the next ' + inttostr(prisontime[prisoner]) + ' seconds.',Color);
    end else WriteConsole(ID, 'Invalid Integer put one in below ' + inttostr(maxedplayers) + '.',Color);
  end else WriteConsole(ID, 'You forgot to put in the target person',Color);
end;
if (GetPiece(Text, ' ',0)) = '/free' then begin
  if (GetPiece(Text, ' ',1)) <> '' then begin
    prisoner := StrToInt(GetPiece(Text, ' ', 1));
      if prisonerbool[prisoner] = true then begin
prisontime[prisoner] := 0;
        Command('/ungmute ' + (GetPiece(Text, ' ', 1)));
      end else WriteConsole(ID, 'Target player is not a prisoner',Color);
  end else WriteConsole(ID, 'You forgot to put in the target person',Color);
end;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
teamswap[ID] := teamswap[ID] + 1;
  if prisonerbool[ID] = true then begin
    if (GetPlayerStat(ID,'Team')) <> 5 then begin
      Command('/setteam5 ' +inttostr(ID));
    end;
  end;
  if teamswap[ID] > 10 then begin
    Command('/ban ' + inttostr(ID));
  end;
end;

procedure OnLeaveGame(ID, Team: byte;Kicked: boolean);
begin
 teamswap[ID] := 0;
 if prisonerbool[ID] = true then begin
  Command('/banip ' + GetPlayerStat(ID, 'IP'));
 end;
end;

PS: I've hardly ever tested this and the code is incredably messy (my bad habits shine all over this thing), so if you find any errors or don't like how i've scripted this and think you can do it better tell me.


Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: "Jail" Script
« Reply #1 on: June 14, 2008, 03:56:14 am »
Quote from Danmer: " And how is this useful?! "

No really, i wanted to make somekind of this script sometime ago but u were faster.
(but i dont think that ppl wants to just spec the game silently, so they would just leave o.O' )
Also Known As REIMA


Lol Happles (happy apples)

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: "Jail" Script
« Reply #2 on: June 14, 2008, 12:23:09 pm »
If they leave they get banned. Unless you abuse this and put like 999999 seconds or something you can just use it as a warning tool, at least, thats what I'm using it for.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: "Jail" Script
« Reply #3 on: June 14, 2008, 01:05:20 pm »
Suggestion: instead of banning the player when they leave.. make it so when their ip rejoins, they are auto reimprisoned

Offline UnknownSniper

  • Camper
  • ***
  • Posts: 428
  • Southern by the Grace of God
Re: "Jail" Script
« Reply #4 on: June 14, 2008, 01:38:03 pm »
Suggestion: instead of banning the player when they leave.. make it so when their ip rejoins, they are auto reimprisoned


Wouldn't work well for Dynamic IP or players who share computers. :p
I had a job and a piece of land
My sweet wife was my best friend
But I traded that for Cocaine and a whore
-Jamey Johnson


Offline Caphriel

  • Major(1)
  • Posts: 3
Re: "Jail" Script
« Reply #5 on: June 14, 2008, 01:43:30 pm »
Wouldn't work well for Dynamic IP or players who share computers. :p

It would work exactly as well as an IP ban.

Offline SniperTheKiller

  • Major
  • *
  • Posts: 84
Re: "Jail" Script
« Reply #6 on: June 16, 2008, 06:01:05 pm »
Suggestion: instead of banning the player when they leave.. make it so when their ip rejoins, they are auto reimprisoned



Wouldn't work well for Dynamic IP or players who share computers. :p
'dnt ban not work too then?
I like the idea, just make it when they leave and rejoin, they get spectated..

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: "Jail" Script
« Reply #7 on: June 16, 2008, 10:26:00 pm »
Suggestion: instead of banning the player when they leave.. make it so when their ip rejoins, they are auto reimprisoned

'dnt ban not work too then?

Wouldn't work well for Dynamic IP or players who share computers. :p
Quote

Wouldn't work well for Dynamic IP or players who share computers. :p

It would work exactly as well as an IP ban.

Do you two even know what a Dynamic IP is? Of course it won't work on dynamic IPers unless I had it subnet ban them, which wouldn't be very nice to the other people with that same subnet.
« Last Edit: June 16, 2008, 10:27:35 pm by Iq Unlimited »

Offline UnknownSniper

  • Camper
  • ***
  • Posts: 428
  • Southern by the Grace of God
Re: "Jail" Script
« Reply #8 on: June 16, 2008, 10:53:05 pm »
Suggestion: instead of banning the player when they leave.. make it so when their ip rejoins, they are auto reimprisoned

'dnt ban not work too then?

Wouldn't work well for Dynamic IP or players who share computers. :p
Quote

Wouldn't work well for Dynamic IP or players who share computers. :p

It would work exactly as well as an IP ban.

Do you two even know what a Dynamic IP is? Of course it won't work on dynamic IPers unless I had it subnet ban them, which wouldn't be very nice to the other people with that same subnet.

I'm on crap Dial-up, Ofcourse I know what Dynamic IP is. =p

And Hi, Iq Unlimited, It's Big Dick Johnson! from TW.  :P
I had a job and a piece of land
My sweet wife was my best friend
But I traded that for Cocaine and a whore
-Jamey Johnson


Offline RuL3zZ

  • Major(1)
  • Posts: 3
    • .:eX# |Clan:.
Re: "Jail" Script
« Reply #9 on: June 17, 2008, 11:15:45 am »
Master Script! WoW Thank u I use it know for this persons that cry to much! Thanks..!