Author Topic: [Solved] Script Request - Temporary Bot  (Read 2733 times)

0 Members and 1 Guest are viewing this topic.

Offline Beoulve

  • Major(1)
  • Posts: 33
[Solved] Script Request - Temporary Bot
« on: June 25, 2010, 10:15:05 pm »
I was wondering if someone could make a script that allows me to add a bot to my server when a player joins just until someone else joins then it automatically gets kicked. I've seen this done before and I want one for my server. And also, if you could make it so a message appears when the bot joins that says something like "This is [insert name here], he will only stay until someone else joins".

Thanks in advance.

And sorry if this is in the wrong topic, this is my first time posting something.. lol
« Last Edit: June 29, 2010, 01:32:24 pm by Beoulve »

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Script Request
« Reply #1 on: June 26, 2010, 04:20:35 am »
Code: [Select]
var
  Bot: byte;

procedure OnJoinTeam(ID, Team: byte);
begin
  if (Team = 1) or (Team = 2) then begin
    if NumPlayers = 1 then begin
      Bot:= Command('/addbot' + iif(Team = 1,'2','1') + ' ' + RandomBot());
      WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
    end else if GetPlayerStat(Bot,'Active') = true then KickPlayer(Bot);
  end;
end;
Should work.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script Request
« Reply #2 on: June 26, 2010, 09:53:35 am »
Reminds me of my lonesome self fixer, which may have been bugged, and is probably out dated now and not working. If, for whatever reason, the code the Gizd provided does not work, you can search for mine, but I really doubt mine will work.

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: Script Request
« Reply #3 on: June 26, 2010, 11:48:47 am »
Code: [Select]
var
  Bot: byte;

procedure OnJoinTeam(ID, Team: byte);
begin
  if (Team = 1) or (Team = 2) then begin
    if NumPlayers = 1 then begin
      Bot:= Command('/addbot' + iif(Team = 1,'2','1') + ' ' + RandomBot());
      WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
    end else if GetPlayerStat(Bot,'Active') = true then KickPlayer(Bot);
  end;
end;
Should work.

Um.. It kind of works.. lol. When i join, the bot does come up and so does the message, but when I leave the server, the bot stays. If i join the server again, the bot gets kicked. Can you make it so if there is no one in the server the bot also gets kicked? And if you could also make it add a bot named "Envy" instead of a random bot. I already have the Envy.bot file.

Sorry if im asking for too much :x lol.
« Last Edit: June 26, 2010, 11:52:30 am by Beoulve »

Offline Bonecrusher

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1397
  • High above
    • Zabijaka.pl
Re: Script Request
« Reply #4 on: June 26, 2010, 12:48:18 pm »
could also make it add a bot named "Envy" instead of a random bot. I already have the Envy.bot file.

Bot:= Command('/addbot Envy' + iif(Team = 1,'2','1') + ' ' + RandomBot());

this should do the job

Im chill like that

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Script Request
« Reply #5 on: June 26, 2010, 12:54:42 pm »
yeah, his code currently doesn't account for player leaving (which you didn't ask for :P)
here try this:
var
  Bot: byte;

Code: [Select]
procedure BotFriend();
begin
  if AlphaPlayers + BravoPlayers = 1 then begin
    Bot:= Command('/addbot' + iif(AlphaPlayers = 1,'2','1') + ' ' + RandomBot());
    WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
  end else if GetPlayerStat(Bot,'Active') = true then KickPlayer(Bot);
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  BotFriend();
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  BotFriend();
end;

this fixes 2 things:  1) he didn't have code for if the player leaves - 2) he didn't have code for if the player changes teams to Spectator
also note:
this code will disregard players on charlie or delta
this code might mess up if one bot is placed in server when the server initializes
Can't think of anything original to put here...

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: Script Request
« Reply #6 on: June 26, 2010, 12:56:29 pm »
could also make it add a bot named "Envy" instead of a random bot. I already have the Envy.bot file.

Bot:= Command('/addbot Envy' + iif(Team = 1,'2','1') + ' ' + RandomBot());

