LUA Module zusammenfassen?

Alles rund um das scripten und Server aufsetzen
Antworten
Luk Luk
Stürmer
Stürmer
Beiträge: 53
Registriert: Fr 28. Sep 2007, 01:09
Alter: 32

LUA Module zusammenfassen?

Beitrag von Luk Luk »

Hallo, ich möchte von NoQuarter durch diverse Bugs auf ETPRO umsteigen.

Und zwar habe ich mir .lua Dateien runtergeladen, die das SELFKILLEN verhindern, die erweiterte REF Kommandos geben sollen, die HP des Killers anzeigen und Spawnkilling verhindern sollen.

In Etpro kann man ja nur ein Mal das eingeben:

Code: Alles auswählen

set lua_modules "name.lua"
Ich habe, da es ja nur eine solche Bezeichnung gibt, ALLE .lua Dateien in eine reinkopiert.

Das Problem ist: Nicht eine einzige funktioniert!

Was braucht ihr? Was mache ich falsch? Danke für jede Antwort!
Luk Luk
Stürmer
Stürmer
Beiträge: 53
Registriert: Fr 28. Sep 2007, 01:09
Alter: 32

Beitrag von Luk Luk »

26 Mal gelesen, kann mir keiner helfen? :(
Sorry, ich hoffe schnell auf eine Antwort ;)
Bild
Benutzeravatar
WoodSTokk
Helpdesk
Helpdesk
Beiträge: 2634
Registriert: Fr 6. Dez 2002, 03:09
Wohnort: Wien/Österreich/Europa/Erde
Alter: 53

Beitrag von WoodSTokk »

Sorry, ich kenne LUA-Scripte nur von WOW.
Wie sie in ETpro integriert werden weis ich leider nicht.
Du scheisst es nicht zu wetzen
Testserver: @peStable (95.129.206.243:27960)
silver
Hero of City
Hero of City
Beiträge: 4731
Registriert: Di 1. Jul 2003, 17:35
Wohnort: Castle Wolfenstein
Kontaktdaten:

Beitrag von silver »

woodstokk du spielst wow? :shock:

