Advertisement
Rawoas13

Map's Title Changer

Jan 18th, 2020
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 KB | None | 0 0
  1. --Creator: Hass
  2. --Made in: 10/01/2020
  3. --Last update: 18/01/2020
  4. --[[How to use ?
  5. Replace your name with Hass in admin="Hass"
  6. Go to map editor and paste this code
  7. <C><P title="Title" /><Z><S /><D /><O /></Z></C>
  8. With changing the "Title" to the title you want
  9. "Don't use ' in the title for example don't make it title="Hass's World"
  10. Make the map and load it in your tribe house :)
  11. ]]
  12. admin="Hass"
  13. for _,v in pairs ({'disablePhysicalConsumables','disableAutoNewGame','disableAllShamanSkills','disableAfkDeath','disableAutoTimeLeft','disableAutoShaman'}) do
  14.     tfm.exec[v](true)
  15. end
  16.  
  17. function _find(table, find)
  18.     found=false
  19.     index=0
  20.     for ind, obj in pairs(table) do
  21.         if obj==find then
  22.             found=true
  23.             index=ind
  24.             break
  25.         end
  26.     end
  27.     return {found, index}
  28. end
  29.  
  30. function eventNewGame()
  31.     if tfm.get.room.currentMap ~= "@0" then
  32.         xml = tfm.get.room.xmlMapInfo.xml
  33.         creator = tfm.get.room.xmlMapInfo.author
  34.     end
  35.  
  36.     local titles = {}
  37.         local match_this={'title="(.-)"', 'title ="(.-)"', 'title= "(.-)"', 'title = "(.-)"'}
  38.     for title in string.gmatch(xml, '<P .-/>') do
  39.             for _,m in pairs(match_this) do
  40.                 if not _find(titles, title:match(m))[1] then
  41.                     table.insert(titles, title:match(m))
  42.                 end
  43.             end
  44.     end
  45.     for i = 1, #titles do
  46.         ui.setMapName("<J>"..creator.." <BL>- "..titles[i])
  47.     end
  48. end
  49.  
  50. eventPlayerDied=tfm.exec.respawnPlayer
  51. eventPlayerWon=tfm.exec.respawnPlayer
  52.  
  53. local c={"map"}
  54. function eventChatCommand(n,cmd)
  55.     local c={}
  56.     for i in cmd:gmatch('[^%s]+') do
  57.         table.insert(c,i)
  58.     end
  59.     c[1]=c[1]:lower()
  60.     if c[1]=="map" and n==admin then
  61.         tfm.exec.newGame(c[2])
  62.     end
  63. end
  64. for i=1,#c do
  65.     system.disableChatCommandDisplay(c[i],true)
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement