local lastBulletHandle = nil function TeleportToBullet(paramId, continueFollowBullet, mustBeOwnBullet, useBulletOrientation) local includeNonLocalPlayerOwned = false if mustBeOwnBullet then if not IsLocalPlayer() then includeNonLocalPlayerOwned = true end end local bullets = GetBulletsInfo(includeNonLocalPlayerOwned) if #bullets == 0 then lastBulletHandle = nil return end local matchingBullet = nil for _, bullet in ipairs(bullets) do if not mustBeOwnBullet or bullet.IsOwnedByCurrentChrIns then if continueFollowBullet and CompareTables(lastBulletHandle, bullet.Handle) then matchingBullet = bullet break elseif bullet.Param == paramId and (continueFollowBullet or not CompareTables(lastBulletHandle, bullet.Handle)) then matchingBullet = bullet end end end if matchingBullet == nil then return end SetPointerValue(CHR_INS_BASE.CHR_MODULES.PHYSICS_MODULE.LOCAL_POSITION, matchingBullet.Position.X, matchingBullet.Position.Y, matchingBullet.Position.Z) if useBulletOrientation then SetPointerValue(CHR_INS_BASE.CHR_MODULES.PHYSICS_MODULE.QUAT_POSITION, matchingBullet.Orientation.X, matchingBullet.Orientation.Y, matchingBullet.Orientation.Z) end lastBulletHandle = matchingBullet.Handle end function GetBulletsInfo(includeNonCurrentInsOwned) includeNonCurrentInsOwned = includeNonCurrentInsOwned or false local foundBullets = {} local index = 0 while true do local bulletExists = GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.EXISTS(index)) if bulletExists == FALSE then break end local isOwnedByCurrentChrIns = false if GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.OWNER_CHR_HANDLE(index)) == GetPointerValue(CHR_INS_BASE.FIELD_INS_HANDLE) then isOwnedByCurrentChrIns = true end if includeNonCurrentInsOwned or isOwnedByCurrentChrIns then local bulletHandle = { GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.HANDLE(index)) } local ownerHandle = { GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.OWNER_CHR_HANDLE(index)) } local param = GetBulletParam(index) local x, y, z = GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.POSITION(index)) local orientationX, orientationY, orientationZ = GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.ORIENTATION(index)) table.insert(foundBullets, { Handle = bulletHandle, Param = param, IsOwnedByCurrentChrIns = isOwnedByCurrentChrIns, BulletOwnerHandle = ownerHandle, Position = { X = x, Y = y, Z = z }, Orientation = { X = orientationX, Y = orientationY, Z = orientationZ } }) end index = index + 1 end return foundBullets end function GetBulletParam(index) local param_wait = GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.PARAM_ROW_WAIT(index)) if param_wait ~= nil and param_wait ~= "-1" then return param_wait end local param_fly = GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.PARAM_ROW_FLY(index)) if param_fly ~= nil and param_fly ~= "-1" then return param_fly end local param_explosion = GetPointerValue(GAME_BASE.CS_BULLET_MANAGER.BULLET_LIST.PARAM_ROW_EXPLOSION(index)) if param_explosion ~= nil and param_explosion ~= "-1" then return param_explosion end return "-1" end