0 Members and 1 Guest are viewing this topic.
const//TeamsALPHA = 1;BRAVO = 2;CHARLIE = 3;DELTA = 4;SPECTATOR = 5;//Game ModesDEATHMATCH = 0;POINTMATCH = 1;TEAMMATCH = 2;CTF = 3;RAMBO = 4;INF = 5;HTF = 6;SERVER = 255; varsms,sec,ms,player,time: integer;score,played: array[1..32] of integer;playa: string;timekill: boolean;procedure ActivateServer();begin timekill:=false; time:=0;end;procedure AppOnIdle(Ticks: integer);begin if(TimeLeft+1=TimeLimit*60) then sms := strtoint(FormatDate('z')); if timekill then begin time:=time+1; If time>8 then begin Command('/kill ' + inttostr(player)); timekill:=false; time:=0; end; end;end;procedure OnCommand(ID: integer;Text: string);var maps: string; mapsarray: array[0..50] of string; i: integer;begin //'/erase' erases highscore of currently played map if(Text='/erase') then begin Writefile('h' + CurrentMap + '.ini',''); Command('/pm ' + inttostr(ID) + ' Highscore of ' + Currentmap + ' erased.'); end; //'/eraseall' erases all highscores (windows only) {if (Text='/eraseall') then begin maps:= ReadFile('mapslist.txt'); mapsarray:= split(maps,chr(13)+chr(10)); for i:=0 to 50 do Writefile('h' + mapsarray[i] + '.ini',''); Command('/pm ' + inttostr(ID) + ' All highscores erased.'); end;}end;function OnRequestGame(IP: string;State: integer):integer;beginResult := State;end;procedure OnJoinGame(IP, Nickname: string;Team: byte);beginend;procedure OnJoinTeam(IP, Nickname: string;Team: byte);begin score[IPtoID(IP)]:=0; played[IPtoID(IP)]:=0; If Team=2 then Command('/setteam1 ' + inttostr(IPtoID(IP)));end;procedure OnLeaveGame(IP, Nickname: string;Team: byte);beginend;procedure OnFlagGrab(ID: integer;TeamFlag: byte;GrabbedInBase: boolean);begin playa:=IDToName(ID); player:=ID; timekill:=true;end;procedure OnFlagReturn(ID: integer;TeamFlag: byte);beginend;procedure OnFlagScore(ID: integer;TeamFlag: byte);var i: integer; nl: string; write: boolean;begin timekill:=false; time:=0; sec:=TimeLimit*60-Timeleft; If strtoint(FormatDate('z')) < sms then begin sec:=sec-1; ms:=1000+strtoint(FormatDate('z'))-sms; end else ms:=strtoint(FormatDate('z'))-sms; Command('/say ' + playa + ' wins with a time of:'); Command('/say ' + inttostr(sec) + ',' + inttostr(ms) + ' seconds!'); score[player]:=score[player]+1; for i:=1 to 32 do played[i]:=played[i]+1; nl:=chr(13)+chr(10); If strtoint(ReadINI('hover_minimum.ini','Minimum',CurrentMap,'0'))>sec then Command('/kick ' + inttostr(player)) else If strtoint(ReadINI('h' + CurrentMap + '.ini',CurrentMap,'seconds','5000'))>sec then begin write:=WriteFile('h' + Currentmap + '.ini','[' + CurrentMap + ']' + nl + 'seconds=' + inttostr(sec) + nl + 'milliseconds=' + inttostr(ms) + nl + 'player=' + playa); Command('/say Congratulations, you established a'); Command('/say new record on ' + CurrentMap + '!'); end else If strtoint(ReadINI('h' + CurrentMap + '.ini',CurrentMap,'seconds','5000'))=sec then If strtoint(ReadINI('h' + CurrentMap + '.ini',CurrentMap,'milliseconds','999'))>ms then begin write:=WriteFile('h' + Currentmap + '.ini','[' + CurrentMap + ']' + nl + 'seconds=' + inttostr(sec) + nl + 'milliseconds=' + inttostr(ms) + nl + 'player=' + playa); Command('/say Congratulations, you established a'); Command('/say new record on ' + CurrentMap + '!'); end; end;procedure OnPlayerKill(Killer,Victim,Weapon: string);beginend;procedure OnPlayerRespawn(ID: integer);beginend;procedure OnPlayerSpeak(Name,Text: string);begin if Text='!score' then Command('/say ' + Name + ' current score is ' + inttostr(score[NametoID(Name)]) + ' having played ' + inttostr(played[NametoID(Name)]) + ' rounds.'); if Text='!high' then begin Command('/say The record on ' + CurrentMap + ' is:'); Command('/say ' + ReadINI('h' + Currentmap + '.ini',CurrentMap,'seconds','5000') + ',' + ReadINI('h' + Currentmap + '.ini',CurrentMap,'milliseconds','999') + ' by ' + ReadINI('h' + Currentmap + '.ini',CurrentMap,'player','N/A')); end;end;