Author Topic: BotScripts help  (Read 728 times)

0 Members and 1 Guest are viewing this topic.

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
BotScripts help
« on: November 10, 2007, 05:02:33 pm »
these are some more scripts from me, but they don't do what I want them to, all they do is say the Writeconsole parts, (as if the KickBot procedures worked) and seemingly forget to kick the bots

Code: [Select]
procedure KickBot();
var
  i: byte;
begin
  for i:=1 to NumPlayers do begin
    if not GetPlayerStat(i,'Active') then continue;
    if GetPlayerStat(i,'Human') then continue else
    try
    KickPlayer(i)
    except
    WriteLn('KickBot failed, Unknown exception.');
    end;
  end;
end;

procedure KickBotByName(const Name: string);
var
  i: byte;
begin
  for i:=1 to NumPlayers do begin
    if not GetPlayerStat(i,'Active') then continue;
    if GetPlayerStat(i,'Human') then continue else
    if GetPlayerStat(i,'Name') = Name then
    try
    KickPlayer(i)
    except
    WriteLn('KickBotByName failed, Unknown exception.');
    end;
  end;
end;

function OnCommand(ID:Byte;Text:string):boolean;
var
  str: string;
begin
  result:=false;
  Case LowerCase(Text) of
    '/kickbot': begin
      try
      KickBot()
      WriteConsole(ID,'All bots kicked.',$FF22FF22)
      except
      WriteConsole(ID,'KickBot failed, Unknown exception.',$FFFF2222);
      end;
    end;
    '/kickbotname': begin
      str:=Text;
      Delete(str,1,13);
      try
      KickBotByName(str)
      WriteConsole(ID,'All '+str+' bots kicked.',$FF22FF22)
      except
      WriteConsole(ID,'KickBot failed, Unknown exception.',$FFFF2222);
      end;
    end;
  end;
end;

P.S. they do compile
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: BotScripts help
« Reply #1 on: November 10, 2007, 08:08:32 pm »
You have to use if GetPlayerStat(etc) = true then

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: BotScripts help
« Reply #2 on: November 11, 2007, 09:08:49 am »
You have to use if GetPlayerStat(etc) = true then
(with things that result variant; i believe it works with anything else though)