Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: iDante on July 12, 2008, 08:38:29 pm

Title: Pull Script...
Post by: iDante 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...
Title: Re: Pull Script...
Post by: Iq Unlimited on July 12, 2008, 10:01:02 pm
ill make a zip then, lazy one.


Title: Re: Pull Script...
Post by: zop on August 11, 2008, 12:10:01 pm
It's very useful  for my mod !
Thank you iDante !
Title: Re: Pull Script...
Post by: Mr on August 19, 2008, 12:23:56 am
Haha, usefull if you just want to pwn your enemy :D