Jump to content

Simple Tea Script


Atton

Recommended Posts

The code uses 2 text files outPut.txt and inPut.txt you will need to make them.

Put say your name into the inPut then do enCode or /enCode then it will be stored in the outPut.

It might be a good idea to change the code at [Key =] it might be helpful.

  
Key = 5453487089 
function decCode () 
    local outPut = fileOpen("outPut.txt") 
    local inPut = fileOpen("inPut.txt") 
     
    local size1 = fileGetSize(outPut) 
    local size2 = fileGetSize(inPut) 
     
    local data = fileRead(inPut,size2) 
    local Code = teaDecode(tostring(data),tostring(Key)) 
    fileWrite(outPut,tostring(Code)) 
    fileClose(outPut) 
    fileClose(inPut) 
end 
addCommandHandler("deCode",decCode) 
  
function enCode () 
    local outPut = fileOpen("outPut.txt") 
    local inPut = fileOpen("inPut.txt") 
     
    local size1 = fileGetSize(outPut) 
    local size2 = fileGetSize(inPut) 
     
    local data = fileRead(inPut,size2) 
    local Code = teaEncode(tostring(data),tostring(Key)) 
    fileWrite(outPut,tostring(Code)) 
    fileClose(outPut) 
    fileClose(inPut) 
end 
addCommandHandler("enCode",enCode) 
  
  

  
--Try to decode this  
--You will need to use the default code for this. 
VvYrt0ECvfYzNfmAsYF2CTBdE/gOqrOTKYjGrbL44PZMyEt6OwPbmLT+2+ilqDagnKOMmm0rANkgHzRKiEoJf2v+C4YsUqK/ 
  

https://wiki.multitheftauto.com/wiki/TeaEncode

https://wiki.multitheftauto.com/wiki/TeaDecode

Link to comment
I don't see the purpose of storing it in a file when you can just output the code directly to the chatbox.

Sometimes it doesn't even fit in the chatbox.

Well in that case you can always output it in a GUI memo rather than a text file. There's always a slightly better solution.

I was thinking about making a gui for it but to be honest it was not really worth it.

I might make one later on however maybe some time in the next few days.

  
--[[ 
This script was made by Atton in 2014. [MTA COMMUNITY] 
Users are free to modify this script as long as it is for personal use only. 
No assurances and or warranties will be provided use at your own risk. 
Please do not distribute this code in a modified form without giving credit. 
]]-- 
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 591, 401 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    troot = guiCreateWindow(left, top, windowWidth, windowHeight, "Tea GUI", false) 
    guiWindowSetSizable(troot, false) 
     guiSetVisible(troot, false) 
    codeE = guiCreateMemo(440, 75, 131, 31, "[Your Code Here]", false, troot) 
     guiSetVisible(troot, false) 
     
    encodeB = guiCreateButton(440, 165, 111, 41, "Encode", false, troot) 
    decodeB = guiCreateButton(440, 215, 111, 41, "Decode", false, troot) 
    wbB = guiCreateButton(440, 265, 111, 41, "Clear All Boxes", false, troot) 
    closeB = guiCreateButton(440, 315, 111, 41, "Close", false, troot) 
     
    outputl = guiCreateLabel(20, 185, 91, 31, "Output", false, troot) 
    guiLabelSetHorizontalAlign(outputl, "left", false) 
    guiLabelSetVerticalAlign(outputl, "center") 
     guiSetVisible(troot, false) 
    inputF = guiCreateLabel(20, 15, 91, 31, "Input", false, troot) 
    guiLabelSetHorizontalAlign(inputF, "left", false) 
    guiLabelSetVerticalAlign(inputF, "center") 
     guiSetVisible(troot, false) 
    Codel = guiCreateLabel(440, 45, 91, 21, "Code", false, troot) 
    guiLabelSetHorizontalAlign(Codel, "left", false) 
    guiLabelSetVerticalAlign(Codel, "center") 
  
    inputBox = guiCreateMemo(20, 45, 361, 131, "", false, troot) 
    outputBox = guiCreateMemo(20, 215, 361, 131, "", false, troot) 
    guiSetVisible(troot, false) 
     
function enCodef () 
local Key = guiGetText(codeE) 
local cdata = guiGetText(inputBox) 
local Code = teaEncode(tostring(cdata),tostring(Key)) 
    guiSetText(outputBox,tostring(Code)) 
end 
addEventHandler("onClientGUIClick",encodeB ,enCodef)     
  
function deCodef () 
local Key = guiGetText(codeE) 
local cdata = guiGetText(inputBox) 
local Code = teaDecode(tostring(cdata),tostring(Key)) 
    guiSetText(outputBox,tostring(Code)) 
end 
addEventHandler("onClientGUIClick",decodeB ,deCodef)     
  
function dtf () 
    guiSetText(outputBox,"") 
    guiSetText(inputBox,"") 
    guiSetText(codeE,"") 
end 
addEventHandler("onClientGUIClick",wbB ,dtf) 
  
function closef() 
     guiSetVisible(troot, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick",closeB ,closef) 
  
function Aguif() 
        if (guiGetVisible(troot)) then 
                guiSetVisible(troot, false) 
                showCursor(false) 
        else 
                guiSetVisible(troot, true) 
                showCursor(true) 
    end 
end 
addCommandHandler("tea", Aguif) 
  

I might upload it to the mta community later.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...