Author Topic: Random Passworder  (Read 4792 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Random Passworder
« on: July 05, 2007, 04:52:38 pm »
Script Name: Random Passworder
Script Description: Used for public private servers, if that makes any sense... When the server is empty, the server is available to use from the public (not passworded), where as there is a public command to add a random password to the server (!setpassword), and is announced in the server. The server is then usable for a scrimmage or clan war. Server owners don't even have to worry about them leaving the password on, it is automatically taken off if there is nobody in the server. But in case the password wants to be taken down and wanting to stay in the server, there is a command to get rid of the password (!delpassword).
Original Author: Curt
Core Version: 2.6.2
Code:
Code: [Select]
const
  PassLength = 6;
  PassType = 4;
  Color = $FFFFFF;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  if NumPlayers = 1 then Command('/password');
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
var
  PassChr: integer;
  PassBuild: string;
begin
  if Text = '!setpassword' then begin
    while Length(PassBuild) < PassLength do begin
      PassChr := Random(33,127);
      Case PassType of
        2: if (PassChr <= 47) or ((PassChr >= 58) and (PassChr <= 96)) or (PassChr >= 123) then PassChr := 0;
        3: if (PassChr <= 47) or ((PassChr >= 58) and (PassChr <= 64)) or ((PassChr >= 91) and (PassChr <= 96)) or (PassChr >= 123) then PassChr := 0;
        4: begin
          PassChr := Random(1,3);
          Case PassChr of
            1: PassChr := Random(48,58);
            2: PassChr := Random(97,123);
          end;
        end;
        5: begin
          PassChr := Random(1,4);
          Case PassChr of
            1: PassChr := Random(48,58);
            2: PassChr := Random(65,91);
            3: PassChr := Random(97,123);
          end;
        end;
      end;
      if PassChr <> 0 then PassBuild := PassBuild + Chr(PassChr);
    end;
    Command('/password ' + PassBuild);
    WriteConsole(0,'The password has been changed to: ' + PassBuild,Color);
  end else if Text = '!delpassword' then begin
    Command('/password');
    WriteConsole(0,'The password has been reset.',Color);
  end;
end;

Constants
When PassType is...
1 - even chance for all basic characters
2 - even chance for 0-9, a-z
3 - even chance for 0-9, a-z, A-Z
4 - 1/2 chance for 0-9 or a-z; which then its evenly random
5 - 1/3 chance for 0-9, A-Z, or a-z; which then its evenly random
« Last Edit: September 07, 2007, 06:41:39 pm by DorkeyDear »

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Random Passworder
« Reply #1 on: July 05, 2007, 05:01:32 pm »
I really don't understand the need for pass type. It's random so a simple string of just numbers would be the easiest to remember for the people in the server.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Random Passworder
« Reply #2 on: July 05, 2007, 05:46:38 pm »
just for what the server owner prefers.. i had spare time and wanted more of a choice of what kind of password the server owner wanted.

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Random Passworder
« Reply #3 on: July 15, 2007, 11:48:35 am »
This is a very useful idea!  I would just put it down to 3 lettered password.  And isn't it bad that anyone can do !delpassword ?  Also, let there be a !password command that writes the password in the console so that they can see it later.  Perhaps it'd be better not to use capital letters as that might confuse people.  Hopefully l (LC L) isnt' confused with 1 (#) or I (UC i).  But this is very useful.
Can't think of anything original to put here...

Offline Cappy

  • Flagrunner
  • ****
  • Posts: 629
Re: Random Passworder
« Reply #4 on: July 16, 2007, 06:58:19 pm »
Thats what I do, just change it to some random pass then change it back to the one only your members know.

[DE] ~ ~ ~

Offline Coolio

  • Camper
  • ***
  • Posts: 320
  • Well cya all.
Re: Random Passworder
« Reply #5 on: July 17, 2007, 11:27:28 pm »
It could be useful.
BANNED

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Random Passworder
« Reply #6 on: July 18, 2007, 11:12:01 am »
I'm taking this one step further for clans XD
It'll be based on this idea but much much better!
Can't think of anything original to put here...

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Random Passworder
« Reply #7 on: July 18, 2007, 04:26:58 pm »
I'm taking this one step further for clans XD
It'll be based on this idea but much much better!
More info would be nice. <3

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Random Passworder
« Reply #8 on: July 18, 2007, 06:20:20 pm »
Dorky you make way too many scripts, Im using 2 of your others alredy, now your making me use a Third??? O.o

Anyways very nice, It would be kinda easier to just type like /password teamkill or something but I <3 this.

Iq Unlimited

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Random Passworder
« Reply #9 on: July 18, 2007, 06:40:10 pm »
Dorky you make way too many scripts, Im using 2 of your others alredy, now your making me use a Third??? O.o

Anyways very nice, It would be kinda easier to just type like /password teamkill or something but I <3 this.

Iq Unlimited
its for like.. non-admins .. a public private server, so anybody can use the server for private use.

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Random Passworder
« Reply #10 on: July 18, 2007, 10:03:53 pm »
ah, so its like a free 2 use cw server. Neato.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Random Passworder
« Reply #11 on: September 07, 2007, 06:35:46 pm »
Update:
  • Rewrote the code sense the old code here was bugged and new way was much easier for me to understand
  • Made a zip and stuff for 2.6.2

Offline eca jezza

  • Major(1)
  • Posts: 37
  • {+ECA+} is recruiting!
    • {+ECA+}
Re: Random Passworder
« Reply #12 on: September 09, 2007, 12:56:08 pm »
What program do you need to use that sort of script?

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Random Passworder
« Reply #13 on: September 09, 2007, 05:27:24 pm »
What program do you need to use that sort of script?
All you need is the server directory with contents of 2.6.2 dedicated server, and extracting the folder inside the zip into the scripts folder.

Offline eca jezza

  • Major(1)
  • Posts: 37
  • {+ECA+} is recruiting!
    • {+ECA+}
Re: Random Passworder
« Reply #14 on: September 09, 2007, 11:47:18 pm »
soldat server 2.6.2? i thought you'd use ESA... which ones better???

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Random Passworder
« Reply #15 on: September 10, 2007, 04:30:22 pm »
I'm confused ^^
Whats ESA? :P
All I know is that I don't actually compile my scripts with an actual separate program, and Soldat Dedicated Server does it for me and makes it work within the server or whatever.
I may not be the guy to answer your question :)

Offline PKS|Shooter

  • Soldier
  • **
  • Posts: 130
  • Dont fuck with us!
    • PKS - La Familia
Re: Random Passworder
« Reply #16 on: November 15, 2007, 03:53:21 pm »
GJ nice Script ^^

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Random Passworder
« Reply #17 on: November 16, 2007, 07:04:18 pm »
cool idea,

so many little but useful scripts being made :P
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs