0 Members and 1 Guest are viewing this topic.
constGMM_CNTDOWNLENGTH = 5; //gamemodeswitch countdownlengthvar//-----/gamemode xxx variablesstartgamemodeswitch:integer;togamemode:integer;G_TT : integer;G_CNT : integer;//-----------------------------------------procedure ActivateServer();beginend;procedure AppOnIdle(Ticks: integer);begin { gameswitch procedure } if (startgamemodeswitch = 1) then begin G_CNT := G_CNT-1; Command('/say '+inttostr(G_CNT)); if(G_CNT = 0) then begin Command('/gamemode '+inttostr(togamemode)); startgamemodeswitch := 0; end; end;end;procedure OnCommand(ID:integer; Text:string);var i:byte; gamemodeArray: array[0..7] of string;begin Text := lowercase(Text); gamemodeArray[0] := 'dm'; gamemodeArray[1] := 'pm'; gamemodeArray[2] := 'tm'; gamemodeArray[3] := 'ctf'; gamemodeArray[4] := 'rm'; gamemodeArray[5] := 'inf'; gamemodeArray[6] := 'htf'; togamemode := 255; if(Copy(Text,1,9) = '/gamemode') then begin for i:= 0 to ArrayHigh(gamemodeArray) do if(Copy(Text,11,Length(Text)) = gamemodeArray[i]) then begin togamemode := i; break; end; if((togamemode <> 255) and (GameStyle <> togamemode)) then begin startgamemodeswitch := 1; command('/say switching to '+gamemodeArray[togamemode]+' gamestyle in '+IntToStr(GMM_CNTDOWNLENGTH)+' seconds, please rejoin'); G_CNT := GMM_CNTDOWNLENGTH; end; end;end;
procedure OnCommand(ID:integer; Text:string);var i:byte; gamemodeArray: array[0..7] of string; togamemode:integer;begin Text := lowercase(Text); gamemodeArray[0] := 'dm'; gamemodeArray[1] := 'pm'; gamemodeArray[2] := 'tm'; gamemodeArray[3] := 'ctf'; gamemodeArray[4] := 'rm'; gamemodeArray[5] := 'inf'; gamemodeArray[6] := 'htf'; togamemode := 255; if(Copy(Text,1,9) = '/gamemode') then begin for i:= 0 to ArrayHigh(gamemodeArray) do if(Copy(Text,11,Length(Text)) = gamemodeArray[i]) then begin togamemode := i; break; end; if((togamemode <> 255) and (GameStyle <> togamemode)) then begin Command('/gamemode '+inttostr(togamemode)) end; end;end;
function Copy ( Source : string; StartChar, Count : Integer ) : string;
Text := '/gamemode ctf'result := Copy(Text, 11,3);// result = 'ctf'
procedure OnCommand(ID:integer; Text:string);var i:byte; gamemodeArray: array[0..7] of string;begin Text := lowercase(Text); gamemodeArray[0] := 'dm'; gamemodeArray[1] := 'pm'; gamemodeArray[2] := 'tm'; gamemodeArray[3] := 'ctf'; gamemodeArray[4] := 'rm'; gamemodeArray[5] := 'inf'; gamemodeArray[6] := 'htf'; togamemode := 255; if(Copy(Text,1,9) = '/gamemode') then begin for i:= 0 to ArrayHigh(gamemodeArray) do if(Copy(Text,11,Length(Text)) = gamemodeArray[i]) then begin togamemode := i; break; end; if((togamemode <> 255) and (GameStyle <> togamemode)) then begin startgamemodeswitch := 1; command('/say switching to '+gamemodeArray[togamemode]+' gamestyle in '+IntToStr(GMM_CNTDOWNLENGTH)+' seconds, please rejoin'); G_CNT := GMM_CNTDOWNLENGTH; end; end;end;procedure AppOnIdle(Ticks: integer);begin { gameswitch procedure } if (startgamemodeswitch = 1) then begin G_CNT := G_CNT-1; Command('/say '+inttostr(G_CNT)); if(G_CNT = 0) then begin Command('/gamemode '+inttostr(togamemode)); startgamemodeswitch := 0; end; end;end;
You use Copy wrong.the correct syntax isCode: [Select]function Copy ( Source : string; StartChar, Count : Integer ) : string;fore exampleCode: [Select]Text := '/gamemode ctf'result := Copy(Text, 11,3);// result = 'ctf'
function OnCommand(ID:Byte;Text:string):boolean;