0 Members and 1 Guest are viewing this topic.
var HBFT:Array[1..32] of Boolean;function OnPlayerCommand(ID: Byte; Text: string): boolean;begin if Text = '/buy FTP' then begin if Cash < 10000 then begin WriteConsole(0,IdtoName(ID)+' just tried to purchase a Flag Teleport, not enough funds!',$EE81FAA1); end; if Cash >= 10000 then begin Cash :=Cash-10000; WriteConsole(0,IdtoName(ID)+' has just bought a Flag Teleport for 10000 Cash',$EE81FAA1); HBFT[ID]:=True; end; end;end;procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);begin if HBFT[ID] = True then begin MovePlayer(ID,GetObjectStat(1,'X'), GetObjectStat(1, 'Y')); WriteConsole(ID,'Grab detected, moving you now...',$EE81FAA1); HBFT[ID]:=False; end;end;
The object styles of alpha/bravo flags should be 1 and 2 iirc.
i:=KillObject(2);SetSpawnStat(i,'x',GetPlayerStat(ID,'x'));SetSpawnStat(i,'y',GetPlayerStat(ID,'y'));
varTSec,Tmin,BTSec,BTMin:Array[1..32] of Integer;TA:Array[1..32] of Boolean;procedure AppOnIdle(Ticks: integer);begin for i:= 1 to 32 do begin if GetPlayerStat(i,'human') = true then if GetPlayerStat(i,'Alive') = true then TA[i]:= True; if TA[i] = True then begin TSec[i]:=TSec[i]+1; if TSec[i] = 60 then begin TMin[i]:= TMin[i]+1; TSec[i]:= 0; end; end; if GetPlayerStat(i,'human') = true then if GetPlayerStat(i,'Alive') = False then TA[i]:= False; If TA[i] = False then begin BTSec[i]:=TSec[i]; TSec[i]:=0; if TMin[i]>BTMin[i] then BTMin[i]:=TMin[i]; TMin[i]:=0; end; end;end;
WriteConsole(i,'Longest Time Survived: '+inttostr(BTMin[i])+':'+inttostr(BTSec[i])+' (M:S)!',$EE81FAA1);
const ClBad = $FFFF44;Type Stats = Record LongTime: Boolean; TSec,Tmin,BTSec,BTMin: Integer; end; var Player: Array[1..32] of Stats; LongestTime: Array[1..2] of Integer;Procedure ResetStats(ID:Byte); begin Player[ID].LongTime := false; end; Procedure CheckTime(ID:Byte); begin if Player[ID].BTMin > LongestTime[1] then begin LongestTime[1] := Player[ID].BTMin; LongestTime[2] := Player[ID].BTSec; Player[ID].LongTime := true; end else begin if Player[ID].BTMin = LongestTime[1] then if Player[ID].BTSec > LongestTime[2] then begin LongestTime[1] := Player[ID].BTMin; LongestTime[2] := Player[ID].BTSec; Player[ID].LongTime := true; end; end; end; Procedure OnJoinGame(ID,Team:Byte); begin ResetStats(ID); end; Procedure AppOnIdle(Ticks: integer);var i:Byte; begin for i:= 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Alive') = true) then begin if GetPlayerStat(i,'Human') = true then begin TSec[i]:= TSec[i]+1; if TSec[i] = 60 then begin TMin[i]:= TMin[i]+1; TSec[i]:= 0; end; end else begin BTSec[i]:=TSec[i]; TSec[i]:=0; if TMin[i] <> 0 then BTMin[i]:=TMin[i]; TMin[i]:=0; CheckTime(i); end; end; end;