Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: Mighty on April 25, 2011, 03:47:25 am
-
Name: AntiFakeHWID
Author: Mighty
Script version: 1.0.2
Server version: 2.6.5
Release Date: 25.04.2011
Compile Test: Passed
Description:
Script stores all nicknames that has been used by specific GUID generated by MSAC.
It sorts data in files daily at 4 am (or later if the server is not empty)
Commands:
* /whoiz X - shows who X is (X = ID or nickname part)
* /whoizall - shows everyone's "personalities"
* /readwhoiz X - shows detailed information about player
* /mark ID As_Who - use this when you know who the person is, but the script is wrong (admins only ofc)
Requirements:
* Make sure you've created a folder ../scripts/AntiFakeHWID/hwid/. You can also modify PATH const at the beginning of .pas file for the different path.
Uses:
* Explode function by DorkeyDear (http://soldatcentral.com/index.php?page=profile&u=4), CurryWurst (http://forums.soldat.pl/index.php?action=profile;u=10539)
---
(http://img4.imageshack.us/img4/4158/downloadiz.gif) (http://forums.soldat.pl/index.php?action=dlattach;topic=40047.0;attach=28008)
---
Code: {snippets}
Procedure RecognisePlayer(ID: byte);
var
i: integer;
infile: array of string;
data: array of tData;
guid: string;
begin
guid := GetPlayerStat(ID,'MSAC.GUID');
While ContainsString(guid,':') do
begin Delete(guid,StrPos(':',guid),1); end;
if FileExists(PATH+guid+EXT) then
begin
infile := Explode(ReadFile(PATH+guid+EXT),chr(13)+chr(10));
for i:=0 to ArrayHigh(infile)-1 do
begin
SetArrayLength(data,i+1);
data[i] := LoadLine(infile[i]);
if i=19 then break;
end;
for i:=0 to GetArrayLength(data)-1 do
begin
Player[ID].Names[i+1] := data[i].Name;
Player[ID].NamesC[i+1] := data[i].Count;
if i=19 then break;
end;
Player[ID].RealName := Player[ID].Names[1];
end
else
Player[ID].RealName := 'unknown';
end;
Questions? Bugs? Report please --> macekmil@gmail.com
-
Great job Mighty :)
-
Interesting script, thank you, however what is the following line for (not what it does, why it does exactly that):
Delete(guid,8,1);
-
the GUID MSAC generates is XXXXXXXX:XXXXXXXX
Names of files i create here are guids, but since name of a file cant include colon, i had to delete it.
-
The size of GUIDs generated by MSAC can vary depending on the amount of data used to create it. Therefore, there can be more than just one colon in the string returned by GetPlayerStat.
If there is more than one, your script will probably not work correctly, if there is none at all (also possible) your script will crash as you access data that does not exist. Also it is not said that each part of the GUID is 8 chars long. It can basically have any size from 2 to 8 chars.
Please also make sure to only get the GUID after MSAC received it (MSAC_OnConnect signals this), else GetPlyerStat will return an empty string.
-
ugh... to help improving it a lil' bit i paste here quicksort (http://en.wikipedia.org/wiki/Quicksort) implementation
//t: array to be sorted, l: start point of sorting (most likely 0), r: end point of sorting (most likely GetArrayLength(t)-1), asc: true if ascending, false if descending
procedure quicksort(var t: array of integer; l,r:integer; asc: boolean);
var
pivot,b,i,j:integer;
begin
if l < r then
begin
pivot := t[random(l+1, r+1)];
//pivot:=t[(l+r) div 2 + 1];
i := l-1;
j := r+1;
repeat
if asc then begin
repeat i := i+1 until pivot <= t[i];
repeat j := j-1 until pivot >= t[j];
end else begin
repeat i := i+1 until pivot >= t[i];
repeat j := j-1 until pivot <= t[j];
end
b:=t[i]; t[i]:=t[j]; t[j]:=b
until i >= j;
t[j]:=t[i]; t[i]:=b;
quicksort(t,l,i-1, asc);
quicksort(t,i,r, asc);
end;
end;
sorted array is returned via reference
-
For those who've downloaded the very first version of script, please delete all data stored in ../AntiFakeGUID/guid/ . For those who've downloaded the script today:
Ok, i know it's pretty much sad, but I failed again, omitting one bugfix which was essential, noticed it online, which was too late already. And once again the .pas file must be updated.
-
very nice script thanks! works greatly
-
Updated to work with HWIDs
http://forums.soldat.pl/index.php?action=dlattach;topic=40047.0;attach=28008
-
C'mon repair those memory leaks in 2.7.2 version. The script is awesome.
-
I'm short on free time lately, I definitely will do that ASAP...
-
I'd like to see total time spent on server when I use readwhoiz on a specific player.
-
Also /whoiz hwid would be nice
-
this script crashes if ran on more than one server and they both launch in more or less perfect sync. Crashes on both with Access Denied exception when attempting to sort files.
-
That is more helpful than you may think! Thanks!
-
It looks like after the latest release, this only works when checking against PIDs but not the actual player's name. :(