Lua


(Timme) #1

ey,

I have running an ETPro server and i heart something about a Lua MOD that works togetter with etpro. so i went looking for this and i found it.

But my question now is how to get the codes to work?

Code :

function et_Obituary(victimnum, killernum, meansofdeath)
local victimteam = tonumber(et.gentity_get(victim, “sess.sessionTeam”))
local killerteam = tonumber(et.gentity_get(killer, “sess.sessionTeam”))
local posk = et.gentity_get(victim,“r.currentOrigin”)
local posv = et.gentity_get(killer,“r.currentOrigin”)

if victimteam ~= killerteam and killernum < 1022 then
local killername = string.gsub(et.gentity_get(killernum, “pers.netname”), “%^$”, "^^ ")
local killerhp = et.gentity_get(killernum, “health”)
killdist = dist(posk,posv)

  msg = string.format("cp  \"" .. killername ..  "^1 killed you from ^o" .. killdist .. " ^1m

^7He had ^o" … killerhp… “^7 HP”
")
et.trap_SendServerCommand(victimnum, msg)
end
end

Must i put it in wordpad or something like that ?

Lua MOD site : http://wolfwiki.anime.net/index.php/Lua_Mod_API

Timme


(kamikazee) #2

You just have to open a “bare text” editor, paste it, (Notepad works too, though it’s picky) then save it as a .lua file.

If you have a good editor, you might be able to save the file as a .lua file directly. When using Notepad, you have to save it as eg. “mymod.txt” first, after that you can rename it to “mymod.lua” if Windows shows file extensions.

To run it on a server, read Wolfwiki: LUA Tutorials: Loading a Script.