Author Topic: Pull Script...  (Read 1745 times)

0 Members and 1 Guest are viewing this topic.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Pull Script...
« on: July 12, 2008, 08:38:29 pm »
Script Name: pull script
Script Description: Every second it pulls you a settable distance to the enemy flag. Works only in CTF. If the place to pull is in a polygon then it doesnt do it. I don't really know why I made this, except that I was bored. Whatever...
Original Author(s): Me.
Core Version: 2.2 or whatever the latest one is.
Code:
Code: [Select]
const
PULLAMOUNT = 10; { how far to pull. 1 = all the way, 10 = 1/10th the way, etc }
var Pulling: array[1..32] of boolean;
function isInPoly(X,Y: single): boolean;
var Dist: single;
begin
Result := iif(RayCast(X,Y,X,Y,Dist,800), true, false);
end;
function MoveX(X, EX: Single): Single;
begin
Result := ((EX - X)/PULLAMOUNT)+X;
end;
function MoveY(Y, EY: Single): Single;
begin
Result := ((EY - Y)/PULLAMOUNT)+Y;
end;
procedure AppOnIdle(Ticks: integer);
var
i: Integer;
X,Y,NX,NY,BX,BY,RX,RY: Single;
begin
for i := 1 to 32 do
begin
if Pulling[i] then begin
GetPlayerXY(i,X,Y);
GetFlagsXY(BX,BY,RX,RY);
if(GetPlayerStat(i,'team') = 1) then begin
NX := MoveX(X,BX);
NY := MoveY(Y,BY);
end;
if(GetPlayerStat(i,'team') = 2) then begin
NX := MoveX(X,RX);
NY := MoveY(Y,RY);
end;
if(isInPoly(NX,NY)) then MovePlayer(i,NX,NY);
end;
end;
end;
procedure OnFlagGrab(ID, TeamFlag: byte;GrabbedInBase: boolean);
begin
if Pulling[ID] then Pulling[ID] := false;
end;
procedure OnLeaveGame(ID, Team: byte;Kicked: boolean);
begin
if Pulling[ID] then Pulling[ID] := false;
end;
function OnCommand(ID: Byte; Text: string): boolean;
begin
if Text = '/pullon' then Pulling[ID] := true;
if Text = '/pulloff' then Pulling[ID] := false;
end;
Yeah... I posted all of it, just too bored to make a zip. even though in the time I've written this I could have. And yet I'm still typing...
« Last Edit: July 13, 2008, 01:45:45 am by iDante »

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Pull Script...
« Reply #1 on: July 12, 2008, 10:01:02 pm »
ill make a zip then, lazy one.



Offline zop

  • Major
  • *
  • Posts: 81
Re: Pull Script...
« Reply #2 on: August 11, 2008, 12:10:01 pm »
It's very useful  for my mod !
Thank you iDante !

http://122.116.167.31:23238:23238/galavela/?inc=player&name=%5BTomato+Bird%5D+Cibo[/size=1]

Offline Mr

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 166
Re: Pull Script...
« Reply #3 on: August 19, 2008, 12:23:56 am »
Haha, usefull if you just want to pwn your enemy :D