0 Members and 1 Guest are viewing this topic.
var tab,response,temp,res: tstringarray; i: integer;function getMode(m: integer): string;begin case m of 0: result:= 'Death Match'; 1: result:= 'Point Match'; 2: result:= 'Team Match'; 3: result:= 'Capture The Flag'; 4: result:= 'Rambo Match'; 5: result:= 'Infiltration'; 6: result:= 'Hold The Flag'; end;end;function getRate(pID: integer): string;var k,d: integer;begin //k:= GetPlayerStat(nametoid(Name),'Kills'); //d:= GetPlayerStat(nametoid(Name),'Deaths'); if d=0 then result:='0.0' else result:= inttostr(k/d);end;procedure ActivateServer();begin tab:=split(ReadFile('cResponse.txt'),chr(13)+chr(10));end;procedure OnCommand(ID: integer;Text: string);begin if Text='/reload_cresponse' then begin tab:=split(ReadFile('cResponse.txt'),chr(13)+chr(10)); saytoplayer(ID,'cResponse.txt file was reloaded'); end;end;procedure OnPlayerSpeak(Name,Text: string);begin if Text='!commands' then begin saytoplayer(nametoid(Name),'available commands are:'); for i:=0 to arrayhigh(tab)-1 do begin temp:= split(tab[i],'^a^'); saytoplayer(nametoid(Name),temp[0]); end; end; if Text[1]='!' then begin for i:=0 to arrayhigh(tab)-1 do begin response := split(tab[i],'^a^'); if Text=response[0] then begin //if(ContainsString(response[1],'$kills')=true)then // response[1]:= StrReplace(response[1],'$kills',inttostr(GetPlayerStat(nametoid(Name),'Kills'))); //if(ContainsString(response[1],'$deaths')=true)then // response[1]:= StrReplace(response[1],'$deaths',inttostr(GetPlayerStat(nametoid(Name),'Deaths'))); //if(ContainsString(response[1],'$rate')=true)then // response[1]:= StrReplace(response[1],'$rate',getRate(nametoid(Name))); //if(ContainsString(response[1],'$ping')=true)then // response[1]:= StrReplace(response[1],'$ping',inttostr(GetPlayerStat(nametoid(Name),'Ping'))); //if(ContainsString(response[1],'$health')=true)then // response[1]:= StrReplace(response[1],'$health',inttostr(GetPlayerStat(nametoid(Name),'Health'))); //if(ContainsString(response[1],'$ip')=true)then // response[1]:= StrReplace(response[1],'$ip',inttostr(GetPlayerStat(nametoid(Name),'IP'))); if(ContainsString(response[1],'$name$')=true)then response[1]:= StrReplace(response[1],'$name$',Name); if(ContainsString(response[1],'$pid$')=true)then response[1]:= StrReplace(response[1],'$pid$',inttostr(nametoid(Name))); if(ContainsString(response[1],'$map$')=true)then response[1]:= StrReplace(response[1],'$map$',CurrentMap); if(ContainsString(response[1],'$nextmap$')=true)then response[1]:= StrReplace(response[1],'$nextmap$',NextMap); if(ContainsString(response[1],'$maxplayers$')=true)then response[1]:= StrReplace(response[1],'$maxplayers$',inttostr(MaxPlayers)); if(ContainsString(response[1],'$numplayers$')=true)then response[1]:= StrReplace(response[1],'$numplayers$',inttostr(NumPlayers)); if(ContainsString(response[1],'$timelimit$')=true)then response[1]:= StrReplace(response[1],'$timelimit$',inttostr(TimeLimit)); if(ContainsString(response[1],'$timeleft$')=true)then response[1]:= StrReplace(response[1],'$timeleft$',inttostr(TimeLeft)); if(ContainsString(response[1],'$scorelimit$')=true)then response[1]:= StrReplace(response[1],'$scorelimit$',inttostr(ScoreLimit)); if(ContainsString(response[1],'$gamemode$')=true)then response[1]:= StrReplace(response[1],'$gamemode$',getMode(GameStyle)); if(ContainsString(response[1],'$serverver$')=true)then response[1]:= StrReplace(response[1],'$serverver$',ServerVersion); if(ContainsString(response[1],'$servername$')=true)then response[1]:= StrReplace(response[1],'$servername$',ServerName); if(ContainsString(response[1],'$serverport$')=true)then response[1]:= StrReplace(response[1],'$serverport$',inttostr(ServerPort)); if(ContainsString(response[1],'$servertime$')=true)then response[1]:= StrReplace(response[1],'$servertime$',FormatDate('hh:nn:ss')); if(ContainsString(response[1],'$ascore$')=true)then response[1]:= StrReplace(response[1],'$ascore$',inttostr(AlphaScore)); if(ContainsString(response[1],'$bscore$')=true)then response[1]:= StrReplace(response[1],'$bscore$',inttostr(BravoScore)); if(ContainsString(response[1],'$cscore$')=true)then response[1]:= StrReplace(response[1],'$cscore$',inttostr(CharlieScore)); if(ContainsString(response[1],'$dscore$')=true)then response[1]:= StrReplace(response[1],'$dscore$',inttostr(DeltaScore)); if(ContainsString(response[1],'$aplayers$')=true)then response[1]:= StrReplace(response[1],'$aplayers$',inttostr(AlphaPlayers)); if(ContainsString(response[1],'$bplayers$')=true)then response[1]:= StrReplace(response[1],'$bplayers$',inttostr(BravoPlayers)); if(ContainsString(response[1],'$cplayers$')=true)then response[1]:= StrReplace(response[1],'$cplayers$',inttostr(CharliePlayers)); if(ContainsString(response[1],'$dplayers$')=true)then response[1]:= StrReplace(response[1],'$dplayers$',inttostr(DeltaPlayers)); if(ContainsString(response[1],'$ffire$')=true)then response[1]:= StrReplace(response[1],'$ffire$',ReadINI('soldat.ini','GAME','Friendly_Fire','error')); if(ContainsString(response[1],'$respawntime$')=true)then response[1]:= StrReplace(response[1],'$respawntime$',inttostr(strtoint(ReadINI('soldat.ini','GAME','Respawn_Time','error'))/60) ); if(ContainsString(response[1],'$waverespawntime$')=true)then response[1]:= StrReplace(response[1],'$waverespawntime$',inttostr(strtoint(ReadINI('soldat.ini','GAME','WaveRespawn_Time','error'))/60) ); if(ContainsString(response[1],'$bonusfreq$')=true)then response[1]:= StrReplace(response[1],'$bonusfreq$',ReadINI('soldat.ini','GAME','Bonus_Frequency','error')); if(ContainsString(response[1],'$votepercent$')=true)then response[1]:= StrReplace(response[1],'$votepercent$',ReadINI('soldat.ini','NETWORK','Vote_Percent','error')); res:= split(response[1],'^n^'); for i:=0 to getarraylength(res) do begin if copy(res[i],1,4)='cmd:' then command(copy(res[i],5,length(res[i]))) else saytoplayer(nametoid(Name),res[i]); end; end; end; end;end;