Eihrenjar

Untitled

Sep 3rd, 2011
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.81 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <mod name="Team War" version="1.0" author="-----" contact="otland.net" enabled="yes">
  3.    <description>
  4.         This should teleport all players to a new random town in intervals and add them into a team.
  5.    </description>
  6.     <config name="config"><![CDATA[
  7.     config = {
  8.         fps = {x = 500, y = 500, z = 15}, -- north west corner (remember using z= 15 coz players might be in a lower floor)
  9.         tps = {x = 100, y = 100, z = 0}, -- south east corner (remember using z= 0 coz players might be on a higher floor)
  10.         t1 = "fagarians", -- blue team(1) name
  11.         t2 = "homosexualsins", -- red team(2) name
  12.         gstg = 7000, -- global storage
  13.         temple1 = 7001, -- global storage for team 1 temple
  14.         temple2 = 7002, -- global storage for team 2 temple
  15.         tstg1 = 6666, --team 1 storage
  16.         tstg2 = 6667, --team 2 storage
  17.         access = 3, -- minimum access to bypass teleportation.
  18.         temples = {1,2,3} --townids to teleport to.
  19.         }
  20.  ]]></config>
  21.    <event type="login" name="tlog" event="script"><![CDATA[
  22. domodlib('config')
  23. local conditionBlue = createConditionObject(CONDITION_OUTFIT)
  24.         setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
  25.         addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
  26. local conditionRed = createConditionObject(CONDITION_OUTFIT)
  27.         setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
  28.         addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
  29. function onLogin(cid)
  30.     if getPlayerGroupId(cid) < 3 then
  31.        if getGlobalStorageValue(config.gstg) == 1 then
  32.         doPlayerSetTown(cid, getGlobalStorageValue(3454))
  33.         doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
  34.         setPlayerStorageValue(cid, config.tstg1, 1)
  35.         doAddCondition(cid, conditionRed)
  36.         doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t1.." so pew the shit out of the "..config.t2.."")
  37.         setGlobalStorageValue(config.gstg, -1)
  38.                 else
  39.         doPlayerSetTown(cid, math.max(getGlobalStorageValue(3454), 2)
  40.         doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
  41.             setPlayerStorageValue(cid, config.tstg2, 1)
  42.             doAddCondition(cid, conditionBlue)
  43.             doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t2.." so pew the shit out of the "..config.t1.."")
  44.             setGlobalStorageValue(config.gstg, 1)
  45.            end
  46.       end
  47. return TRUE
  48. end
  49. ]]></event>
  50.    <event type="logout" name="tout" event="script"><![CDATA[
  51. domodlib('config')
  52. function onLogout(cid)
  53.     if getGlobalStorageValue(cid, config.gstg) == -1 then
  54.     setPlayerStorageValue(cid, config.tstg1, 0)
  55.         setGlobalStorageValue(config.gstg, 1)
  56.              elseif getGlobalStorageValue(cid, config.gstg) == 1 then
  57.     setPlayerStorageValue(cid, config.tstg1, 0)
  58.         setGlobalStorageValue(config.gstg, -1)
  59.     end
  60. return true
  61. end
  62. ]]></event>
  63.    <event type="death" name="tded" event="script"><![CDATA[
  64. domodlib('config')
  65. function onDeath(cid, corpse, killer)
  66.     if getGlobalStorageValue(cid, config.gstg) == 1 then
  67.     setPlayerStorageValue(cid, config.tstg1, -1)
  68.              elseif getGlobalStorageValue(cid, config.gstg) == -1 then
  69.         setGlobalStorageValue(config.gstg, 1)
  70.     end
  71. return true
  72. end
  73. ]]></event>
  74.    <event type="combat" name="tcom" event="script"><![CDATA[
  75. domodlib('config')
  76. function onCombat(cid, target)
  77. local t = {
  78.             a = getPlayerStorageValue(cid, config.tstg1),
  79.             b = getPlayerStorageValue(cid, config.tstg2),
  80.             d = getPlayerStorageValue(target, config.tstg2),
  81.             f = getPlayerStorageValue(target, config.tstg1)
  82.         }
  83.     if isPlayer(cid) and isPlayer(target) then
  84.         if t.a == 1 and t.f == 1 then
  85.             return doPlayerSendCancel(cid, "You cant cant attack your team.") and false
  86.         elseif t.b == 1 and t.d == 1 then
  87.             return doPlayerSendCancel(cid, "You cant cant attack your team.") and false
  88.         end
  89.     end
  90.     return true
  91. end
  92. ]]>></event>
  93.     <globalevent name="Map Change" interval="1200000" event="script"><![CDATA[
  94.     domodlib('config')
  95.         function onThink(interval, lastExecution, thinkInterval)
  96.             repeat
  97.                 RDM = math.random(1,#config.temples)
  98.             until RDM ~= getGlobalStorageValue(3454) and isInArray(config.temples, RDM)
  99.             for _, pid in ipairs(getPlayersOnline()) do
  100.                 if getPlayerAccess(pid) < config.access and isInRange(getThingPosition(pid), fps, tps) then
  101.                     if getPlayerStorageValue(pid, config.tstg1) == 1 then
  102.                         setGlobalStorageValue(temple1, config.temples[RDM])
  103.                         doPlayerSetTown(pid, config.temples[RDM])
  104.                         doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]), false)
  105.                         doRemoveCondition(pid, CONDITION_INFIGHT)
  106.                         doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
  107.                         doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
  108.                         doBroadcastMessage("Map has been changed to "..getTownName(config.temples[RDM]).."! next map change will be in 20 minutes! have a nice fight!", MESSAGE_STATUS_WARNING)
  109.                      elseif getPlayerStorageValue(pid, config.tstg2) == 1 then
  110.                         setGlobalStorageValue(temple2, config.temples[RDM]+1)
  111.                         doPlayerSetTown(pid, config.temples[RDM]+1)
  112.                         doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]+1), false)
  113.                         doRemoveCondition(pid, CONDITION_INFIGHT)
  114.                         doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
  115.                         doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
  116.                         doBroadcastMessage("Map has been changed to "..getTownName(config.temples[RDM]).."! next map change will be in 20 minutes! have a nice fight!", MESSAGE_STATUS_WARNING)
  117.                     end
  118.                 setGlobalStorageValue(3454, config.temples[RDM])
  119.                 end
  120.             end
  121.         return true
  122.         end
  123. ]]></globalevent>  
  124. </mod>
Advertisement
Add Comment
Please, Sign In to add comment