0 Members and 3 Guests are viewing this topic.
var PlayerCaps: array[1..32] of integer; plflag: array[1..2] of integer;procedure ResetCaps();vari: integer;beginfor i := 1 to 32 do beginPlayerCaps[i] := 0;end;end;procedure OnMapChange();beginResetCaps()end;procedure OnJoinTeam(IP, Nickname: string;Team: byte);beginPlayerCaps[NameToId(Nickname)] := 0;end;procedure OnLeaveGame(IP, Nickname: string;Team: byte);beginPlayerCaps[NameToId(Nickname)] := 0;end;procedure OnFlagGrab(ID: integer;TeamFlag: byte;GrabbedInBase: boolean);beginplflag[TeamFlag]:=ID;end;procedure OnFlagScore(ID: integer;TeamFlag: byte);beginPlayerCaps[plflag[TeamFlag]] := PlayerCaps[plflag[TeamFlag]] + 1;end;function IDtoKills(PlayerID: integer):integer;begin case PlayerID of 1: Result:= Player_Kills_1; 2: Result:= Player_Kills_2; 3: Result:= Player_Kills_3; 4: Result:= Player_Kills_4; 5: Result:= Player_Kills_5; 6: Result:= Player_Kills_6; 7: Result:= Player_Kills_7; 8: Result:= Player_Kills_8; 9: Result:= Player_Kills_9; 10: Result:= Player_Kills_10; 11: Result:= Player_Kills_11; 12: Result:= Player_Kills_12; 13: Result:= Player_Kills_13; 14: Result:= Player_Kills_14; 15: Result:= Player_Kills_15; 16: Result:= Player_Kills_16; 17: Result:= Player_Kills_17; 18: Result:= Player_Kills_18; 19: Result:= Player_Kills_19; 20: Result:= Player_Kills_20; 21: Result:= Player_Kills_21; 22: Result:= Player_Kills_22; 23: Result:= Player_Kills_23; 24: Result:= Player_Kills_24; 25: Result:= Player_Kills_25; 26: Result:= Player_Kills_26; 27: Result:= Player_Kills_27; 28: Result:= Player_Kills_28; 29: Result:= Player_Kills_29; 30: Result:= Player_Kills_30; 31: Result:= Player_Kills_31; 32: Result:= Player_Kills_32; end;end;function IDtoDeaths(PlayerID: integer):integer;begin case PlayerID of 1: Result := Player_Deaths_1; 2: Result := Player_Deaths_2; 3: Result := Player_Deaths_3; 4: Result := Player_Deaths_4; 5: Result := Player_Deaths_5; 6: Result := Player_Deaths_6; 7: Result := Player_Deaths_7; 8: Result := Player_Deaths_8; 9: Result := Player_Deaths_9; 10: Result := Player_Deaths_10; 11: Result := Player_Deaths_11; 12: Result := Player_Deaths_12; 13: Result := Player_Deaths_13; 14: Result := Player_Deaths_14; 15: Result := Player_Deaths_15; 16: Result := Player_Deaths_16; 17: Result := Player_Deaths_17; 18: Result := Player_Deaths_18; 19: Result := Player_Deaths_19; 20: Result := Player_Deaths_20; 21: Result := Player_Deaths_21; 22: Result := Player_Deaths_22; 23: Result := Player_Deaths_23; 24: Result := Player_Deaths_24; 25: Result := Player_Deaths_25; 26: Result := Player_Deaths_26; 27: Result := Player_Deaths_27; 28: Result := Player_Deaths_28; 29: Result := Player_Deaths_29; 30: Result := Player_Deaths_30; 31: Result := Player_Deaths_31; 32: Result := Player_Deaths_32; end;end;function IDtoTeam(PlayerID: integer):integer;begin case PlayerID of 1: Result:= Player_Team_1; 2: Result:= Player_Team_2; 3: Result:= Player_Team_3; 4: Result:= Player_Team_4; 5: Result:= Player_Team_5; 6: Result:= Player_Team_6; 7: Result:= Player_Team_7; 8: Result:= Player_Team_8; 9: Result:= Player_Team_9; 10: Result:= Player_Team_10; 11: Result:= Player_Team_11; 12: Result:= Player_Team_12; 13: Result:= Player_Team_13; 14: Result:= Player_Team_14; 15: Result:= Player_Team_15; 16: Result:= Player_Team_16; 17: Result:= Player_Team_17; 18: Result:= Player_Team_18; 19: Result:= Player_Team_19; 20: Result:= Player_Team_20; 21: Result:= Player_Team_21; 22: Result:= Player_Team_22; 23: Result:= Player_Team_23; 24: Result:= Player_Team_24; 25: Result:= Player_Team_25; 26: Result:= Player_Team_26; 27: Result:= Player_Team_27; 28: Result:= Player_Team_28; 29: Result:= Player_Team_29; 30: Result:= Player_Team_30; 31: Result:= Player_Team_31; 32: Result:= Player_Team_32; end;end;procedure KDRatio(ID: Integer);varKD: Double;plkills: Integer;beginplkills := IDtoKills(ID)-(PlayerCaps[ID]*20);if(IDtoTeam(ID)=5) then command('/say '+IDToName(ID)+', Your are spectator') else if(IDtoDeaths(ID)=0) then command('/say '+IDToName(ID)+', Your K:D is incalculable' +' ('+intToStr(plkills)+'/0)') else begin KD := (plkills)/(IDtoDeaths(ID))*100; command('/say '+IDToName(ID)+', Your K:D is '+FloatToStr(round(KD)/100)+' ('+FloatToStr(plkills)+'/'+FloatToStr(IDtoDeaths(ID))+')'); end;end;procedure OnPlayerSpeak(Name,Text: string);vari: integer;begin if Text = '!kd' then KDRatio(NameToID(Name)); if Text = '!kdall' then for i:=1 to NumPlayers do KDRatio(i); end;
it's more like the text of the /say commands than the script that i took from him.and his script is for his ESA.editedoops this script isn't good. i have to subtract the cap's points from the points.procedure OnFlagScore(ID: integer;TeamFlag: byte);the ID always returns 0 so i cant fix this script.its still good for DM and TDM...
(12:43:17) /recompile(12:43:17) [*] Compiling Script AdminCore.pas...(12:43:17) [*] Compiling Script NetworkCore.pas...(12:43:18) [*] (NetworkCore.pas) [Error] (199:4): Unknown identifier 'IDtoTeam'(12:43:18) Shutting server...(12:43:19) Shutting down fileserver...(12:43:19) Shutting down admin server...(12:43:19) Connection to the server lost
Code: [Select](12:43:17) /recompile(12:43:17) [*] Compiling Script AdminCore.pas...(12:43:17) [*] Compiling Script NetworkCore.pas...(12:43:18) [*] (NetworkCore.pas) [Error] (199:4): Unknown identifier 'IDtoTeam'(12:43:18) Shutting server...(12:43:19) Shutting down fileserver...(12:43:19) Shutting down admin server...(12:43:19) Connection to the server lostWhat causes this? I've also had it with other scripts.
Does this mean it's fixable by the author or, since it's not in the scripting engine, it's not fixable?
function IDtoTeam(PlayerID: integer):integer;begin case PlayerID of 1: Result:= Player_Team_1; 2: Result:= Player_Team_2; 3: Result:= Player_Team_3; 4: Result:= Player_Team_4; 5: Result:= Player_Team_5; 6: Result:= Player_Team_6; 7: Result:= Player_Team_7; 8: Result:= Player_Team_8; 9: Result:= Player_Team_9; 10: Result:= Player_Team_10; 11: Result:= Player_Team_11; 12: Result:= Player_Team_12; 13: Result:= Player_Team_13; 14: Result:= Player_Team_14; 15: Result:= Player_Team_15; 16: Result:= Player_Team_16; 17: Result:= Player_Team_17; 18: Result:= Player_Team_18; 19: Result:= Player_Team_19; 20: Result:= Player_Team_20; 21: Result:= Player_Team_21; 22: Result:= Player_Team_22; 23: Result:= Player_Team_23; 24: Result:= Player_Team_24; 25: Result:= Player_Team_25; 26: Result:= Player_Team_26; 27: Result:= Player_Team_27; 28: Result:= Player_Team_28; 29: Result:= Player_Team_29; 30: Result:= Player_Team_30; 31: Result:= Player_Team_31; 32: Result:= Player_Team_32; end;end;
(21:02:54) /recompile(21:02:54) [*] Compiling Script AdminCore.pas...(21:02:55) [*] Compiling Script NetworkCore.pas...(21:02:55) [*] (NetworkCore.pas) [Error] (246:1): Unknown identifier 'ResetCaps'(21:02:55) Shutting server...(21:02:56) Shutting down fileserver...(21:02:56) Shutting down admin server...(21:02:56) Connection to the server lost
Code: [Select](21:02:54) /recompile(21:02:54) [*] Compiling Script AdminCore.pas...(21:02:55) [*] Compiling Script NetworkCore.pas...(21:02:55) [*] (NetworkCore.pas) [Error] (246:1): Unknown identifier 'ResetCaps'(21:02:55) Shutting server...(21:02:56) Shutting down fileserver...(21:02:56) Shutting down admin server...(21:02:56) Connection to the server lostD'oh.
const//KD ratio- console text color KDColor = $EED6BFFF;var PlayerCaps: array[1..32] of integer; KDarray: array[0..32] of Double; KDPos: array[0..32] of Integer;procedure ResetCaps();vari: integer;beginfor i := 1 to 32 do beginPlayerCaps[i] := 0;end;end;procedure OnJoinGame(ID, Team: byte);beginPlayerCaps[ID] := 0;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);beginPlayerCaps[ID] := 0;end;procedure OnFlagScore(ID, TeamFlag: byte);begininc(PlayerCaps[ID],1);end;Procedure KDSort(size : Integer);Vari, j: Integer;Begin for i:=0 to 32 do begin KDPos[i]:=i; end; For i := 2 to size do Begin For j := size downto i do begin if (KDarray[j] > KDarray[j-1]) then Begin KDarray[0] := KDarray[j]; KDarray[j] := KDarray[j-1]; KDarray[j-1] := KDarray[0]; KDPos[0] := KDPos[j]; KDPos[j] := KDPos[j-1]; KDPos[j-1] := KDPos[0]; end; end; end;End;function BiggestNick() : Byte;varbigNick, i : Byte;begin BigNick:=length(Getplayerstat(1,'name')); for i := 2 to maxplayers do begin If BigNick<length(Getplayerstat(i,'name')) then bigNick:=length(Getplayerstat(i,'name')); end; Result := BigNick;end;procedure KDallRatio();varKD: Double;kills, ID, i: Integer;BNick : Byte;spaces: String;begin for ID:=1 to NumPlayers+2 do begin kills := GetPlayerStat(ID,'kills')-PlayerCaps[ID]*20; if GetPlayerStat(ID,'active') And GetPlayerStat(ID,'team')<>5 then begin i := 0; if(GetPlayerStat(ID,'deaths')=0) then i:=1 KD := (kills)/((GetPlayerStat(ID,'deaths'))+i); KDarray[ID]:=roundto(KD,2); end; end; KDSort(Maxplayers); i:=0 BNick:=BiggestNick(); for ID:=1 to Maxplayers do begin if (GetPlayerStat(KDPos[ID],'active')=True) then begin i := Length(GetPlayerStat(KDPos[ID],'name')); spaces := ''; while i<BNick do begin i:=i+1 spaces := spaces+chr(32); end WriteConsole(0,GetPlayerStat(KDPos[ID],'name')+Spaces+' '+FloatToStr(KDarray[ID]),KDColor); end; end;end;procedure KDRatio(ID: Integer);varKD: Double;Kills: integer;beginkills:=GetPlayerStat(ID,'kills')-PlayerCaps[ID]*20;if(GetPlayerStat(ID,'team')=5) thenWriteConsole(0,GetPlayerStat(ID,'name')+', Your are spectator.',KDColor) else if(GetPlayerStat(ID,'deaths')=0) then WriteConsole(0,GetPlayerStat(ID,'name')+', Your K:D is '+intToStr(kills)+' K:'+intToStr(kills)+' D:0',KDColor) else begin KD := kills/GetPlayerStat(ID,'deaths'); WriteConsole(0,GetPlayerStat(ID,'name')+', Your K:D is '+FloatToStr(roundto(KD,2))+' K:'+intToStr(kills)+' D:'+IntToStr(GetPlayerStat(ID,'Deaths')),KDColor); end;end;procedure OnPlayerSpeak(ID: byte; Text: string);begin if (Text = '!kd') or (Text = 'rate') then KDRatio(ID); if Text = '!kdall' then KDallRatio();end;procedure OnMapChange(NewMap: string);beginResetCaps();end;
function BiggestNick() : Byte;varbigNick, i : Byte;begin BigNick:=length(Getplayerstat(1,'name')); for i := 2 to maxplayers do begin If BigNick<length(Getplayerstat(i,'name')) then bigNick:=length(Getplayerstat(i,'name')); end; Result := BigNick;end;