Thread: [Essentials Script] Password Gift
View Single Post
Old March 4th, 2012 (8:23 AM).
help-14's Avatar
help-14 help-14 is offline
Join Date: Jul 2007
Location: Viet Nam
Age: 24
Gender: Male
Nature: Adamant
Posts: 282
Send a message via Windows Live Messenger to help-14
Originally Posted by Ho-oh 112 View Post
Well, this is great as a starter but, for some better scripts you should atleast let people "compile" items/pokemon/eggs without needing pre-defined passwords(a password generator)
That's a really good idea and i think it is possible. First you need a key so no one will able to fake it:
$SecretKey = "some crazy text"
Encrypt method will be something like this:
def Encrypt(pokemon,switch)
   return  Zlib::Inflate.inflate(Zlib::Inflate.inflate(pokemon+"|"+switch)+$SecretKey)
And Decrypt mothod
def Decrypt(pass)
  arg = (Zlib::Deflate.deflate(Zlib::Deflate.deflate(pass).gsub($SecretKey, ""))).split("|")
  @pokemon = arg[0]
  @switch = arg[1]
  #Do something
Reply With Quote