-- name: \\#f8b195\\Limbo\\#f67280\\kong's \\#c06c84\\Voice\\#6c5b7b\\chat -- description: \\#ffffff\\Voicechat if you know what i'm sayin'?\ntwitter.com/limbokong -- IF YOU'RE READING THIS THEN HOLY SHIT DON'T JUDGE MY LUA CODING SKILLS PLEASE IT'S MY FIRST TIME USING LUA AND IM LIKE 16 YEARS OLD SO MY BRAIN IS DUMB -- ver 0.5 local timer = 0 local saveString1 = "" local saveLine2 = "" local saveLine1 = "" local playerVolumes = {} gGlobalSyncTable.distanceMultiplier = 1 function save_command(msg) timer=timer+1 if(timer >= 15) then saveLine1 = "" saveLine2 = "" --playerIndex; PlayerAmount; PlayerState saveString1 = gNetworkPlayers[0].globalIndex .. "-" .. tostring(network_player_connected_count()) .. "-0" for i = 1, network_player_connected_count() - 1, 1 do --globalIndex; Distance; PlayerState currentPlayersDistance = 99 currentPlayersMuffled = 0 if((gNetworkPlayers[i].currLevelNum ~= gNetworkPlayers[0].currLevelNum) or (gNetworkPlayers[i].currAreaIndex ~= gNetworkPlayers[0].currAreaIndex)) then currentPlayersDistance = "99" else currentPlayersDistance = tostring(clamp(math.floor(dist_between_objects(gMarioStates[0].marioObj, gMarioStates[i].marioObj) / (40 * gGlobalSyncTable.distanceMultiplier)))) end if(obj_get_first_with_behavior_id(id_bhvActSelector) ~= nil) then currentPlayersDistance = "99" end if((gMarioStates[i].currentRoom ~= gMarioStates[0].currentRoom) and (gNetworkPlayers[i].currLevelNum == gNetworkPlayers[0].currLevelNum)) then currentPlayersMuffled = 1 end if((gMarioStates[i].flags & MARIO_VANISH_CAP) ~= 0) then currentPlayersMuffled = 2 end if((gMarioStates[i].flags & MARIO_METAL_CAP) ~= 0) then currentPlayersMuffled = 3 end saveString1 = saveString1 .. "_" .. gNetworkPlayers[i].globalIndex .. "-" .. currentPlayersDistance .. "-" .. currentPlayersMuffled end count = 0 for i in string.gmatch(saveString1, ".") do count = count + 1 if(count >= 64) then saveLine2 = saveLine2 .. i else saveLine1 = saveLine1 .. i end end if(saveLine2 == "") then saveLine2 = "a" end mod_storage_save("1", saveLine1) mod_storage_save("2", saveLine2) if(string.find(gNetworkPlayers[0].name, "%W") == nil) then mod_storage_save("3", gNetworkPlayers[0].name) else newName = "" letterCount = 0 for let in string.gmatch(gNetworkPlayers[0].name, ".") do if(string.find(let, "%W") == nil) then newName = newName .. let end letterCount = letterCount + 1 end if(newName == "") then mod_storage_save("3", "Player" .. gNetworkPlayers[0].globalIndex) else mod_storage_save("3", newName) end end timer = 0 end return true end function set_distance_command(msg) if(msg == "") then djui_chat_message_create("\\#959595\\You gotta input a number! >:(") return true end if(tonumber(msg) ~= nil) then gGlobalSyncTable.distanceMultiplier = msg djui_chat_message_create("\\#959595\\Voicechat Distance Multiplier ist now set to \\#ffffff\\x" .. msg .. "\\#959595\\ for all players!") else djui_chat_message_create("\\#FF0000\\" .. msg .. "\\#959595\\ is not a number! >:(") end return true end function clamp(val) if(val > 99) then return 99 else return val end end hook_event(HOOK_UPDATE, save_command) hook_chat_command("setdistance", "[distance]", set_distance_command)