Guest User

Untitled

a guest
Oct 21st, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. function octopus.Serials:GenerateOctoSerial()
  2. local s = math.random( 100, 100000 )
  3.  
  4. if ( table.HasValue( self.Active, s ) ) then
  5.  
  6. -- A serial by this number already existed.
  7. print("Serial generated already was registered, recalculating...");
  8.  
  9. repeat
  10. s = math.random( 100, 100000 )
  11. until !table.HasValue( self.Active, s )
  12.  
  13. print("Serial was regenerated as " .. tostring(s) .. " successfully!");
  14. table.insert( self.Active, s );
  15. -- Save the serials here.
  16. self:Save();
  17. else
  18. table.insert(self.Active, s );
  19. -- Save the serials here.
  20. self:Save();
  21. end
  22.  
  23. return s
  24. end
  25.  
  26. function PlayerMeta:OctoID()
  27.  
  28. -- Don't let them pass without a steamid, obviously.
  29. if ( not self:SteamID() ) then return end
  30.  
  31. -- Then turn the steamid into a storable id
  32. local steamid = self:SteamID()
  33. local id = string.gsub( steamid,"STEAM","" );
  34. id = string.gsub( id,":","" );
  35. id = string.gsub( id,"_","" );
  36.  
  37. return id;
  38. end
Add Comment
Please, Sign In to add comment