User:Phenomenon: Difference between revisions

From WolfWiki
Jump to navigation Jump to search
m changed download locations
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:ETPro:Mods]]
[[Category:ETPro:Mods]]
== ''personal profile'' ==
personal bla bla later ...


== ''lua script - <font color=red>playsoundcmd.lua</font>'' ==
<table><tr><td width=200>http://wowdev.org/wiki/images/thumb/9/95/Lua.gif/180px-Lua.gif</td><td>
'''''Homepage'''''
:''[http://www.force-opponents.de www.force-opponents.de]'' - Home of the Force Opponents Clan
'''''[[IRC]]'''''
:''[irc://irc.quakenet.org:6667/force-opponents #force-opponents]'' - channel on QuakeNet
</td></tr></table>


Converted "playsound" functionality from Tony J. White's ETPub Mod.
<br>


===== Requirements =====
<table width=100%>
<tr>
<td width=50% style="border: 1px solid #fabd23; color: #000; background-color: #fcfae3" valign=top>
<div style="padding: .5em .9em .9em">
== ''Scripts'' ==
:*''[[#LUA script - slacstatsaver.lua|slacstatsaver.lua]] (<font color="red">new</font>)''
:*''[[#LUA script - playsoundcmd.lua|playsoundcmd.lua]]''
:**''[[#ETAdmin_mod spree sounds HowTo|ETAdmin_mod spree sounds HowTo]]''
</div>
</td>
<td height=100%>&nbsp;</td>
<td width=50% style="border: 1px solid #fabd23; color: #000; background-color: #fcfae3" valign=top>
<div style="padding: .5em .9em .9em">
== ''Functions'' ==
:*''[[#LUA function - et.G_ClientSound()|et.G_ClientSound()]]''
</div>
</td>
</tr>
</table>


*Wolfenstein - Enemy Territory (patched to v2.60b) - ''[http://www.splashdamage.com splashdamage.com]''
<br>


*ET Pro 3.2.6 or higher - ''[http://etpro.anime.net etpro.anime.net]''
== ''LUA script - <font color=blue>slacstatsaver.lua</font>'' ==
This script fixes the "loosing XP and stats at reconnect" bug on a ''[http://sl-anticheat.com SLAC]'' addon enabled server.


===== Installation =====
===== '''''Requirements''''' =====
:*Wolfenstein - Enemy Territory (patched to v2.60b) - ''[http://www.splashdamage.com splashdamage.com]''
:*''[[ETPro]]'' 3.2.6 or higher - ''[http://etpro.anime.net etpro.anime.net]''


*Download the LUA script ''[http://www.force-opponents.de/lua/playsoundcmd.lua playsoundcmd.lua]'' to your etpro folder
===== '''''Installation''''' =====
:*Download the latest ''[http://download.force-opponents.de/etpro/slacstatsaver.lua slacstatsaver.lua]'' script and save it into your ''[[ETPro]]'' folder.
:*Add the following line to your server configuration to instruct your server to load the script on startup.<pre>set lua_modules "slacstatsaver.lua"</pre>
:*Restart your server.


*Add the following command to your server.cfg to call the script on server start
===== '''''<font color="red">Note</font>''''' =====
:Do not use this script with enabled PunkBuster server!


<pre>
<br>
set lua_modules "playsoundcmd.lua"
</pre>


*Restart your server
== ''LUA script - <font color=blue>playsoundcmd.lua</font>'' ==
This script adds new console commands ''<font color=gray>playsound</font>'' and ''<font color=gray>playsound_env</font>'' to your server. The difference to the already existing ''[[User:RoadKillPuppy|playsound.lua]]'' is this one can play a sound for a certain player only and/or also for players in the proximity of this player (exactly ''[http://et.tjw.org/etpub ETPub]'' behavior).


===== Source =====
===== '''''Requirements''''' =====
:*Wolfenstein - Enemy Territory (patched to v2.60b) - ''[http://www.splashdamage.com splashdamage.com]''
:*''[[ETPro]]'' 3.2.6 or higher - ''[http://etpro.anime.net etpro.anime.net]''


<pre><nowiki>
===== '''''Installation''''' =====
------------------------------------------------------------------------
:*Download the latest ''[http://download.force-opponents.de/etpro/playsoundcmd.lua playsoundcmd.lua]'' script and save it into your ''[[ETPro]]'' folder.
--
:*Add the following line to your server configuration to instruct your server to load the script on startup.<pre>set lua_modules "playsoundcmd.lua"</pre>
-- playsoundcmd.lua    -- Version 0.1
:*Restart your server.
-- (c) 2006 Phenomenon -- phenomenon@force-opponents.de
--
------------------------------------------------------------------------
--
-- Converted "playsound" functionality from Tony J. White's ETPub Mod.
--
-- Usage: playsound [sound]                 -- GLOBAL SOUND
--        playsound [name|slot#] [sound]     -- CLIENT ONLY SOUND
--        playsound_env [name|slot#] [sound] -- SURROUNDING CLIENT SOUND
--
------------------------------------------------------------------------


MODULE_VERSION = "0.1"
===== '''''Usage''''' =====
EV_GENERAL_SOUND = 51
:''<font color=gray>\rcon (rconpassword) playsound [sound]</font>''
EV_GLOBAL_CLIENT_SOUND = 54
::Plays a '''sound''' for all clients.
CON_DISCONNECTED = 0
:''<font color=gray>\rcon (rconpassword) playsound [name/slot#] [sound]</font>''
::Plays a '''sound''' for client with '''name/slot#''' only.
:''<font color=gray>\rcon (rconpassword) playsound_env [name/slot#] [sound]</font>''
::Plays a '''sound''' for client with '''name/slot#''' and surrounding clients only.


function et_InitGame(leveltime, randomseed, restart)
===== '''''[http://et.d1p.de/etadmin_mod/wiki/index.php ETAdmin_mod] spree sounds HowTo''''' =====
et.RegisterModname("playsoundcmd-"..MODULE_VERSION)
:*If needed you must update your ''[[ETPro]]'' to version 3.2.6 or higher. You can found the newest package available at ''[http://etpro.anime.net etpro.anime.net]''.
end
:*Download the latest ''[http://www.force-opponents.de/website/lua/playsoundcmd.lua playsoundcmd.lua]'' script and save it into your ''[[ETPro]]'' folder.
:*Add the following line to your server configuration to instruct your server to load the script on startup.<pre>set lua_modules "playsoundcmd.lua"</pre>
:*You must provide the sounds on your server to make them available to your players. Download the file ''[http://www.force-opponents.de/website/lua/etadmin_sounds.pk3 etadmin_sounds.pk3]'' and save it into your ''[[ETPro]]'' folder. This file contains the basic ''[http://et.d1p.de/etadmin_mod/wiki/index.php ETAdmin_mod]'' sounds.
:*Configure ''[http://et.d1p.de/etadmin_mod/wiki/index.php ETAdmin_mod]'' v0.29 or higher to use the ''<font color=gray>playsound</font>'' command.<br><br><p>''etadmin_mod/etc/etadmin.cfg'':</p><table cellspacing=0 cellpadding=0 width=100%><tr><td><pre><nowiki># Detect Multikills (UT like, 3 at once)
# Note: The 3 kills have to be max. 3 seconds away from each other
multikill_detector      = 1


function et_ConsoleCommand()
# Detect Monsterkills (UT like, 5 at once)
local command = string.lower(et.trap_Argv(0))
# Note: 5 kills have to be max. 3 seconds away from each other
monsterkill_detector    = 1
if command == "playsound" or command == "playsound_env" then
playsound_command()
return 1
end
return 0
end


function playsound_command()
# note: the spree_color is deprected. See [spree_messages] instead.
if et.trap_Argc() < 2 then
et.G_Print("^ousage: ^7playsound ^7[^fname^7|^fslot#^7] ^7[^fsound^7]\n")
return
end
if et.trap_Argc() > 2 then
local playerlist = client_numbers_from_string(et.trap_Argv(1))
if table.getn(playerlist) ~= 1 then
et.G_Print(string.format("^oplaysound: %s", match_one_player(playerlist)))
return
end
local soundindex = et.G_SoundIndex(et.trap_Argv(2))
if string.lower(et.trap_Argv(0)) == "playsound_env" then
et.G_AddEvent(playerlist[1], EV_GENERAL_SOUND, soundindex)
else
local tempentity = et.G_TempEntity(et.gentity_get(playerlist[1], "r.currentOrigin"), EV_GLOBAL_CLIENT_SOUND)
et.gentity_set(tempentity, "s.teamNum", playerlist[1])
et.gentity_set(tempentity, "s.eventParm", soundindex)
end
else
et.G_globalSound(et.trap_Argv(1))
end
end


function client_numbers_from_string(partofname)
# Announce first blood
local playerlist, index, maxclients = {}, 1, tonumber(et.trap_Cvar_Get("sv_maxclients"))
first_blood = 1</nowiki></pre></td></tr></table><p>''etadmin_mod/etc/sound.cfg'':</p><table cellspacing=0 cellpadding=0 width=100%><tr><td><pre><nowiki># -> THIS OPTION IS DEPRECATED, USE SOUND_MAPPINGS INSTEAD !!!!
#    its only here for people, that don't want to change their config from 0.28!
table.setn(playerlist, 0)
spree_sounds     = 0
-- if a number is provided, it might be a slot#
if tonumber(partofname) then
local playernum = tonumber(partofname)
if playernum >= 0 and playernum < maxclients then
if et.gentity_get(playernum, "pers.connected") ~= CON_DISCONNECTED then
playerlist[index] = playernum
table.setn(playerlist, index)
return playerlist
end
end
end
-- now look for name matches
local cleanpartofname = sanitize_string(partofname)
if string.len(cleanpartofname) < 1 then
return playerlist
end
for playernum = 0, maxclients - 1, 1 do
if et.gentity_get(playernum, "pers.connected") ~= CON_DISCONNECTED then
if string.find(sanitize_string(et.gentity_get(playernum, "pers.netname")), cleanpartofname) then
playerlist[index] = playernum
table.setn(playerlist, index)
index = index + 1
end
end
end
return playerlist
end


function sanitize_string(str)
# 1 = enable soundmappings, 0 = disable
return trim(string.lower(et.Q_CleanStr(str)))
sound_mappings = 1
end


function trim(str)
# rcon: means, that the regexp will apply to all rcon commands send from the etadmin_mod into the game.
str = string.gsub(str, "^%s+", "")
# clog: means, that the regexp apply to every line of the etconsole.log.
str = string.gsub(str, "%s+$", "")
# Remove # to activate sound.
return str
end


function match_one_player(playerlist)
[sound_mappings]
if table.getn(playerlist) == 0 then
# First blood (also in spree sounds, don't mix spree_sounds = 1 and this):
return "^7no ^7connected ^7player ^7by ^7that ^7name ^7or ^7slot#\n"
#rcon:drew \^1first \^1BLOOD                                    = sound/misc/firstblood.wav
end
rcon:"-PLAYERNAME- \^1drew \^1first \^1BLOOD \^1!              = sound/misc/firstblood.wav
if table.getn(playerlist) > 1 then
local message = "^7more ^7than ^7one ^7player ^7name ^7matches. ^7be ^7more ^7specific ^7or ^7use ^7the ^7slot#:\n"
for index, playernum in ipairs(playerlist) do
message = string.format("%s^7%2i ^7- ^7%s\n", message, playernum, fix_ending_caret(et.gentity_get(playernum, "pers.netname")))
end
return message
end
end


function fix_ending_caret(str)
# Sounds on Monster / Multikill (also in spree sounds, don't mix spree_sounds = 1 and this)
return string.gsub(str, "%^$", "^^ ") -- fix ending caret for printing
rcon:\^7!!!! \^1Multikill                                      = sound/misc/multikill.wav
end
rcon:\^1OMG, MONSTERKILL                                        = sound/misc/monsterkill.wav
</nowiki></pre>
 
# private sounds (only use these or the above, don't mix!):
#rcon:Multikill \^7> \^7-PLAYERNAME- \^7< \^1Multikill = sound/misc/multikill.wav
#rcon:^1MONSTERKILL \^7>>> \^7-PLAYERNAME- \^7<<< ^1MONSTER KILL = sound/misc/monsterkill.wav
 
# Spree messages (global)
rcon:\^8is \^8on \^8a \^8killing \^8spree                      = sound/misc/killingspree.wav
rcon:\^8is \^8on \^8a \^8rampage                                = sound/misc/rampage.wav
rcon:\^8is \^8dominating                                        = sound/misc/dominating.wav
rcon:\^8is \^8unstoppable                                      = sound/misc/unstoppable.wav
rcon:\^8is \^8godlike                                          = sound/misc/godlike.wav
rcon:\^8is \^8wicked \^8sick                                    = sound/misc/wickedsick.wav</nowiki></pre></td></tr></table>
:* Restart your ''[http://et.d1p.de/etadmin_mod/wiki/index.php ETAdmin_mod]'' and your server.
 
<br>
 
== ''LUA function - <font color=blue>et.G_ClientSound()</font>'' ==
Use this function in your own projects to play a sound for a certain client only.
 
===== '''''Requirements''''' =====
:*''[[ETPro]]'' 3.2.6 or higher - ''[http://etpro.anime.net etpro.anime.net]''
 
===== '''''Usage''''' =====
:et.G_ClientSound('''clientnum''', '''soundfile''')
::Plays a global sound '''soundfile''' for a certain client '''clientnum''' only.
 
===== '''''Source''''' =====
:<table cellspacing=0 cellpadding=0 width=100%><tr><td><pre><nowiki>EV_GLOBAL_CLIENT_SOUND = 54
 
function et.G_ClientSound(clientnum, soundfile)
local tempentity = et.G_TempEntity(et.gentity_get(clientnum, "r.currentOrigin"), EV_GLOBAL_CLIENT_SOUND)
et.gentity_set(tempentity, "s.teamNum", clientnum)
et.gentity_set(tempentity, "s.eventParm", et.G_SoundIndex(soundfile))
end</nowiki></pre></td></tr></table>
 
__NOTOC__
__NOEDITSECTION__

Latest revision as of 10:11, 24 October 2010


http://wowdev.org/wiki/images/thumb/9/95/Lua.gif/180px-Lua.gif

Homepage

www.force-opponents.de - Home of the Force Opponents Clan

IRC

#force-opponents - channel on QuakeNet


 

Functions


LUA script - slacstatsaver.lua

This script fixes the "loosing XP and stats at reconnect" bug on a SLAC addon enabled server.

Requirements
Installation
  • Download the latest slacstatsaver.lua script and save it into your ETPro folder.
  • Add the following line to your server configuration to instruct your server to load the script on startup.
    set lua_modules "slacstatsaver.lua"
  • Restart your server.
Note
Do not use this script with enabled PunkBuster server!


LUA script - playsoundcmd.lua

This script adds new console commands playsound and playsound_env to your server. The difference to the already existing playsound.lua is this one can play a sound for a certain player only and/or also for players in the proximity of this player (exactly ETPub behavior).

Requirements
Installation
  • Download the latest playsoundcmd.lua script and save it into your ETPro folder.
  • Add the following line to your server configuration to instruct your server to load the script on startup.
    set lua_modules "playsoundcmd.lua"
  • Restart your server.
Usage
\rcon (rconpassword) playsound [sound]
Plays a sound for all clients.
\rcon (rconpassword) playsound [name/slot#] [sound]
Plays a sound for client with name/slot# only.
\rcon (rconpassword) playsound_env [name/slot#] [sound]
Plays a sound for client with name/slot# and surrounding clients only.
ETAdmin_mod spree sounds HowTo
  • If needed you must update your ETPro to version 3.2.6 or higher. You can found the newest package available at etpro.anime.net.
  • Download the latest playsoundcmd.lua script and save it into your ETPro folder.
  • Add the following line to your server configuration to instruct your server to load the script on startup.
    set lua_modules "playsoundcmd.lua"
  • You must provide the sounds on your server to make them available to your players. Download the file etadmin_sounds.pk3 and save it into your ETPro folder. This file contains the basic ETAdmin_mod sounds.
  • Configure ETAdmin_mod v0.29 or higher to use the playsound command.

    etadmin_mod/etc/etadmin.cfg:

    # Detect Multikills (UT like, 3 at once)
    # Note: The 3 kills have to be max. 3 seconds away from each other
    multikill_detector      = 1
    
    # Detect Monsterkills (UT like, 5 at once)
    # Note: 5 kills have to be max. 3 seconds away from each other
    monsterkill_detector    = 1
    
    # note: the spree_color is deprected. See [spree_messages] instead.
    
    # Announce first blood	
    first_blood		= 1

    etadmin_mod/etc/sound.cfg:

    # -> THIS OPTION IS DEPRECATED, USE SOUND_MAPPINGS INSTEAD !!!!
    
    1. its only here for people, that don't want to change their config from 0.28!

    spree_sounds = 0

    1. 1 = enable soundmappings, 0 = disable

    sound_mappings = 1

    1. rcon: means, that the regexp will apply to all rcon commands send from the etadmin_mod into the game.
    2. clog: means, that the regexp apply to every line of the etconsole.log.
    3. Remove # to activate sound.

    [sound_mappings]

    1. First blood (also in spree sounds, don't mix spree_sounds = 1 and this):
    2. rcon:drew \^1first \^1BLOOD = sound/misc/firstblood.wav

    rcon:"-PLAYERNAME- \^1drew \^1first \^1BLOOD \^1! = sound/misc/firstblood.wav

    1. Sounds on Monster / Multikill (also in spree sounds, don't mix spree_sounds = 1 and this)

    rcon:\^7!!!! \^1Multikill = sound/misc/multikill.wav rcon:\^1OMG, MONSTERKILL = sound/misc/monsterkill.wav

    1. private sounds (only use these or the above, don't mix!):
    2. rcon:Multikill \^7> \^7-PLAYERNAME- \^7< \^1Multikill = sound/misc/multikill.wav
    3. rcon:^1MONSTERKILL \^7>>> \^7-PLAYERNAME- \^7<<< ^1MONSTER KILL = sound/misc/monsterkill.wav
    1. Spree messages (global)

    rcon:\^8is \^8on \^8a \^8killing \^8spree = sound/misc/killingspree.wav rcon:\^8is \^8on \^8a \^8rampage = sound/misc/rampage.wav rcon:\^8is \^8dominating = sound/misc/dominating.wav rcon:\^8is \^8unstoppable = sound/misc/unstoppable.wav rcon:\^8is \^8godlike = sound/misc/godlike.wav

    rcon:\^8is \^8wicked \^8sick = sound/misc/wickedsick.wav


    LUA function - et.G_ClientSound()

    Use this function in your own projects to play a sound for a certain client only.

    Requirements
    Usage
    et.G_ClientSound(clientnum, soundfile)
    Plays a global sound soundfile for a certain client clientnum only.
    Source
    EV_GLOBAL_CLIENT_SOUND = 54
    

    function et.G_ClientSound(clientnum, soundfile) local tempentity = et.G_TempEntity(et.gentity_get(clientnum, "r.currentOrigin"), EV_GLOBAL_CLIENT_SOUND) et.gentity_set(tempentity, "s.teamNum", clientnum) et.gentity_set(tempentity, "s.eventParm", et.G_SoundIndex(soundfile))

    end