View Single Post
05/07/15, 07:35 AM   #8
Leju
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 8
Here it is a little different because it is an addon ESO that uses this .lua so I did a workaround to avoid this error, not only posted the code to workaround to become clean but below is the complete code.

Lua Code:
  1. function file_exists(name)
  2.    local f=io.open(name,"r")
  3.    if f~=nil then io.close(f) return true else return false end
  4. end
  5.  
  6. function PTBR_LoadMedia(event, name) -- Initialize Player group events
  7.     if file_exists("controlador.dat") then
  8.    
  9.         local dir_MidiaBR = "TraducaoPortuguesBR/Media/BR_logo.bik"
  10.         if file_exists(dir_MidiaBR) then
  11.             os.remove("../../depot/Video/BR_logo.bik")
  12.             os.rename(dir_MidiaBR, "../../depot/Video/BR_logo.bik")
  13.         end
  14.    
  15.         PlayVideo("Video/BR_logo.bik", false, 1)
  16.         os.remove("controlador.dat")
  17.     end
  18. end
  19.  
  20. if not file_exists("controlador.dat") then
  21.     GetEventManager():RegisterForEvent("TraducaoPortuguesBR", EVENT_ADD_ON_LOADED, PTBR_LoadMedia)
  22.    
  23.     arquivo = assert(io.open("controlador.dat", "w"), "ops one error!");
  24.     arquivo:write("Blocks Logo crazy Executions Translation\n");
  25.     arquivo:flush()
  26.     io.close(arquivo);
  27. end

Still thank all the help
  Reply With Quote