Big things come in small packages scripts.
The snippet is made to replace the admin system in our scripts, where a player is required to type their name in order to have control of it's functionality. Itwill automatically detect the name of the player who loaded the script, and the name will be stored in the
However if scripts already have an admin variable present in them, you can change the variable name from
I hope people who like to code and make scripts benefit from this small snippet.
A shorter method:
code_language.lua:
function check()
local a = { 1, 2, 3, 4 }
return #a[1]
end
local _, error = pcall(check)
local loader = string.match(error, "[^:]+")
print(loader)
The snippet is made to replace the admin system in our scripts, where a player is required to type their name in order to have control of it's functionality. Itwill automatically detect the name of the player who loaded the script, and the name will be stored in the
loader variable.However if scripts already have an admin variable present in them, you can change the variable name from
loader to admin or the variable name that the script uses.- Paste the snippet at the very start of your script
- Use the loader variable.
code_language.lua:
function eventChatCommand(name, message)
if message == "mort" then
tfm.exec.killPlayer(name)
elseif message:sub(1, 4) == "kill" and name == loader then
tfm.exec.killPlayer(message:sub(6))
end
end
I hope people who like to code and make scripts benefit from this small snippet.
A shorter method:
You can use anonymous function as argument, it works too.code_language.lua:local _,get = pcall(function() return #nil end) local adm = string.match(get, "[^:]+")
Last edited:






