Thread: [Essentials script] Password Gift
View Single Post
  #5    
Old March 4th, 2012, 08:23 AM
help-14's Avatar
help-14
Trainer
 
Join Date: Jul 2007
Location: Viet Nam
Age: 21
Gender: Male
Nature: Adamant
Send a message via Windows Live Messenger to help-14
Quote:
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:
Code:
$SecretKey = "some crazy text"
Encrypt method will be something like this:
Code:
def Encrypt(pokemon,switch)
   return  Zlib::Inflate.inflate(Zlib::Inflate.inflate(pokemon+"|"+switch)+$SecretKey)
end
And Decrypt mothod
Code:
def Decrypt(pass)
  arg = (Zlib::Deflate.deflate(Zlib::Deflate.deflate(pass).gsub($SecretKey, ""))).split("|")
  @pokemon = arg[0]
  @switch = arg[1]
  #Do something
end
__________________
My Deviantart: help-14.deviantart.com
Reply With Quote