this should do the job

Doesn't work. It says "Bot file Envy1 Sniper not found". :[

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Script Request
« Reply #7 on: June 26, 2010, 01:07:45 pm »
Code: [Select]
Bot:= Command('/addbot' + iif(Team = 1,'2','1') + ' Envy');

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: Script Request
« Reply #8 on: June 26, 2010, 01:34:41 pm »
yeah, his code currently doesn't account for player leaving (which you didn't ask for :P)
here try this:
var
  Bot: byte;

Code: [Select]
procedure BotFriend();
begin
  if AlphaPlayers + BravoPlayers = 1 then begin
    Bot:= Command('/addbot' + iif(AlphaPlayers = 1,'2','1') + ' ' + RandomBot());
    WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
  end else if GetPlayerStat(Bot,'Active') = true then KickPlayer(Bot);
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  BotFriend();
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  BotFriend();
end;

this fixes 2 things:  1) he didn't have code for if the player leaves - 2) he didn't have code for if the player changes teams to Spectator
also note:
this code will disregard players on charlie or delta
this code might mess up if one bot is placed in server when the server initializes

Thanks for the script. But when I leave the server, instead of just kicking the bot once i keep getting this.
Code: [Select]
(14:30:26) Danko has been kicked.
(14:30:26) Danko has been kicked.
(14:30:26) Danko has been kicked.
(14:30:26) Danko has been kicked.
(14:30:26) Danko has been kicked.
(14:30:26) Danko has been kicked.
(14:30:26) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:27) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:28) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:29) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:30) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:31) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:32) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:33) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:34) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:35) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:36) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:37) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:38) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:39) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:40) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:41) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:42) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:43) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:44) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:45) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:46) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:47) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:48) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:49) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:50) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:51) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:52) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:53) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:54) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:55) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:56) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:57) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:58) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:30:59) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:00) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:01) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:02) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:03) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:04) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:05) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:06) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:07) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:08) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:09) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:10) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:11) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:12) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:13) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:14) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:15) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.
(14:31:16) Danko has been kicked.

If i join again before the bot is kicked, my ARSSE freezes and I have to restart it. Do you know why this is? =\

Other than that, it works great. lol

From: June 26, 2010, 01:38:57 pm
Code: [Select]
Bot:= Command('/addbot' + iif(Team = 1,'2','1') + ' Envy');

This didn't work either, but thanks for trying. :p
« Last Edit: June 26, 2010, 01:38:57 pm by Beoulve »

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Script Request
« Reply #9 on: June 26, 2010, 09:05:34 pm »
HEY done!
this took me longer than expected - haven't done scripting in over a year or so, so this was a good way to get back (can't wait till new version comes out!)
anyway here's the script:

Code: [Select]
// Adds bot named "Envy" in team-games when someone is on alpha or bravo, and no opponent in bravo or alpha respectively.

var
  BotTeam,Bot: byte;
 
procedure ActivateServer();
begin
  Bot := 0;
  BotTeam := 0
end;

procedure OnJoinTeam(ID, Team: byte);  // player joins team prior to procedure
begin
if (ID <> Bot) then begin
if (Bot = 0) and (AlphaPlayers + BravoPlayers = 1) then begin
BotTeam := iif(AlphaPlayers = 1,2,1)
Bot := Command('/addbot' + inttostr(BotTeam) + ' Envy');
WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
end else begin
if (AlphaPlayers = 2) and (BravoPlayers = 0) then begin
BotTeam := 2;
Command('/setteam' + inttostr(BotTeam) + ' ' + inttostr(Bot));
end else if (AlphaPlayers = 0) and (BravoPlayers = 2) then begin
BotTeam := 1;
Command('/setteam' + inttostr(BotTeam) + ' ' + inttostr(Bot));
end else if (AlphaPlayers = 1) and (BravoPlayers = 1) then begin
KickPlayer(Bot);
Bot := 0;
end else if (AlphaPlayers + BravoPlayers = 1) then begin
KickPlayer(Bot);
Bot := 0;
end;
end;
end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);  // player leaves game after procedure
begin
if (ID <> Bot) then begin
if ((Team = 1) or (Team = 2)) then begin
if AlphaPlayers + BravoPlayers = 2 then begin
if Bot = 0 then begin
BotTeam := iif(Team = 1,1,2)
Bot := Command('/addbot' + inttostr(BotTeam) + ' Envy');
WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
end else begin
KickPlayer(Bot);
Bot := 0;
end;
end;
end;
end;
end;

