Welcome to the PtokaX Wiki!
This wiki is devoted to let users share information on the great hubsoft PtokaX. However, it is not limited to PtokaX, it is destined to share and discuss information on different parts of the LUA programming language, but the site is NOT intended to be a replacement for the primary LUA Board aka the PtokaX Portal, nor the secondary LUA Board or the PtokaX resources.
If you’re not familiar with wikis then in short: they are user-contributed sites: pages can be edited by (almost) anyone. As such, there is always kind of up-to-date and (hopefully) proper content. They are better than forums, since relevant pieces of information are on the same page. Do not hesitate to share your knowledge, and we all hope you can learn and teach a lot here! — bastya_elvtars
Trace: » Advanced settings » Command Types (client to server) » s2s » Command Types (client to client) » The PtokaX WSA library » Overview of the PtokaX API1 » lock2key » Overview of the PtokaX API2 » Client to Server Login » createlock
Appendix B: Creating a Lock
Creating a Lock is much easier than decoding one. There are only a few things to keep in mind when creating a Lock.
First the Lock should be between 80 and 134 ascii characters long but it does not have to be.
Second the Pk should always be 16 ascii characters long but like the lock this is just a suggested length.
Third the characters with the decimal ASCII values of 0, 5, 36, 96, 124, and 126 must be substituted with the string /%DCN000%/, /%DCN005%/, /%DCN036%/, /%DCN096%/, /%DCN124%/, or /%DCN126%/, respectively.
First we must create the actual Lock you can use random ascii characters for this.
for(int i = 0; i < RandLenOfLock; i++) {
lock[i] = (char)(94.0 * Math.random() + 33);
}
Now that the lock has been created lets create our Pk. Because there are so many Direct Connect clients popping up its probably a good idea to include your client type and version instead of a random Pk.
for(int i = 0; i < 16; i++) {
pk[i] = (char)(94.0 * Math.random() + 33);
}
There you go now all you have to do is send the data using the correct syntax.
You are here: About the Wiki » misc » dcprotocol » createlock