luk luk, kannst du mal die 2 luas posten? dann kann ich mal schaun, vielleicht weiß ich ja weiter.
Bild
Bild
[url=irc://de.quakenet.org/wolfenstein-city]#wolfenstein-city @ quakenet[/url]
https://rtcw-city.de
www.EnemyTerritory.de
Luk Luk
Stürmer
Stürmer
Beiträge: 53
Registriert: Fr 28. Sep 2007, 01:09
Alter: 32

Beitrag von Luk Luk »

Hier mal 2 von 5 Lua Modulen, die ich einbinden möchte, ich teste grade, ob sie einzeln funktionieren.

Anti-Spawnkill-Lua:

Code: Alles auswählen

--------------------------------------------------------------------------------
-- ETWsk - ETW-FZ Enemy Territory Anti-Spawnkill Mod for etpro
--------------------------------------------------------------------------------
-- This script can be freely used and modified as long as [ETW-FZ] and the 
-- original author are mentioned.
--------------------------------------------------------------------------------
module_name    = "ETWsk"
module_version = "0.8"
Author         = "[ETW-FZ] Mad@Mat , Editor [ETW-FZ] schnoog"
--------------------------------------------------------------------------------
-- DESCRIPTION
--------------------------------------------------------------------------------
-- ETWsk aims to reduce spawnkilling (SK) on public funservers. An SK here is if
-- someone kills an enemy near a fix spawn point. A fix spawn point means that
-- it can not be cleared by the enemy. E.g. on radar map, the allied Side Gate 
-- spawn is not fix as the axis can destroy the command post. However, the Main
-- Bunker spawn is fix after the Allies have destroyed the Main Gate. ETWsk does
-- not prevent but it detects and counts SKs for every player. If a player has
-- caused a certain number of SKs, he gets punished (putspec, kick, ban, ...).
-- As the detection of fix spawns is difficult especially on custom maps, little
-- configuration work has to be done.
--
-- Features:
--     - circular protection areas around spawn points
--     - two protection radius can be defined: heavy weapons and normal weapons
--     - the spawn protection expires when a player hurts an enemy
--       (can be disabled)
--     - fully configurable for individual maps: fixing radius, positions;
--       adding actions that change protected areas during the game; adding new
--       protection areas.
--     - client console commands for stats and help for configuration
--     - no RunFrame() -> low server load
--------------------------------------------------------------------------------
-- CONFIG
--------------------------------------------------------------------------------
ETWsk_putspec = 3                -- number of sk's needed for setting a client
                                 -- to spectators
ETWsk_kick = 4                   -- number of sk's needed for kicking a client
ETWsk_kicklen = 5                -- duration of kick
ETWsk_defaultradius1 = 400       -- protection radius for ordinary weapons
ETWsk_defaultradius2 = 800       -- protection radius for heavy weapons
ETWsk_savemode = 1               -- if enabled, protection is only active on
                                 -- maps that are configured
ETWsk_expires = 1                -- if enabled, spawn protection expires when
                                 -- the victim hurts an enemy
ETWsk_MapConfigFolder = "mapSpawns" --Subfolder for the map configurations e.g. mapSpawns for /etpro/mapSpawns
--------------------------------------------------------------------------------
heavyweapons = {17,27,57,30}     -- heavy weapon indexes 
                                 -- (pf, mortar, airstrike, arty)
maxcheckpointdist = 800          -- used to detect capturable flag poles
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-- CONSTANTS
NO_PROTECT     = 0
PROTECT_AXIS   = 1
PROTECT_ALLIES = 2
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
function getConfig(map)
--------------------------------------------------------------------------------
-- configures protection of spawn areas in specific maps
--------------------------------------------------------------------------------
--	elseif map == "<the>" then
--		<spawn>
--		<action>
--------------------------------------------------------------------------------
-- spawn definitions:
--      c.spawn[<spawn>] = {<spawn>}
-- spawn-num: spawn index (see /etwsk_spawns command)
-- spawn-fields: - comma-separated list of "key = value"
--               - for existing spawns all fields are optional (they overwrite
--                 default values).
--               - fields:
--                     name = <String>  : name of spawn point
--                     state = NO_PROTECT|PROTECT_ALLIES|PROTECT_AXIS
--                     pos = {x,y,z}    : map coordinates of spawn point 
--                     radius1 = <Int>  : protection radius for normal weapons
--                     radius2 = <Int>  : protection radius for heavy weapons
-- action definitions: actions are definitions of transitions of one state of a
--                     spawn point into another one triggered by a message.
--      c.action[<action>] = {<action>}
-- action-num: just an increment number
-- action-fields: - comma-separated list of "key = value"
--                - all fields are mandatory
--                - fields:
--                     spawn = <spawn>
--                     newstate = NO_PROTECT|PROTECT_ALLIES|PROTECT_AXIS
--                     trigger = <String>: part of a message that is displayed
--                                         by the server on a specific event.
-- adding new protection areas to maps:
--     new protection areas can easily been added:
--     1. enter the map and walk to the location where you want to add the area
--     2. type /etwsk_spawns and remember the highest spawn index number
--     3. type /etwsk_pos and write down the coordinates
--     4. add spawn to config with at least the name,state and pos field to a text
--To do this, create an empty text file and add the following lines:
-----------------Begin of map config
--local c = {spawns = {}, actions = {}, defaults = true}
-- --define your spawns here--
--return c
-----------------End of map config
--and save the file as "mapname.lua" in your ETWsk_MapConfigFolder
-- default values:
--     At mapstart, ETWsk scans for all spawnpoints and sets the state either to
--     PROTECT_ALLIES or PROTECT_AXIS. It also scans for capturable flag poles
--     and sets the state of a spawnpoint near a flag pole to NO_PROTECT. The
--     location of a spawnpoint is taken from the WOLF_objective entity, the
--     small spawn flag that can be selected in the command map. This entity is
--     usually placed in the center of the individual player-spawnpoints.
--     However, on some maps this is not the case. Check the positions of the
--     small spawn flags on the command map or type /etwsk_pos after you have
--     spawned to check the distance to protected areas. If needed, adjust the 
--     radius, or the pos or add a new protection area to the map.
--     If you wish to set all protection areas manually in a map, add:
--         c.defaults = false
--     to the definitions for a map.
--------------------------------------------------------------------------------
	--hier testen ob datei (etpro/mapsk/map.lua) existiert = hasconfig
	--wenn existiert auslesen und in c speichern
	--aus ETAsk:  dofile(et.trap_Cvar_Get("fs_homepath") .. '/etpro/mapSpawns/ETAsk.lua')
local c = {spawns = {}, actions = {}, defaults = true}
file = ETWsk_MapConfigFolder .. "/" .. map .. ".lua"
fd,len = et.trap_FS_FOpenFile(file, et.FS_READ)
    if len == -1 then
        strm = " ^2Sorry, no spawn configuration found for this map (^4" .. map .. "^2)..ETWsk disabled"
        et.trap_SendConsoleCommand(et.EXEC_APPEND, "say" .. strm)
        hasconfig = false 
    else
        --et.trap_SendConsoleCommand(et.EXEC_APPEND, "say konfig" .. file .. " gefunden")
        hasconfig = true 	
	et.trap_FS_FCloseFile(fd)
    	--dofile(et.trap_Cvar_Get(file))
    	loadfile(et.trap_Cvar_Get(file))
--    	dofile(et.trap_Cvar_Get("fs_homepath") .. '/etpro/' .. file)
--		loadfile(et.trap_Cvar_Get("fs_homepath") .. '/etpro/' .. file)
    end

return c
end


--------------------------------------------------------------------------------
-- called when client types a command like "/command" on console
function et_ClientCommand(cno, command) 
--------------------------------------------------------------------------------
-- commands: 
--     etwsk        : prints mod info and current spawnkill statistics
--     etwsk_spawns : prints list of spawnpoints with current state
--     etwsk_pos    : prints current position and distances to protected spawns
--------------------------------------------------------------------------------
    local cmd = string.lower(command) 
    if cmd == "etwsk_spawns" then 
        --et.trap_SendConsoleCommand(et.EXEC_APPEND, "say aaaaaaaaaaaaaaaaaaaaaaaaa")
		printSpawns(cno)
        return 1 
    elseif cmd == "etwsk_pos" then
        printPos(cno)
        return 1
    elseif cmd == "etwsk" then
        printStats(cno)
        return 1
    end 
    return 0 
end 

--------------------------------------------------------------------------------
-- calculates the distance
-- note: not true distance as hight is doubled. So the body defined by constant
--       distance is not a sphere, but an ellipsoid
function calcDist(pos1, pos2)
--------------------------------------------------------------------------------
	local dist2 = (pos1[1]-pos2[1])^2 + (pos1[2]-pos2[2])^2 
                  + ((pos1[3]-pos2[3])*2)^2
    return math.sqrt(dist2)
end
    
--------------------------------------------------------------------------------
-- called at map start
function et_InitGame( levelTime, randomSeed, restart)
--------------------------------------------------------------------------------
    local modname = string.format("%s v%s", module_name, module_version)
    et.G_Print(string.format("%s loaded\n", modname))
    et.RegisterModname(modname)

    mapname = et.trap_Cvar_Get("mapname")
    c = getConfig(mapname)
	
    damagegiven = {}
    spawnkills = {}
    
    local checkpoints = {}
    -- find capturable flag poles
    for i = 64, 1021 do
        if et.gentity_get(i, "classname") == "team_WOLF_checkpoint" then			
            table.insert(checkpoints,i)
        end
    end
	-- complete config with default extracted values
    local spawn = 1
    for i = 64, 1021 do
        if et.gentity_get(i, "classname") == "team_WOLF_objective" then
		local pos = et.gentity_get(i, "origin");
    		if c.spawns[spawn] == nil then 
			c.spawns[spawn] = {} end
		if c.spawns[spawn].name == nil then 
			c.spawns[spawn].name = et.gentity_get(i, "message") end
		if c.spawns[spawn].pos == nil then 
			c.spawns[spawn].pos = et.gentity_get(i, "origin") end
		if c.spawns[spawn].state == nil then 
			local iscapturable = false
			for k,v in pairs(checkpoints) do
            			local cp = et.gentity_get(v, "origin")
				if(calcDist(c.spawns[spawn].pos, cp) <maxcheckpointdist>= 0 then 
        et.trap_SendServerCommand(cno, 
			"print \"^4ETW^2sk:^7 Mapname: ^3"..mapname.."\n\"")
    end  
    for i,spawn in pairs(c.spawns) do
        if cno == -1 then et.G_Printf(
			"ETWsk> Spawn %d \"%s\" %s \n", i, spawn.name, protect[spawn.state])
        else et.trap_SendServerCommand(cno, "print \"^4ETW^2sk:^7 Spawn ^3"..
			i.."^7 "..spawn.name.." "..protect[spawn.state].."\n\"")
		end
    end
end

--------------------------------------------------------------------------------
function printPos(cno)
--------------------------------------------------------------------------------
    local pos = et.gentity_get(cno, "r.currentOrigin")
    local spos = string.format('%d, %d, %d',
		unpack(pos))
    et.trap_SendServerCommand(cno, 
		"print \"^4ETW^2sk:^7 current pos: "..spos.."\n\"")
    local team = et.gentity_get(cno, "sess.sessionTeam")
    local protect_normal = "^2protected_normal"
    local protect_heavy = "^2protected_heavy_only"
    for i,spawn in pairs(c.spawns) do
	local protect = "^1not protected"
        if spawn.state == team then
            local dist = calcDist(pos, spawn.pos)
            if dist < spawn.radius1 then 
				protect = protect_normal
            elseif dist <spawn> damagegiven[victim]) then return end
    end
    -- was heavyweapon?
    local isheavy = false
    for k,v in pairs(heavyweapons) do
        if (meansOfDeath == v) then isheavy = true end
    end
    -- protected spawn?
    local vpos = et.gentity_get(victim, "r.currentOrigin")
    local isprotected = false
    local dist2
    local radius2
    for i,spawn in pairs(c.spawns) do
        if spawn.state == vteam then
            if(isheavy) then
                radius2 = spawn.radius2
            else
                radius2 = spawn.radius1
            end
            dist = calcDist(vpos, spawn.pos)
			if(dist < radius2) then
                ClientSpawnkill(victim, killer, isheavy)
			end
        end
    end
end

--------------------------------------------------------------------------------
-- called when ETWsk has detected a spawnkill
function ClientSpawnkill(victim, killer, isheavy)
--------------------------------------------------------------------------------
    if killer <0>= ETWsk_putspec and numsk <ETWsk_kick>= ETWsk_kick) then
	et.trap_SendConsoleCommand(et.EXEC_APPEND, "pb_sv_kick \""..killername.."\" "..ETWsk_kicklen.." \"too many spawnkills!\"\n") 
	et.trap_SendServerCommand(-1, "cpm \"^4ETW^2sk: ^0"..killername..
			" ^2has been kicked - too many Spawnkills!\"\n")
    else
	et.gentity_set(killer, "health", -511)
    end
   
