User:RoadKillPuppy

From WolfWiki

Contact

2655845734090fc0ecc1e0.jpg

Oh and btw: excuse me for my wiki-noobness...

etpro-lua - playsound.lua

The following script enables the playsound command when using etpro. By feeding the server with the correct sound-files (pk3-based that is), it's possible for etadmin_mod to spam spree_sounds.

-- RoadKillPuppy's PlaySound / etpro lua module
-- ex. 'rcon rconpass playsound -1 sound/etpro/hit.wav'
--     'rcon rconpass playsound_env 10 sound/etpro/hit.wav'
--
-- copypasted 99% of the code from ReyalP's wolfwiki page
-- thx r0f`deej for testing...  May your sprees be remembered!
--
-- 0.1 rkp
-- 0.2 rkp: dirty implementation of -1 parameter used by etadminmod
-- 0.3 rkp: workaround for etpro beta racecondition
-- 0.4 rkp: cleaned-up version for etpro 3.2.3
-- 0.5 rkp: added playsound_env command

-- global varlist
PlaySoundVersion = "0.5"

-- called when game inits
function et_InitGame( levelTime, randomSeed, restart )
        et.RegisterModname( "rkp_playsound-" .. PlaySoundVersion .. " " .. et.FindSelf() )
        et.G_Print( "RoadKillPuppy's PlaySound version " ..  PlaySoundVersion .. " activated...\n" )
end

-- some help
function PlaySoundHelp()
        et.G_Print("playsound -1 plays a sound that everybody on the server can hear\n");
        et.G_Print("usage: playsound -1 path_to_sound.wav\n");
end

function PlaySoundEnvHelp()
        et.G_Print("playsound_env plays a sound that you can hear in the proximity of the player with slot -playerslot-\n");
        et.G_Print("usage: playsound_env playerslot path_to_sound.wav\n");
end

-- react on new console command
function et_ConsoleCommand()
        if et.trap_Argv(0) == "playsound" then
                if et.trap_Argc() ~= 3 then
                        PlaySoundHelp()
                else
                        et.G_globalSound(et.trap_Argv(2));
                end
                return 1
        end

        if et.trap_Argv(0) == "playsound_env" then
                if et.trap_Argc() ~= 3 then
                        PlaySoundEnvHelp()
                else
                        soundindex = et.G_SoundIndex( et.trap_Argv(2) )
                        et.G_Sound( et.trap_Argv(1) , soundindex )
                end
                return 1
        end

        return 0
end

playsound.lua_V0.5 direct link for wget's sake

etadmin_sounds.pk3 pk3 with et_adminmod wav files (thx mark)

For a quick howto:

- ET Pro >= 3.2.3

- add -->set lua_modules "playsound.lua"<-- to server.cfg

- copy the lua script and sound pk3 into your etpro dir

- test with 'rcon rconpass playsound -1 sound/etpro/hit.wav' and 'rcon rconpass playsound -1 sound/misc/killingspree.wav'