Quote:
Originally Posted by froducish
.. one can just make a mutator with the functionality you mentioned. In fact last time I joined the NC server I noticed it had a mutator like this, albeit flawed since it also tries to auto-bans user based on generated uids .....
|
.
in this post i want to talk about this mutator that generate uids
because i think it fits, into this discussion
first i had in mind to self build such a mutator, but my (german friend) k10-287[HsC], he builded a few days bevore me, this mutator and it is a awesome masterpiece
i'am absolutly sure, it will be very interesting for you all, to see here the code from it
and you sure will also like it!! to take a eye on the code:
.
player_identifier.mut
Code:
// Version 0.1 - Last update 22.05.26 - By k10
#pragma name "Player Identifier"
#pragma description "Provides an identifier of players for other modules"
const string configFileName = "upid.asdat";
string currentUPID = "";
void onLevelLoad() {
jjSTREAM file(configFileName);
jjAlert("Type ||!myid |to see your current unique player id");
if (file.isEmpty()) {
file.push(generateIdentifier());
file.save(configFileName);
jjAlert("|||>> UPID assigned");
} else {
file.pop(currentUPID);
}
}
bool onLocalChat(string &in text, CHAT::Type)
{
if(text == "!myid"){
if (currentUPID.length == 0) {
jjSTREAM file(configFileName);
file.pop(currentUPID);
}
jjAlert("Your current UPID is: |||" + currentUPID);
return true;
}
return false;
}
/**
* Generates id via combining various constants
* TODO : This is a shitty way of generating an id. Some
* sort of hash value would be way better, but I am
* way to lazy to do that right now
**/
string generateIdentifier() {
string timeInSec = "" + jjUnixTimeSec();
string playerName = p.nameUnformatted;
string randomID = "" + jjRandom();
string ticks = "" + jjGameTicks;
return timeInSec + randomID + ticks + playerName + jjLevelFileName;
}
|