end

--------------------------------------------------------------------------------
-- printf wrapper
function et.G_Printf(...)
--------------------------------------------------------------------------------
    et.G_Print(string.format(unpack(arg)))
end



Und hier das Anti-Selfkill-Skript-Lua:

Code: Alles auswählen

------------------------------------------------------------------------
-- nokill.lua -- Version 1.1
--
-- (c) 2005 infty -- guidebot@gmx.net
--
------------------------------------------------------------------------
--
-- Completely disables the /kill command by intercepting it in the 
-- et_ClientCommand callback. Displays a notifcation to the player who 
-- tried the /kill that it is disabled. Doesnt kick players.
--
------------------------------------------------------------------------


function et_ClientCommand(client, command)
  if string.lower(command) == "kill" then
    et.trap_SendServerCommand( client, "cp \"^1Sorry, selfkilling is disabled on this server.\n\"" )
    return 1 
  end
end

Danke, Luk Luk
Bild
Luk Luk
Stürmer
Stürmer
Beiträge: 53
Registriert: Fr 28. Sep 2007, 01:09
Alter: 32

Beitrag von Luk Luk »

Habs einzeln getestet:
Anti Seflkill funktioniert, Anti Spawnkill nicht :(

EDIT:
Und, schon was herausgefunden?

EDIT 2:
Kann man die nicht "execen"? Sonst würde ich jede einzeln ausführen......
Bild
Luk Luk
Stürmer
Stürmer
Beiträge: 53
Registriert: Fr 28. Sep 2007, 01:09
Alter: 32

Beitrag von Luk Luk »

Hallo, sorry für den Triplepost, aber ich muss noch was loswerden, damit es alle sehen.

In der Dokumentation des Anti-Spawnkill-Lua-Skripts steht, dass man mehrere lua Module durch einfaches Platzlassen
addieren kann!
Dies bedeutet:

Code: Alles auswählen

set lua_modules "ETWsk.lua nokill.lua announcement.lua name.lua naechste.lua usw.lua"
Danke trotzdem!!!
Bild
silver
Hero of City
Hero of City
Beiträge: 4731
Registriert: Di 1. Jul 2003, 17:35
Wohnort: Castle Wolfenstein
Kontaktdaten:

Beitrag von silver »

also ich muss ehrlich gesagt passen. hatte mit lua noch nichts zutun und seh da jetzt auch nicht wirklich worans liegen kann. vielleicht werden die selben variablen verwendet oder sowas.
Bild
Bild
[url=irc://de.quakenet.org/wolfenstein-city]#wolfenstein-city @ quakenet[/url]
https://rtcw-city.de
www.EnemyTerritory.de
Luk Luk
Stürmer
Stürmer
Beiträge: 53
Registriert: Fr 28. Sep 2007, 01:09
Alter: 32

Beitrag von Luk Luk »

Ich werde diesbezüglich mal den Autor kontaktieren.
Bild
maelli
Jungspund
Jungspund
Beiträge: 12
Registriert: Di 14. Apr 2009, 21:16
Alter: 34

Beitrag von maelli »

Es sollte klappen wenn du die Module zb.

modul1.lua
modul2.lua
modul3.lua

Code: Alles auswählen

set lua_modules "modul1.lua modul2.lua modul3.lua"
Wenn du auf dem Server bist kannst du mit /rcon rconpass lua_status den Status abfragen ob die Module geladen sind.

Bei mir klappts so ;D

MFG
Antworten