Author Topic: Mine setting script (need helpz)  (Read 890 times)

0 Members and 1 Guest are viewing this topic.

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Mine setting script (need helpz)
« on: September 30, 2007, 06:53:03 pm »
crap, nevermind, I fixed it, heres the code in case you want it... (unfinished tho, will b out of date soon, too)

Code: [Select]
var
  MineA, Active: array[1..32] of boolean;
  Temp: array[1..10] of variant;
  MineX, MineY: array[1..32] of single;

procedure OnJoinGame(ID, Team: byte);
begin
  MineA[ID]:=false;
  Active[ID]:=true;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  if MineA[ID] = true then MineA[ID]:=false;
  if Active[ID] = false then Active[ID]:=true;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  if MineA[ID] = true then MineA[ID]:=false;
end;

function OnCommand(ID: byte; Text: string):boolean;
begin
  Result:=false;
  if GetPiece(LowerCase(Text), ' ', 0) = '/mines' then begin
    Temp[1]:=GetPiece(LowerCase(Text), ' ', 1);
    if Temp[1] = 'off' then DisableScript:=true;
    if Temp[1] = 'on' then DisableScript:=false;
  end;
end;

function OnPlayerCommand(ID: Byte; Text: string):boolean;
begin
  Result:=false;
  if GetPiece(LowerCase(Text), ' ', 0) = '/mine' then begin
    Temp[1]:=GetPiece(LowerCase(Text), ' ', 1);
    Temp[2]:=GetPiece(LowerCase(Text), ' ', 2);
    if (Temp[1] = 'set') then begin
//-----Set Mine-----
      SayToPlayer(ID,'Mine set and Active');
      Active[ID]:=true;
      MineX[ID]:=GetPlayerStat(ID,'X');
      MineY[ID]:=GetPlayerStat(ID,'Y');
      MineA[ID]:=true;
    end;
  end;
end;

procedure AppOnIdle(Ticks: integer);
var
  i, j: integer;
  X, Y: array[1..32] of single;
begin
  for j:=1 to 32 do if Active[j] then begin
  for i:=1 to 32 do begin
    X[i]:=GetPlayerStat(i,'X');
    Y[i]:=GetPlayerStat(i,'Y');
    if (X[i] > MineX[j]-50) and (X[i] < MineX[j]+50) and
    (Y[i] > MineY[j]-50) and (Y[i] < MineY[j]+50) and
    (j <> i) then begin
      CreateBullet(X[i],Y[i],0,0,100,4,j)
      DoDamage(i,4444)
      SayToPlayer(j,'Killed '+GetPlayerStat(i,'name')+' with Mine');
    end;
  end;
  end;
end;


Date Posted: September 30, 2007, 07:42:33 pm
faulty, too still needs help to work properly
"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."