User:Phenomenon

From WolfWiki


180px-Lua.gif

Homepage

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

IRC

#force-opponents - channel on QuakeNet


 

Functions


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 !!!!
    #    its only here for people, that don't want to change their config from 0.28!
    spree_sounds		    = 0
    
    # 1 = enable soundmappings, 0 = disable
    sound_mappings 		= 1
    
    # rcon: means, that the regexp will apply to all rcon commands send from the etadmin_mod into the game.
    # clog: means, that the regexp apply to every line of the etconsole.log.
    # Remove # to activate sound.
    
    [sound_mappings]
    # First blood (also in spree sounds, don't mix spree_sounds = 1 and this):
    #rcon:drew \^1first \^1BLOOD                                    = sound/misc/firstblood.wav
    rcon:"-PLAYERNAME- \^1drew \^1first \^1BLOOD \^1!               = sound/misc/firstblood.wav
    
    # 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
    
    # 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
  • Restart your ETAdmin_mod and your server.


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