::findAllPlayer <- function(onlyRealPlayer = false) { local bigList = [] local MAX_CLIENTS = MaxClients().tointeger() for (local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && (!hPlayer.IsFakeClient() || !onlyRealPlayer)) { bigList.append(hPlayer) } } return bigList } ::findRandomPlayer <- function() { local MAX_CLIENTS = MaxClients().tointeger() for (local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && !hPlayer.IsFakeClient()) { return hPlayer } } } ::CreateTimer <- function(func, delay = 1) { local timer = Entities.CreateByClassname( "logic_timer" ) // set refire time timer.KeyValueFromFloat( "RefireTime", delay ) timer.ValidateScriptScope() local scope = timer.GetScriptScope() // add a reference to the function scope.OnTimer <- func // connect the OnTimer output, // every time the timer fires the output, the function is executed timer.ConnectOutput( "OnTimer", "OnTimer" ) // start the timer EntFireByHandle( timer, "Enable", "", 0, null, null ) EntFireByHandle( timer, "Disable", "", delay+0.01, null, null ) return timer } ::GetSoundScript <- function() { for (local ent; ent = FindByClassname(ent, "instanced_scripted_scene");) //printl(ent) for (local ent; ent = FindByClassname(ent, "instanced_scripted_scene"); ) { if (ent.IsEFlagSet(1048576)) continue ent.AddEFlags(1048576) local owner = GetPropEntity(ent, "m_hOwner") if (owner != null && !owner.IsBotOfType(TF_BOT_TYPE)) { local vcdpath = GetPropString(ent, "m_szInstanceFilename"); if (!vcdpath || vcdpath == "") return -1 local dotindex = vcdpath.find(".") local slashindex = null; for (local i = dotindex; i >= 0; --i) { if (vcdpath[i] == '/' || vcdpath[i] == '\\') { slashindex = i break } } owner.ValidateScriptScope() local scope = owner.GetScriptScope() scope.soundtable <- VCD_SOUNDSCRIPT_MAP[owner.GetPlayerClass()] scope.vcdname <- vcdpath.slice(slashindex+1, dotindex) if (scope.vcdname in scope.soundtable) { local soundscript = scope.soundtable[scope.vcdname]; return soundscript //printl(soundscript) //if (typeof soundscript == "string") // PopExtUtil.StopAndPlayMVMSound(owner, soundscript, 0); //else if (typeof soundscript == "array") // foreach (sound in soundscript) // PopExtUtil.StopAndPlayMVMSound(owner, sound[1], sound[0]); } } } } ::lib <- { } local ROOT = getroottable() IncludeScript("robotvoicelines", ROOT) const EFL_USER = 1048576 //fun.hExplosion.GetScriptScope().printall <- function() //{ // if("lib" in ROOT) // lib.printall() // return -1 //} //AddThinkToEnt(fun.hExplosion, "printall") //script_execute lib //script lib.CreateTimer(fun.nuke)