Script Name: Stats and Ranks (beta)
Script Description: Simple stats with rank system based on MySSQL database, no accounts creation, no passwords, stats are stored by player names. You can use this with nickregistration script.
Authors: (
/-\|)/-\/V\ -coder,
CurryWurst -MySSQL and debuging help,
Zabijaka -idea creator)
Core Version: 2.6.5
More info:
Script record kills, deaths and points (points=(kills*k/d ratio)/10). Selfkills are not stored in database (good for RS servers).
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
If (Killer<>Victim) and (GetPlayerStat(Killer,'Team')<>GetPlayerStat(Victim,'Team')) then begin
Kills[Killer]:=Kills[Killer]+1;
Deaths[Victim]:=Deaths[Victim]+1;
SaveStats(Killer);
SaveStats(Victim);
end;
end;
procedure SaveStats(i:Byte);
var
row:Longword;
Killss,Deathss:Integer;
begin
row:=GetRowByPlayer(IdToName(i));
Killss:=StrToInt(GetPiece(Database[Row], #9, 2));
Deathss:=StrToInt(GetPiece(Database[Row], #9, 3));
_SetColumn(Row, 2 , IntToStr(Killss+Kills[I]));
_SetColumn(Row, 3 , IntToStr(Deathss+Deaths[I]));
_SetColumn(Row, 1 , Rnd(FloatToStr((Killss/Deathss*Killss)/10)));
Kills[I]:=0;
Deaths[I]:=0;
end;
Script use quicksort function to sort ranks (on map change sort is automaticaly activated, admin can use command /sort to manualy activate function).
Script have backup procedure (automaticaly every 2h and manualy by command /backup) so
script needs folder "temp" in server root locationstats database are created automaticaly in server root location (stats.txt).
Commands for players:
!statsRank x/xx
Points
Kills
Deaths
K/D ratio
!top - show top 20 players and theirs points
Update 7.09.20091.Integer Points in database (float numbers use more cpu at sorting procedure and integers are more stable imo xD).
2.Command !top now show top 20 players (more usefull imo).
Update 24.09.20093.New version of ixsplit function (
http://forums.soldat.pl/index.php?topic=35698.0)
Good improvement of stability.
Generaly thats all, simple and sexy xD