decodeString | Multi Theft Auto: Wiki Skip to content

decodeString

Client-side
Server-side
Shared
Needs checking

This function was partially migrated from the old wiki. Please review manually:

  • Missing section: Options for each algorithm

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function decodes an encoded string using the specified algorithm. The counterpart of this function is encodeString.

Syntax

decodeString ( )

Code Examples

server

Adds a/decodecommand in which you can provide an algorithm, key and data to decode.

addCommandHandler("decode",
function(player, _, algorithm, key, ...)
if algorithm and key then
local text = table.concat({...}, " ")
if type(text) == "string" and text ~= "" then
local decoded = decodeString(algorithm, text, { key = key })
if decoded then
outputChatBox("The result of " .. algorithm .. " decoding is: " .. decoded, player)
else
outputChatBox("Failed to decode. Make sure that all arguments are valid.", player, 255, 0, 0)
end
else
outputChatBox("Please specify text in the command.", player, 255, 0, 0)
end
else
outputChatBox("Invalid algorithm and/or key.", player, 255, 0, 0)
end
end
)