This takes care of everything.
If alpha player is playing against bravo bot, and the player joins bravo, bot joins alpha.
If alpha player is playing against bravo bot, and the player joins charlie/delta/spectator, bot leaves
Bot leaves when no one in server.
Joining Bot is Envy (you must have such bot file, or no bot gets added)
and everything else too!
;)
« Last Edit: June 26, 2010, 09:12:18 pm by zyxstand »
Can't think of anything original to put here...

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: Script Request
« Reply #10 on: June 26, 2010, 09:56:41 pm »
HEY done!
this took me longer than expected - haven't done scripting in over a year or so, so this was a good way to get back (can't wait till new version comes out!)
anyway here's the script:

Code: [Select]
// Adds bot named "Envy" in team-games when someone is on alpha or bravo, and no opponent in bravo or alpha respectively.

var
  BotTeam,Bot: byte;
 
procedure ActivateServer();
begin
  Bot := 0;
  BotTeam := 0
end;

procedure OnJoinTeam(ID, Team: byte);  // player joins team prior to procedure
begin
if (ID <> Bot) then begin
if (Bot = 0) and (AlphaPlayers + BravoPlayers = 1) then begin
BotTeam := iif(AlphaPlayers = 1,2,1)
Bot := Command('/addbot' + inttostr(BotTeam) + ' Envy');
WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
end else begin
if (AlphaPlayers = 2) and (BravoPlayers = 0) then begin
BotTeam := 2;
Command('/setteam' + inttostr(BotTeam) + ' ' + inttostr(Bot));
end else if (AlphaPlayers = 0) and (BravoPlayers = 2) then begin
BotTeam := 1;
Command('/setteam' + inttostr(BotTeam) + ' ' + inttostr(Bot));
end else if (AlphaPlayers = 1) and (BravoPlayers = 1) then begin
KickPlayer(Bot);
Bot := 0;
end else if (AlphaPlayers + BravoPlayers = 1) then begin
KickPlayer(Bot);
Bot := 0;
end;
end;
end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);  // player leaves game after procedure
begin
if (ID <> Bot) then begin
if ((Team = 1) or (Team = 2)) then begin
if AlphaPlayers + BravoPlayers = 2 then begin
if Bot = 0 then begin
BotTeam := iif(Team = 1,1,2)
Bot := Command('/addbot' + inttostr(BotTeam) + ' Envy');
WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
end else begin
KickPlayer(Bot);
Bot := 0;
end;
end;
end;
end;
end;

This takes care of everything.
If alpha player is playing against bravo bot, and the player joins bravo, bot joins alpha.
If alpha player is playing against bravo bot, and the player joins charlie/delta/spectator, bot leaves
Bot leaves when no one in server.
Joining Bot is Envy (you must have such bot file, or no bot gets added)
and everything else too!
;)

Woah thanks a bunch! Script works perfectly! :]

edit:

Um.. ok, so 2 ppl joined my server and it turns out the bot doesn't leave when another player joins... only when there are no players in the game. T_T
« Last Edit: June 26, 2010, 11:52:20 pm by Beoulve »

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Script Request
« Reply #11 on: June 27, 2010, 01:47:22 am »
haha sorry didn't test for that. this should (finally) be it.
Note: First player joins Alpha. Bot joins Bravo. If a new player also joins Alpha (and Bravo Bot gets kicked) that player will be put on Bravo automatically. To remove this feature open script in notepad and make a search for "Balances" and read!

Code: [Select]
// Adds bot named "Envy" in team-games when someone is on alpha or bravo, and no opponent in bravo or alpha respectively.

