function syncWait(who) local USAGE = "sync:'waiting for group chars' syncWait()\n".. "sync:'waiting for one char' syncWait(\"char1\")\n".. "sync:'waiting for a couple of chars' syncWait({\"char1\",\"char2\"[,\"char3\"..]})\n" local CACHE_PATH = getExecutionPath() .."/cache/" local CACHE_PATH_DOS = "scripts\\rom\\cache\\" if who == nil then who = {} for i=1,5 do table.insert(who, GetPartyMemberName(i)); end elseif type(who) == "table" then for i,v in pairs(who) do if type(v) ~= "string" then print("wrong value argument "..i.."\n") print(USAGE) return false end end elseif type(who) == "string" then who = {who} else print(USAGE) return false end if who[1] == nil then printf("sync:I'm alone o_O\n") return false end --add yourself table.insert(who,player.Name) --first part local temp = io.open(CACHE_PATH..player.Name..".rdy", "r") if not temp then os.execute("echo 1 > "..CACHE_PATH_DOS..player.Name..".rdy"); else io.close(temp) end --check if all chars ready local all = true for i,v in pairs(who) do local temp = io.open(CACHE_PATH..v..".rdy", "r") all = all and temp if temp then io.close(temp) end end if all then --second part os.execute("echo 1 > "..CACHE_PATH_DOS..player.Name..".qit"); --check if all chars receipted for i,v in pairs(who) do local temp = io.open(CACHE_PATH..v..".qit", "r") all = all and temp if temp then io.close(temp) end end --then cleanup if all then for i,v in pairs(who) do os.remove(CACHE_PATH_DOS..v..".rdy") os.remove(CACHE_PATH_DOS..v..".qit") end end return true else return false end end function syncReset() local CACHE_PATH_DOS = "scripts\\rom\\cache\\" os.remove(CACHE_PATH_DOS..player.Name..".rdy") os.remove(CACHE_PATH_DOS..player.Name..".qit") end