//api is now void BeginBenchmark() and float EndBenchmark(), returned in precise milliseconds (so the precision bug from the old method isnt a problem anymore), use %.4f to print that correctly ::ROOT <- getroottable(); if (!("ConstantNamingConvention" in ROOT)) // make sure folding is only done once { foreach (a,b in Constants) foreach (k,v in b) if (v == null) ROOT[k] <- 0; else ROOT[k] <- v; } foreach (k, v in NetProps.getclass()) if (k != "IsValid") ROOT[k] <- NetProps[k].bindenv(NetProps); function MultString(str, times) { local returnstr = ""; for (local i = 0; i < times; ++i) { returnstr += str; } return returnstr; } ::MaxPlayers <- MaxClients().tointeger(); for (local i = 1; i <= MaxPlayers ; i++) { local player = PlayerInstanceFromIndex(i); if (player == null || player.IsFakeClient()) continue; if (player.ValidateScriptScope()) { local scope = player.GetScriptScope(); AddThinkToEnt(player, null); scope["Think"] <- function() { local viewmodel = GetPropEntity(self, "m_hViewModel"); local sequence = GetPropInt(viewmodel, "m_nSequence"); local cycle = viewmodel.GetCycle(); local wep = GetPropEntity(self, "m_hActiveWeapon"); local defindex = GetPropInt(wep, "m_AttributeManager.m_Item.m_iItemDefinitionIndex"); if (defindex == 220 && sequence == 50) { // Reset flag if (cycle >= 1 || cycle < 0.375) viewmodel.RemoveEFlags(EFL_IS_BEING_LIFTED_BY_BARNACLE); if (!(viewmodel.GetEFlags() & EFL_IS_BEING_LIFTED_BY_BARNACLE)) { if (cycle >= 0.375 && cycle < 1) { // Set flag, don't execute any more viewmodel.AddEFlags(EFL_IS_BEING_LIFTED_BY_BARNACLE); local eyepos = self.EyePosition(); local eyeang = self.EyeAngles().Forward(); for (local ent; ent = Entities.FindInSphere(ent, eyepos + eyeang * 32, 48); ) { if (ent.IsPlayer() && ent != self) { ent.TakeDamage(1, 0, self); local vel = (ent.GetOrigin() - self.GetOrigin()) * 5; vel.z = 300; ent.SetAbsVelocity(vel); ent.AddCond(TF_COND_KNOCKED_INTO_AIR); } } } } } return -1; } AddThinkToEnt(player, "Think"); } }