I know an awesome set of scripts have been written to bind player characters to CD Keys, and while I don't have a reason to not use it, I wanted to try to develop my own, mostly for the sake of learning and solidifying my understanding.
I'm wondering if my following basic scripts would be enough to protect people's characters?
On enter of an area or trigger, checks to see if PC has a storage item, and if not creates the item in the inventory and writes the player's CD key to the item
void main()
{
object oPC = GetEnteringObject();
string sKey = GetPCPublicCDKey(oPC);
if (!GetIsPC(oPC)) return;
if (GetItemPossessedBy(oPC, "Storage")!= OBJECT_INVALID)
return;
CreateItemOnObject("storage", oPC);
object oStorage = GetItemPossessedBy(oPC, "Storage");
SetLocalString(oStorage, "CDKey", sKey);
FloatingTextStringOnCreature("CD Key Bound To Character!", oPC);
}
Then we have the on client enter, which checks to make sure that the current CD Key matches the one stored on the characters storage item. If the item doesn't exist, it assumes it is a first log, otherwise it does the check. If the check fails, the player is kicked.
void main()
{
object oPC = GetEnteringObject();
string sKey = GetPCPublicCDKey(oPC);
object oStorage = GetItemPossessedBy(oPC, "Storage");
string sCDKey = GetLocalString(oStorage, "CDKey");
if (GetItemPossessedBy(oPC, "Storage")== OBJECT_INVALID){
FloatingTextStringOnCreature("First Time! Registering CD Key!", oPC);
return;
}
if(sKey == sCDKey){
FloatingTextStringOnCreature("CD Key Authenticated!", oPC);
}
else{
BootPC(oPC);
}
}
I know it is very simple, but is it effective? I've tested it by myself and it seems to work. What would the disadvantages to using this be, other than not being able to store multiple keys?
Modifié par EzRemake, 01 octobre 2013 - 06:34 .