var
  BotTeam,Bot: byte;
 
procedure ActivateServer();
begin
  Bot := 0;
  BotTeam := 0
end;

procedure OnJoinTeam(ID, Team: byte);  // player joins team prior to procedure
begin
if (ID <> Bot) then begin
if (Bot = 0) and (AlphaPlayers + BravoPlayers = 1) then begin
BotTeam := iif(AlphaPlayers = 1,2,1)
Bot := Command('/addbot' + inttostr(BotTeam) + ' Envy'); // ' Envy' or ' ' + RandomBot()
WriteLn('FriendBot ' + IDToName(Bot) + ' added.');
WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
end else begin
if (AlphaPlayers = 2) and (BravoPlayers = 0) and (BotTeam = 1) then begin
BotTeam := 2;
Command('/setteam2 ' + inttostr(Bot));
end else if (AlphaPlayers = 0) and (BravoPlayers = 2) and (BotTeam = 2) then begin
BotTeam := 1;
Command('/setteam1 ' + inttostr(Bot));
end else if (AlphaPlayers + BravoPlayers > 2) then begin
KickPlayer(Bot);
Bot := 0;

// Balances Alpha and Bravo - to take out, simply put  //  in front:
if (Team = iif(BotTeam=1,2,1)) then Command('/setteam' + inttostr(BotTeam) + ' ' + inttostr(ID));

end else if (AlphaPlayers + BravoPlayers = 1) then begin
KickPlayer(Bot);
Bot := 0;
end;
end;
end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);  // player leaves game after procedure
begin
if (ID <> Bot) then begin
if ((Team = 1) or (Team = 2)) then begin
if AlphaPlayers + BravoPlayers = 2 then begin
if Bot = 0 then begin
BotTeam := iif(Team = 1,1,2)
Bot := Command('/addbot' + inttostr(BotTeam) + ' Envy'); // ' Envy' or ' ' + RandomBot()
WriteLn('FriendBot ' + IDToName(Bot) + ' added.');
WriteConsole(0,'Say hello to ' + IDToName(Bot) + ', he will keep you entertained until someone else joins.',$AAAA00);
end else begin
KickPlayer(Bot);
Bot := 0;
end;
end;
end;
end;
end;
Can't think of anything original to put here...

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: Script Request
« Reply #12 on: June 27, 2010, 09:22:57 am »
haha sorry didn't test for that. this should (finally) be it.

lol np.

Thanks for everything. I'll go test it out in a bit and tell you if it works. lol ;P

edit:

Script is still bugged. Whenever someone tries to join bravo now, it automatically sends them to alpha, so teams are uneven. :[ lol
« Last Edit: June 27, 2010, 05:22:45 pm by Beoulve »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Script Request
« Reply #13 on: June 29, 2010, 07:23:39 am »
You don't need script for that. Just set BotBalanceTeams=1 in server.ini and done.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: Script Request
« Reply #14 on: June 29, 2010, 11:40:27 am »
Sorry, script works fine. I just had to disable the balance part of the script you were talking about so it wouldn't automatically send everyone to one team.

Note: First player joins Alpha. Bot joins Bravo. If a new player also joins Alpha (and Bravo Bot gets kicked) that player will be put on Bravo automatically. To remove this feature open script in notepad and make a search for "Balances" and read!


Code: [Select]
// Balances Alpha and Bravo - to take out, simply put  //  in front:
// if (Team = iif(BotTeam=1,2,1)) then Command('/setteam' + inttostr(BotTeam) + ' ' + inttostr(ID));


Works perfectly now. :D

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: [Solved] Script Request - Temporary Bot
« Reply #15 on: June 30, 2010, 01:32:56 pm »
Here you can find a proper version of the requested script.

Offline Beoulve

  • Major(1)
  • Posts: 33
Re: [Solved] Script Request - Temporary Bot
« Reply #16 on: June 30, 2010, 03:00:12 pm »
Here you can find a proper version of the requested script.

Thanks a lot, but zyxstand's script is working just fine. :)