quinta-feira, 31 de julho de 2008

Shoot Rune when messaged

const
MinHp=400;//the script wont shoot if your hp is under this amount.(anti exhusted for uhing)
Leader='Party';// 'Party'=if player from your party says keyWord..
//'PlayerName'=if X player says keyWord..
//'0'=if any player says KeyWord.
KeyWord='attack'; // set the key word here...
RuneID=3285; // Rune ID to shooton the target
function GetCreatureByName(Name: string): TCreature;
var
x: integer;
begin
Result := nil;
for x := 0 to Creatures.Count - 1 do
begin
if x >= Creatures.Count then Break;
if Creatures.Creature[x].Name = Name then
begin
Result := Creatures.Creature[x];
Exit;
end;
end;
end;
procedure Attack(Name:string);
var
Player:TCreature;
x:integer;
begin
updateworld;
Player:=GetCreatureByName(Name);
if player<> nil then
if Self.Health>MinHp then
begin
Self.Containers.UseItemWithCreature(RuneID, Player);
updateworld;
end
else self.DisplayText('Player '+Name+ ' was not found');
end;

procedure Event_Message(Channel: integer; Name, Text: String);
var
b,Target:string;
OK:boolean;
begin
OK:=False;
updateworld;
Case Leader of

'Party':begin
Creature:=GetCreatureByName(Name);
if Creature<>nil then
if Creature.PartyMember=true then OK:=true; end;
'0':begin OK:=true; end;

Name:begin OK:=true; end;
end;
if OK then
begin
updateworld;
b:=Text;
if Pos(KeyWord, b)<>0 then
begin
Delete(b, 1, length(KeyWord)+1);
Target:=b;
Attack(Target);
end;
end;
OK:=false;
end;

begin
while not terminated do
begin
processEvents;
sleep(100);
end;
end;

0 Comments: