11.02.2016, 21:49
(
Последний раз редактировалось thewildlima; 11.02.2016 в 22:07.
Причина: Better styling, and credits assigning.
)
Today I learned by trial-error, how to generate a unique UUID ( User Unique ID ) with a prefix!
Credits to RyDeR` for the original function "randomString".
Код:
stock GenerateUUID() { new UUID[9]; new SALT_LENGTH = 6; new SALT_PREFIX[] = "LRP"; // Change to whatever you want (3 letters only) new SALT[6]; while(SALT_LENGTH--) { SALT[SALT_LENGTH] = ( random(2) ? (random(26) + (random(2) + 'A')) : (random(10) + '0') ); } format(UUID, sizeof(UUID), "%s%s", SALT_PREFIX, SALT); return UUID; }