0 Members and 1 Guest are viewing this topic.
YourVariableX, YourVariableY: single;YourVariableX := <x position>;YourVariableY := <y position>;
constMAXFLAMETIME= 300;type tFire = recordActive: boolean;Owner: integer;X,Y: single;Duration: integer;end;varflames: array[1..32] of tFire;procedure CreateFireWall(ID:byte;PX,PY:single);var i:byte;begin for i := 1 to HighestID do begin if flames[i].Active = false then begin flames[i].Active := true; flames[i].Owner := ID; flames[i].X := PX; flames[i].Y := PY; flames[i].Duration := MAXFLAMETIME; end; end;end;function OnPlayerCommand(ID: integer; Text: string): boolean;varX,Y: single;beginX:= GetPlayerStat(ID,'X');Y:= GetPlayerStat(ID,'Y');if Text = '/firewall' thenCreateFireWall(ID,X,Y);Result := false;end;procedure AppOnIdle(Ticks: longint);varFlameCount: integer;beginif flames[FlameCount].Active = true then begin if flames[FlameCount].Duration > 0 then begin flames[FlameCount].Duration := flames[FlameCount].Duration - 1; CreateBullet(flames[FlameCount].X,flames[FlameCount].Y,0,0,0,5, flames[FlameCount].Owner); // 1 createbullet for test if flames[FlameCount].Duration = 0 then begin flames[FlameCount].Active := false; end; end; end;end;
constMAXFLAMETIME = 300;type tFire = recordActive: boolean;Owner: integer;X,Y: single;Duration: integer;end;varflames: array[1..32] of tFire;procedure CreateFireWall(ID:byte;PX,PY:single);var i:byte;begin for i := 1 to 32 do begin if flames[i].Active = false then begin flames[i].Active := true; flames[i].Owner := ID; flames[i].X := PX; flames[i].Y := PY; flames[i].Duration := MAXFLAMETIME; end; end;end;function OnPlayerCommand(ID: integer; Text: string): boolean;varX,Y: single;beginX:= GetPlayerStat(ID,'X');Y:= GetPlayerStat(ID,'Y');if Text = '/firewall' then beginCreateFireWall(ID,X,Y);end;Result := false;end;procedure AppOnIdle(Ticks: longint);vari,j,Target: integer;begin for i:= 1 to 32 do begin if (flames[i].Active = true) then begin if (flames[i].Duration > 0) then begin flames[i].Duration := flames[i].Duration - 1; CreateBullet(flames[i].X,flames[i].Y,0,0,0,5, flames[i].Owner); for j := 1 to 32 do begin if GetPlayerStat(j,'Active') = true then begin if (GetPlayerStat(j,'Alive') = true) and (GetPlayerStat(j,'Team') <> GetPlayerStat(flames[i].Owner,'Team')) then begin if Distance(flames[i].X,flames[i].Y,GetPlayerstat(j,'X'),Getplayerstat(j,'Y')) <= 50 then begin DoDamageBy(j,flames[i].Owner,200); end; end; end; end; end; if (flames[i].Duration = 0) then begin flames[i].Active := false; end; end; end;end;
GetPlayerStat(j,'Active') = true
constMAXFLAMETIME = 300;type tFire = recordActive: boolean;Owner: integer;X,Y: single;Duration: integer;end;varflames: array[1..32] of tFire;procedure CreateFireWall(ID:byte;PX,PY:single);var i:byte;begin for i := 1 to 32 do begin if flames[i].Active = false then begin flames[i].Active := true; flames[i].Owner := ID; flames[i].X := PX; flames[i].Y := PY; flames[i].Duration := MAXFLAMETIME; end; end;end;function OnPlayerCommand(ID: integer; Text: string): boolean;varX,Y: single;beginX:= GetPlayerStat(ID,'X');Y:= GetPlayerStat(ID,'Y');if Text = '/firewall' then beginCreateFireWall(ID,X,Y);end;Result := false;end;procedure AppOnIdle(Ticks: longint);vari,j,Target: integer;begin for i:= 1 to 32 do begin if (flames[i].Active = true) and (flames[i].Duration > 0) then begin flames[i].Duration := flames[i].Duration - 1; CreateBullet(flames[i].X,flames[i].Y,0,0,0,5, flames[i].Owner); for j := 1 to 32 do begin if (GetPlayerStat(j,'Alive') = true) and (GetPlayerStat(j,'Team') <> GetPlayerStat(flames[i].Owner,'Team')) and (Distance(flames[i].X,flames[i].Y,GetPlayerstat(j,'X'),Getplayerstat(j,'Y')) <= 50) then begin DoDamageBy(j,flames[i].Owner,200); end; end; end; end;end;
I tried it and there is no lagg ...
but if i put a firewall i cant put another one ...
constMAXFLAMETIME = 120;type tFire = recordActive: boolean;Owner: integer;X,Y: single;Duration: integer;end;varflames: array[1..32] of tFire;procedure CreateFireWall(ID:byte;PX,PY:single);var i:byte;begin for i := 1 to 32 do begin if flames[i].Active = false then begin flames[i].Active := true; flames[i].Owner := ID; flames[i].X := PX; flames[i].Y := PY; flames[i].Duration := MAXFLAMETIME; end; end;end;function OnPlayerCommand(ID: integer; Text: string): boolean;varX,Y: single;beginX:= GetPlayerStat(ID,'X');Y:= GetPlayerStat(ID,'Y');if Text = '/firewall' then beginCreateFireWall(ID,X,Y);end;Result := false;end;procedure AppOnIdle(Ticks: longint);vari,j: integer;begin for i:= 1 to 32 do begin if getplayerstat(i,'active')= true then begin if getplayerstat(i,'human')= true then begin if (flames[i].Active = true) then begin if (flames[i].Duration > 0) then begin flames[i].Duration := flames[i].Duration - 1; CreateBullet(flames[i].X+50,flames[i].Y,0,0,2000,5, flames[i].Owner); CreateBullet(flames[i].X,flames[i].Y-50,0,0,2000,5, flames[i].Owner); CreateBullet(flames[i].X-50,flames[i].Y,0,0,2000,5, flames[i].Owner); for j := 1 to 32 do begin if getplayerstat(j,'active') = true then begin if getplayerstat(j,'human') = false then begin if (Distance(flames[i].X,flames[i].Y,GetPlayerstat(j,'X'),Getplayerstat(j,'Y')) <= 50) then begin if (GetPlayerStat(j,'Alive') = true) then begin if (GetPlayerStat(j,'Team') <> GetPlayerStat(flames[i].Owner,'Team')) then begin DoDamageBy(j,flames[i].Owner,2000); end; end; end; end; end; end; if (flames[i].Duration = 0) then begin flames[i].Active := false; end; end; end; end; end; end;end;