const
WeaponId = 3277; // Spear = 3277
WeaponOz = 20; // Spear = 20
AlertAmount = 5;
TimeWait = 3;
SoundNoWeapon = 'C:\Windows\Media\Windows XP Battery Critical.wav';
AlertSound = 'C:\Windows\Media\Windows XP Battery Critical.wav';
procedure Notify(Sound : String);
begin
if (Pos('.wav', AlertSound) <> 0) then PlaySound(AlertSound);
if (Pos('.wav', Sound) <> 0) then PlaySound(Sound);
end;
procedure CheckForWeapon;
var QtyMove : integer;
var QtyItems : integer;
var HasWeapons : boolean;
begin
QtyMove := 0;
HasWeapons := true;
if Self.LeftHand.Amount <= AlertAmount then
begin
sleep(TimeWait * 1000);
if Self.LeftHand.Amount <= AlertAmount then
begin
HasWeapons := false;
for x := 0 to Self.Containers.Count - 1 do
begin
if HasWeapons then Break;
if Self.Containers.Container[x].Count - 1 then
begin
for y := 0 to Self.Containers.Container[x].Count - 1 do
begin
if Self.Containers.Container[x].Item[y].ID = WeaponId then
begin
QtyItems := Abs(Self.Capacity / WeaponOz);
if QtyItems >= 1 then
begin
if Self.Containers.Container[x].Item[y].Amo
else QtyMove := Self.Containers.Container[x].Item[y].Amo
QtyMove := QtyMove - 1;
if QtyMove then
begin
Self.Containers.Container[x].Item[y].Mov
HasWeapons := true;
Break;
end;
end;
end;
end;
end;
end;
end;
end;
if not HasWeapons then Notify(SoundNoWeapon);
end;
begin
while not Terminated do
begin
UpdateWorld;
CheckForWeapon;
sleep(1000);
end;
end;
0 comentários | COMENTE AQUI!!! :
Postar um comentário