• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Soccer system mod error :S

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hi people of otland, you see, i have this MOD:
(soccer system)

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Foot ball" version="1.0" author="Damadger" contact="otland.net" enabled="yes">
<config name="tutorial_m"><![CDATA[
 c = {
 
    speed = 250, -- base speed for all players.
 
   players = 1, -- ****Change to number of players per each team, but keep on mind by changing this you will add new positions for each team in : 1- in the team1pos varible | 2- in the destination verible
 
    pitchpos = {fromx = 1012, fromy = 1015, tox = 1034, toy = 1023, z = 7}, -- here you need to put the x and y from the farest north west sqm of the pitch, to the farest west east sqm in the pitch(including goal)
 
    ballpos = {x = 1023, y = 1019, z = 7}, -- default position of ball in middle of pitch
 
    original = 60 , --match time ( it will be devided by 2 for each half)
 
    team1pos = {
                          --Position of #TEAM_1# players standing to pull the lever
                              {x = 1025, y = 1024, z = 7},
                   --- Position of #TEAM_2# players standing to pull the lever
                              {x = 1023, y = 1024, z = 7}
                     },
 
    destination = {
                       --- team 1 pitch side
                          {x = 1027, y = 1019, z = 7},
                  --- team 2 pitch side
                          {x = 1020, y = 1019, z = 7}
                      },
 
    storage = 1919,
 
    BLUE_SCORE = 1223,
 
    RED_SCORE = 1224,
 
      rewards = true, -- by disabling this you will disable the score broadcast and the win add to site part
         rewards_id = {2494, 2472, 2514, 2160} --Player are rewarded randomly
    }
 
 
 
 
]]></config>
 <lib name="football-lib"><![CDATA[
 
function getSpeed(cid,level)
  value = (220 +(2 *(level -1)))
  return value
end
function addTotal(cid)
   return db.executeQuery("UPDATE `players` SET `total` = `total` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
 function addGoal(cid)
    return db.executeQuery("UPDATE `players` SET `goals` = `goals` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
function addWin(cid)
  return db.executeQuery("UPDATE `players` SET `wins` = `wins` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
]]></lib>
<action actionid="2275" event="script"> <![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
local bmale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
local bfemale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
local rmale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
local rfemale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local n = 1
    if getGlobalStorageValue(1222) > 0 then
      doPlayerSendCancel(cid,"There is a on going match right now, please come again later.")
    return true
    end
 local players = {}
   for _, position in ipairs(c.team1pos) do
      local pid = getTopCreature(position).uid
      if(pid == 0 or not isPlayer(pid)) then
         doPlayerSendCancel(cid, "You need ".. c.players * 2 .." players to start the match.")
         return true
      end
 
      table.insert(players, pid)
 
   end
 
   for i, pid in ipairs(players) do
       setPlayerStorageValue(pid,c.storage,n)
       n = n+1
      doTeleportThing(pid, c.destination[getPlayerStorageValue(pid,c.storage)], false)
      doSendMagicEffect(c.destination[i], CONST_ME_ENERGYAREA)
 
   end
   for i, pid in ipairs(players) do
       addTotal(pid)
       if getPlayerStorageValue(pid,c.storage) > 0 and getPlayerStorageValue(pid,c.storage) <= c.players then
            doAddCondition(pid, ( getPlayerSex(cid) == 1 and bmale or bfemale) )
       elseif getPlayerStorageValue(pid,c.storage) > c.players  then
           doAddCondition(pid, ( getPlayerSex(cid) == 1 and rmale or rfemale) )
       end
 
   end
 
     for i = c.pitchpos.fromy, c.pitchpos.toy do
      for j = c.pitchpos.fromx, c.pitchpos.tox do
         local pos = {x = j, y = i, z = c.pitchpos.z}
         local ball = getTileItemById(pos,2109).uid
         if ball > 0 then
            doRemoveItem(ball)
         end
      end
   end
   if getTileItemById(c.ballpos,2109).uid < 1 then
      doCreateItem(2109,1,c.ballpos)
   end
    setGlobalStorageValue(1222,c.original)
 
   return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
end
]]> </action>
<movevent type="AddItem" tileitem="1" fromaid="7070" toaid="7072" event="script"><![CDATA[
      domodlib('tutorial_m')
        domodlib('football-lib')
 
      function onAddItem(moveitem, tileitem, position, cid)
 
if(moveitem.itemid ~= 2109) then
    if getItemDescriptionsById(moveitem.itemid).type == ITEM_TYPE_MAGICFIELD then
         doRemoveItem(moveitem.uid)
     else
     doPlayerAddItem(cid, moveitem.itemid,1)
     doRemoveItem(moveitem.uid)
 
       end
else
  if getGlobalStorageValue(1222) < 0 then
 
       doTeleportThing(moveitem.uid,c.ballpos)
   else
         if tileitem.actionid == 7070 then
               if getGlobalStorageValue(1222) >= c.original/2 then -- blue goal
                      if getPlayerStorageValue(cid,c.storage) > 0 then      
                           doTeleportThing(moveitem.uid,c.ballpos,false)
                          addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                        setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
                                    if getPlayerStorageValue(cid,c.storage) > c.players then
                                         addGoal(cid)
                            end
                                  for _,tid in ipairs(getPlayersOnline()) do
                                     if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                        end    
                                  end
                      end
               elseif getGlobalStorageValue(1222) < c.original/2 then -- red goal
                     if getPlayerStorageValue(cid,c.storage) > 0 then      
                         doTeleportThing(moveitem.uid,c.ballpos,false)
                        addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                      setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
                                    if getPlayerStorageValue(cid,c.storage) <= c.players then
                                         addGoal(cid)
                            end
                                  for _,tid in ipairs(getPlayersOnline()) do
 
                                     if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                        end    
                                  end
                    end
               end
          elseif tileitem.actionid == 7071 then   
                if getGlobalStorageValue(1222) >= c.original/ 2 then --red goal
                    if getPlayerStorageValue(cid,c.storage) > 0 then      
                         doTeleportThing(moveitem.uid,c.ballpos,false)
                        addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                      setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
                                    if getPlayerStorageValue(cid,c.storage) <= c.players then
                                         addGoal(cid)
                           end
                                  for _,tid in ipairs(getPlayersOnline()) do
                                   if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                      end    
                                  end
                    end
               elseif getGlobalStorageValue(1222) < c.original / 2 then --blue
                   if getPlayerStorageValue(cid,c.storage) > 0 then      
                         doTeleportThing(moveitem.uid,c.ballpos,false)
                        addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                      setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
                          if getPlayerStorageValue(cid,c.storage) > c.players then
                                         addGoal(cid)
                         end
                        for _,tid in ipairs(getPlayersOnline()) do
                                 if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                    end    
                              end
                    end
               end   
          end
    end        
 
end
 
return true
end
 
]]> </movevent>
 
<movevent type="StepIn" actionid="7072" event="script">
<![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
      function onStepIn(cid, item, position, fromPosition)
  if(getCreatureSpeed(cid) ~= speed) then 
            doRemoveCondition(cid, CONDITION_HASTE) 
            doChangeSpeed(cid, c.speed - getCreatureSpeed(cid)) 
    end 
return true
end
 
 
]]> </movevent>
<globalevent name="timer" interval="1" event="script"><![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
function onThink(cid,interval)
   local half = c.original/2
   local random_item = c.rewards_id[math.random(1, #c.rewards_id)]
   if getGlobalStorageValue(1222) >= 0 then
      setGlobalStorageValue(1222,getGlobalStorageValue(1222) - 1)
   else
      setGlobalStorageValue(c.BLUE_SCORE,0)
      setGlobalStorageValue(c.RED_SCORE,0)
   end
   for _,cid in ipairs(getPlayersOnline()) do
      if getGlobalStorageValue(1222) >= 0 and getGlobalStorageValue(1222) < half then
         if getPlayerStorageValue(cid,c.storage) > 0 then
            doPlayerSendCancel(cid, "Time per half : "..( os.date("%M : %S",half)).."  |  Second half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."  |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
         end          
      elseif getGlobalStorageValue(1222) >= half and getGlobalStorageValue(1222) <= c.original then
         if getPlayerStorageValue(cid,c.storage) > 0 then
            doPlayerSendCancel(cid, "Time per half : "..( os.date("%M : %S", half )).."  |  First half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."  |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
         end
      end
      if getPlayerStorageValue(cid,c.storage) > 0 then
         if getGlobalStorageValue(1222) < 0 then
            doChangeSpeed(cid, getSpeed(cid, getPlayerLevel(cid)) - getCreatureSpeed(cid))
               if c.rewards == true then
                  if getGlobalStorageValue(c.RED_SCORE) > getGlobalStorageValue(c.BLUE_SCORE) then
                     if getPlayerStorageValue(cid,c.storage) > c.players then
                        doPlayerSendTextMessage(cid,25, "Your teams won the match. And recieved a ["..getItemNameById(random_item).."].")
                        doPlayerAddItem(cid,random_item,1)
                        addWin(cid)
                     elseif getPlayerStorageValue(cid,c.storage) <= c.players then
                        doPlayerSendTextMessage(cid,22,"You team have lost. No reward for you!")
                     end
                  elseif getGlobalStorageValue(c.BLUE_SCORE) > getGlobalStorageValue(c.RED_SCORE) then
                     if getPlayerStorageValue(cid,c.storage) <= c.players then
                        doPlayerAddItem(cid,random_item,1)
                        doPlayerSendTextMessage(cid,25, "Your teams won the match. And recieved a ["..getItemNameById(random_item).."].")
                        addWin(cid)
                     elseif getPlayerStorageValue(cid,c.storage) > c.players then
                           doPlayerSendTextMessage(cid,22,"You team have lost. No reward for you!")
                     end
                  else
                     doPlayerSendTextMessage(cid,22,"Neither of teams won. No rewards!")
                  end
               end
               doRemoveConditions(cid, FALSE)
               doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
               doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)
               setPlayerStorageValue(cid,c.storage,-1)
                  for i = c.pitchpos.fromy, c.pitchpos.toy do
                     for j = c.pitchpos.fromx, c.pitchpos.tox do
                        local pos = {x = j, y = i, z = c.pitchpos.z}
                        local ball = getTileItemById(pos,2109).uid
                        if ball > 0 then
                           doRemoveItem(ball)
                        end
                     end
                  end
                  if getTileItemById(c.ballpos,2109).uid < 1 then
                     doCreateItem(2109,1,c.ballpos)
                  end
 
         elseif getGlobalStorageValue(1222) == half then
            doTeleportThing(cid, (getPlayerStorageValue(cid,c.storage) <= c.players and c.destination[getPlayerStorageValue(cid,c.storage)+c.players] or c.destination[getPlayerStorageValue(cid,c.storage)-c.players]))
            doPlayerSendTextMessage(cid,22,"Refree : Second half begins.")
               for i = 1, #c.destination do
                  doSendMagicEffect(c.destination[i],10)
               end
               for i = c.pitchpos.fromy, c.pitchpos.toy do
                  for j = c.pitchpos.fromx, c.pitchpos.tox do
                     local pos = {x = j, y = i, z = c.pitchpos.z}
                     local ball = getTileItemById(pos,2109).uid
                        if ball > 0 then
                           doRemoveItem(ball)
                        end
                  end
               end
               if getTileItemById(c.ballpos,2109).uid < 1 then
                  doCreateItem(2109,1,c.ballpos)
               end
         end
      end
    end
return true
end
]]></globalevent>
<globalevent name="tim" type="start" event="script"><![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
      function onStartup()
         setGlobalStorageValue(c.BLUE_SCORE,0)
         setGlobalStorageValue(c.RED_SCORE,0)
            for i = c.pitchpos.fromy, c.pitchpos.toy do
               for j = c.pitchpos.fromx, c.pitchpos.tox do
                  local pos = {x = j, y = i, z = c.pitchpos.z}
                  local ball = getTileItemById(pos,2109).uid
                  if ball > 0 then
                     doRemoveItem(ball)
                  end
               end
            end
            if getTileItemById(c.ballpos,2109).uid < 1 then
               doCreateItem(2109,1,c.ballpos)
            end
         return true
      end
]]></globalevent>
</mod>

and when i use right click in the lever this happens:

Lua:
[16/01/2013 16:37:14] [Error - MoveEvents Interface] 
[16/01/2013 16:37:14] data/movements/scripts/football.lua:onStepIn
[16/01/2013 16:37:14] Description: 
[16/01/2013 16:37:14] data/movements/scripts/football.lua:26: attempt to index global 'football_positions_uids' (a nil value)
[16/01/2013 16:37:14] stack traceback:
[16/01/2013 16:37:14] 	data/movements/scripts/football.lua:26: in function <data/movements/scripts/football.lua:24>


plzzz help D:
 
Last edited:
Post football.lua? Thats an XML document. Variable football_positions_uids could be undefined, perhaps you spelt it differently when defining or calling it.
 
You need the positon on line 26 as the pos that player 2 is standing.. This script might require one player of each team to be standing on the levers for them to be used. But as ciko said, its saying that a moveevent is wrong, and seems how this is all mod, I think its the position.

Without a better analysis on the problem its hard to make an accurate bios.
 
Sorry gigastar it didn't work, now i have this MOD that seems better, bit i need help with what unique and/or action ids to put in lever and in the floor plzzz

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Soccer" version="1.2" author="Damadger n soul4soul" enabled="yes">
<config name="tutorial_m"><![CDATA[
c = {
    speed = 250,   -- base speed for all players.
    players = 2,  -- ****Change to number of players per each team, but keep on mind by changing this you will add new positions for each team in : 1- in the team1pos varible | 2- in the destination verible
    pitchpos = {fromx = 992, fromy = 1199, tox = 1106, toy = 1205, z = 7}, -- here you need to put the x and y from the farest north west sqm of the pitch, to the farest west east sqm in the pitch(including goal)
    ballpos = {x = 999, y = 1202, z = 7}, -- default position of ball in middle of pitch
    original = 120 , --match time ( it will be devided by 2 for each half)
    team1pos = {
        --Position of #TEAM_1# players standing to pull the lever
        {x = 998, y = 1207, z = 7},
        {x = 997, y = 1207, z = 7},
        --- Position of #TEAM_2# players standing to pull the lever
        {x = 1000, y = 1207, z = 7},
        {x = 1001, y = 1207, z = 7}
    },
    destination = {
        --- team 1 pitch side
        {x = 990, y = 1201, z = 7},
        {x = 990, y = 1203, z = 7},
        --- team 2 pitch side
        {x = 1008, y = 1201, z = 7},
        {x = 1008, y = 1203, z = 7}
    },
    storage = 20107,
    BLUE_SCORE = 1223,
    RED_SCORE = 1224
}
]]></config>
<lib name="football-lib"><![CDATA[
function getSpeed(cid,level)
    value = (220 +(2 *(level -1)))
    return value
end
 
function addTotal(cid)
    return db.executeQuery("UPDATE `players` SET `total` = `total` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
 function addGoal(cid)
    return db.executeQuery("UPDATE `players` SET `goals` = `goals` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
function addWin(cid)
   return db.executeQuery("UPDATE `players` SET `wins` = `wins` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
]]></lib>
<action uniqueid="20107" event="script"> <![CDATA[
    domodlib('tutorial_m')
    domodlib('football-lib')
    local bmale = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
    local bfemale = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
    local rmale = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
    local rfemale = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        local n = 1
        if getGlobalStorageValue(1222) > 0 then
            doPlayerSendCancel(cid,"There is a on going match right now, please come again later.")
            return true
        else
            setGlobalStorageValue(c.BLUE_SCORE,0)
            setGlobalStorageValue(c.RED_SCORE,0)
        end
        local players = {}
        for _, position in ipairs(c.team1pos) do
            local pid = getTopCreature(position).uid
            if(pid == 0 or not isPlayer(pid)) then
                doPlayerSendCancel(cid, "You need ".. c.players * 2 .." players to start the match.")
                return true
            end
            table.insert(players, pid)
        end
 
        for i, pid in ipairs(players) do
            setPlayerStorageValue(pid,c.storage,n)
            n = n+1
            doTeleportThing(pid, c.destination[getPlayerStorageValue(pid,c.storage)], false)
            doSendMagicEffect(c.destination[i], CONST_ME_ENERGYAREA)
        end
 
        for i, pid in ipairs(players) do
            addTotal(pid) --adds # of matches played
            if getPlayerStorageValue(pid,c.storage) > 0 and getPlayerStorageValue(pid,c.storage) <= c.players then
                doAddCondition(pid, ( getPlayerSex(cid) == 1 and bmale or bfemale) )
            elseif getPlayerStorageValue(pid,c.storage) > c.players  then
                doAddCondition(pid, ( getPlayerSex(cid) == 1 and rmale or rfemale) )
            end
        end
 
        for i = c.pitchpos.fromy, c.pitchpos.toy do
            for j = c.pitchpos.fromx, c.pitchpos.tox do
                local pos = {x = j, y = i, z = c.pitchpos.z}
                local ball = getTileItemById(pos,2109).uid
                if ball > 0 then
                    doRemoveItem(ball)
                end
            end
        end
        if getTileItemById(c.ballpos,2109).uid < 1 then
            doCreateItem(2109,1,c.ballpos)
        end
        setGlobalStorageValue(1222,c.original)
        addEvent(timeKeeper, 1000, players) --1 second
        return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
    end
end
 
    function timeKeeper(matchplayers)
        local half = c.original/2
        if getGlobalStorageValue(1222) >= 0 then
            setGlobalStorageValue(1222,getGlobalStorageValue(1222) - 1)
            addEvent(timeKeeper, 1000, matchplayers)
        else
            setGlobalStorageValue(c.BLUE_SCORE,0)
            setGlobalStorageValue(c.RED_SCORE,0)
        end
        for i = 1, #matchplayers do
            if getGlobalStorageValue(1222) >= 0 and getGlobalStorageValue(1222) < half then
                if getPlayerStorageValue(matchplayers[i],c.storage) > 0 then
                    doPlayerSendCancel(matchplayers[i], "Time per half : "..( os.date("%M : %S",half)).."   |   Second half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."   |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
                end           
            elseif getGlobalStorageValue(1222) >= half and getGlobalStorageValue(1222) <= c.original then
                if getPlayerStorageValue(matchplayers[i],c.storage) > 0 then
                    doPlayerSendCancel(matchplayers[i], "Time per half : "..( os.date("%M : %S", half )).."   |   First half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."   |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
                end
            end
            if getPlayerStorageValue(matchplayers[i],c.storage) > 0 then
                if getGlobalStorageValue(1222) < 0 then
                    doChangeSpeed(matchplayers[i], getSpeed(matchplayers[i], getPlayerLevel(matchplayers[i])) - getCreatureSpeed(matchplayers[i]))
                        if getGlobalStorageValue(c.RED_SCORE) > getGlobalStorageValue(c.BLUE_SCORE) then
                            if getPlayerStorageValue(matchplayers[i],c.storage) > c.players then
                                doPlayerSendTextMessage(matchplayers[i],25, "Your teams won the match.")
                                addWin(matchplayers[i])
                            elseif getPlayerStorageValue(matchplayers[i],c.storage) <= c.players then
                                doPlayerSendTextMessage(matchplayers[i],22,"You team have lost. No reward for you!")
                            end
                        elseif getGlobalStorageValue(c.BLUE_SCORE) > getGlobalStorageValue(c.RED_SCORE) then
                            if getPlayerStorageValue(matchplayers[i],c.storage) <= c.players then
                                doPlayerSendTextMessage(matchplayers[i],25, "Your teams won the match.")
                                addWin(matchplayers[i])
                            elseif getPlayerStorageValue(matchplayers[i],c.storage) > c.players then
                                doPlayerSendTextMessage(matchplayers[i],22,"You team have lost. No reward for you!")
                            end
                        else
                            doPlayerSendTextMessage(matchplayers[i],22,"Neither of teams won. No rewards!")
                        end
                    doRemoveConditions(matchplayers[i], FALSE)
                    doTeleportThing(matchplayers[i],getTownTemplePosition(getPlayerTown(matchplayers[i])))
                    doSendMagicEffect(getTownTemplePosition(getPlayerTown(matchplayers[i])),10)
                    setPlayerStorageValue(matchplayers[i],c.storage,-1)
                elseif getGlobalStorageValue(1222) == half then
                    doTeleportThing(matchplayers[i], (getPlayerStorageValue(matchplayers[i],c.storage) <= c.players and c.destination[getPlayerStorageValue(matchplayers[i],c.storage)+c.players] or c.destination[getPlayerStorageValue(matchplayers[i],c.storage)-c.players]))
                    doPlayerSendTextMessage(matchplayers[i],22,"Refree : Second half begins.")
                    for i = 1, #c.destination do
                        doSendMagicEffect(c.destination[i],10)
                    end
                    for i = c.pitchpos.fromy, c.pitchpos.toy do
                        for j = c.pitchpos.fromx, c.pitchpos.tox do
                            local pos = {x = j, y = i, z = c.pitchpos.z}
                            local ball = getTileItemById(pos,2109).uid
                            if ball > 0 then
                                doRemoveItem(ball)
                            end
                        end
                    end
                    if getTileItemById(c.ballpos,2109).uid < 1 then
                        doCreateItem(2109,1,c.ballpos)
                    end
                end
            end
        end
        return true
    end
]]> </action>
<movevent type="AddItem" tileitem="1" fromaid="7070" toaid="7072" event="script"><![CDATA[
    domodlib('tutorial_m')
    domodlib('football-lib')
    function onAddItem(moveitem, tileitem, position, cid)
        if(moveitem.itemid ~= 2109) then
            doRemoveItem(moveitem.uid) 
        else
            if getGlobalStorageValue(1222) < 0 then
                doTeleportThing(moveitem.uid,c.ballpos)
            else
                if tileitem.actionid == 7070 then
                    if getGlobalStorageValue(1222) >= c.original/2 then -- blue goal
                        if getPlayerStorageValue(cid,c.storage) > 0 then      
                            doTeleportThing(moveitem.uid,c.ballpos,false)
                            addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                            setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
                            if getPlayerStorageValue(cid,c.storage) > c.players then
                                addGoal(cid)
                            end
                            for _,tid in ipairs(getPlayersOnline()) do
                                if getPlayerStorageValue(tid,c.storage) > 0 then
                                    doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                    for i = 1, #c.destination do
                                        doSendMagicEffect(c.destination[i],10)
                                    end
                                end    
                            end
                        end
                    elseif getGlobalStorageValue(1222) < c.original/2 then -- red goal
                        if getPlayerStorageValue(cid,c.storage) > 0 then      
                            doTeleportThing(moveitem.uid,c.ballpos,false)
                            addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                            setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
                            if getPlayerStorageValue(cid,c.storage) <= c.players then
                                addGoal(cid)
                            end
                            for _,tid in ipairs(getPlayersOnline()) do
                                if getPlayerStorageValue(tid,c.storage) > 0 then
                                    doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                    for i = 1, #c.destination do
                                        doSendMagicEffect(c.destination[i],10)
                                    end
                                end    
                            end
                        end
                    end
                elseif tileitem.actionid == 7071 then    
                    if getGlobalStorageValue(1222) >= c.original/ 2 then --red goal
                        if getPlayerStorageValue(cid,c.storage) > 0 then      
                            doTeleportThing(moveitem.uid,c.ballpos,false)
                            addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                            setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
                            if getPlayerStorageValue(cid,c.storage) <= c.players then
                                addGoal(cid)
                            end
                            for _,tid in ipairs(getPlayersOnline()) do
                                if getPlayerStorageValue(tid,c.storage) > 0 then
                                    doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                    for i = 1, #c.destination do
                                        doSendMagicEffect(c.destination[i],10)
                                    end
                                end    
                            end
                        end
                    elseif getGlobalStorageValue(1222) < c.original / 2 then --blue
                        if getPlayerStorageValue(cid,c.storage) > 0 then      
                            doTeleportThing(moveitem.uid,c.ballpos,false)
                            addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                            setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
                            if getPlayerStorageValue(cid,c.storage) > c.players then
                                addGoal(cid)
                            end
                            for _,tid in ipairs(getPlayersOnline()) do
                                if getPlayerStorageValue(tid,c.storage) > 0 then
                                    doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                    for i = 1, #c.destination do
                                        doSendMagicEffect(c.destination[i],10)
                                    end
                                end    
                            end
                        end
                    end    
                end
            end          
        end
        return true
    end
]]> </movevent>
 
<movevent type="StepIn" actionid="7072" event="script"><![CDATA[
    domodlib('tutorial_m')
    domodlib('football-lib')
    function onStepIn(cid, item, position, fromPosition)
        if(getCreatureSpeed(cid) ~= speed) then 
            doRemoveCondition(cid, CONDITION_HASTE) 
            doChangeSpeed(cid, c.speed - getCreatureSpeed(cid)) 
        end 
        return true
    end
]]> </movevent>
</mod>
 
try this:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Foot ball" version="1.0" author="Damadger" contact="otland.net" enabled="yes">
<config name="tutorial_m"><![CDATA[
 c = {
    speed = 250, 
    players = 1, 
    pitchpos = {fromx = 1012, fromy = 1015, tox = 1034, toy = 1023, z = 7}, 
    ballpos = {x = 1023, y = 1019, z = 7},
    bluePos = {x = 1025, y = 1024, z = 7},
    redPos = {x = 1023, y = 1024, z = 7},
    reddestination = {x = 1027, y = 1019, z = 7},
    bluedestination = {x = 1020, y = 1019, z = 7}, 
    original = 60 , 
    team1pos = {
    {x = 1025, y = 1024, z = 7},
    {x = 1023, y = 1024, z = 7}},
    destination = {
    {x = 1027, y = 1019, z = 7},
    {x = 1020, y = 1019, z = 7}},
    storage = 1919,
    BLUE_SCORE = 1223,
    RED_SCORE = 1224,
    rewards = true, 
         rewards_id = {2494, 2472, 2514, 2160} 
    }
 
 
 
 
]]></config>
 <lib name="football-lib"><![CDATA[
 
function getSpeed(cid,level)
  value = (220 +(2 *(level -1)))
  return value
end
function addTotal(cid)
   return db.executeQuery("UPDATE `players` SET `total` = `total` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
 function addGoal(cid)
    return db.executeQuery("UPDATE `players` SET `goals` = `goals` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
function addWin(cid)
  return db.executeQuery("UPDATE `players` SET `wins` = `wins` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
]]></lib>
<action actionid="2275" event="script"> <![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
local bmale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
local bfemale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
local rmale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
local rfemale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local n = 1
    if getGlobalStorageValue(1222) > 0 then
      doPlayerSendCancel(cid,"There is a on going match right now, please come again later.")
    return true
    end
 local players = {}
   for _, position in ipairs(c.team1pos) do
      local pid = getTopCreature(position).uid
      if(pid == 0 or not isPlayer(pid)) then
         doPlayerSendCancel(cid, "You need ".. c.players * 2 .." players to start the match.")
         return true
      end
 
      table.insert(players, pid)
 
   end
 
   for i, pid in ipairs(players) do
       setPlayerStorageValue(pid,c.storage,n)
       n = n+1
      doTeleportThing(pid, c.destination[getPlayerStorageValue(pid,c.storage)], false)
      doSendMagicEffect(c.destination[i], CONST_ME_ENERGYAREA)
 
   end
   for i, pid in ipairs(players) do
       addTotal(pid)
       if getPlayerStorageValue(pid,c.storage) > 0 and getPlayerStorageValue(pid,c.storage) <= c.players then
            doAddCondition(pid, ( getPlayerSex(cid) == 1 and bmale or bfemale) )
       elseif getPlayerStorageValue(pid,c.storage) > c.players  then
           doAddCondition(pid, ( getPlayerSex(cid) == 1 and rmale or rfemale) )
       end
 
   end
 
     for i = c.pitchpos.fromy, c.pitchpos.toy do
      for j = c.pitchpos.fromx, c.pitchpos.tox do
         local pos = {x = j, y = i, z = c.pitchpos.z}
         local ball = getTileItemById(pos,2109).uid
         if ball > 0 then
            doRemoveItem(ball)
         end
      end
   end
   if getTileItemById(c.ballpos,2109).uid < 1 then
      doCreateItem(2109,1,c.ballpos)
   end
    setGlobalStorageValue(1222,c.original)
 
   return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
end
]]> </action>
<movevent type="AddItem" tileitem="1" fromaid="7070" toaid="7072" event="script"><![CDATA[
      domodlib('tutorial_m')
        domodlib('football-lib')
 
      function onAddItem(moveitem, tileitem, position, cid)
 
if(moveitem.itemid ~= 2109) then
    if getItemDescriptionsById(moveitem.itemid).type == ITEM_TYPE_MAGICFIELD then
         doRemoveItem(moveitem.uid)
     else
     doPlayerAddItem(cid, moveitem.itemid,1)
     doRemoveItem(moveitem.uid)
 
       end
else
  if getGlobalStorageValue(1222) < 0 then
 
       doTeleportThing(moveitem.uid,c.ballpos)
   else
         if tileitem.actionid == 7070 then
               if getGlobalStorageValue(1222) >= c.original/2 then
                      if getPlayerStorageValue(cid,c.storage) > 0 then      
                           doTeleportThing(moveitem.uid,c.ballpos,false)
                          addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                        setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
                                    if getPlayerStorageValue(cid,c.storage) > c.players then
                                         addGoal(cid)
                            end
                                  for _,tid in ipairs(getPlayersOnline()) do
                                     if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                        end    
                                  end
                      end
               elseif getGlobalStorageValue(1222) < c.original/2 then
                     if getPlayerStorageValue(cid,c.storage) > 0 then      
                         doTeleportThing(moveitem.uid,c.ballpos,false)
                        addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                      setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
                                    if getPlayerStorageValue(cid,c.storage) <= c.players then
                                         addGoal(cid)
                            end
                                  for _,tid in ipairs(getPlayersOnline()) do
 
                                     if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                        end    
                                  end
                    end
               end
          elseif tileitem.actionid == 7071 then   
                if getGlobalStorageValue(1222) >= c.original/ 2 then
                    if getPlayerStorageValue(cid,c.storage) > 0 then      
                         doTeleportThing(moveitem.uid,c.ballpos,false)
                        addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                      setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
                                    if getPlayerStorageValue(cid,c.storage) <= c.players then
                                         addGoal(cid)
                           end
                                  for _,tid in ipairs(getPlayersOnline()) do
                                   if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                      end    
                                  end
                    end
               elseif getGlobalStorageValue(1222) < c.original / 2 then
                   if getPlayerStorageValue(cid,c.storage) > 0 then      
                         doTeleportThing(moveitem.uid,c.ballpos,false)
                        addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
                      setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
                          if getPlayerStorageValue(cid,c.storage) > c.players then
                                         addGoal(cid)
                         end
                        for _,tid in ipairs(getPlayersOnline()) do
                                 if getPlayerStorageValue(tid,c.storage) > 0 then
                                            doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                                    for i = 1, #c.destination do
                                                        doSendMagicEffect(c.destination[i],10)
                                                  end
                                    end    
                              end
                    end
               end   
          end
    end        
 
end
 
return true
end
 
]]> </movevent>
 
<movevent type="StepIn" actionid="7072" event="script">
<![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
      function onStepIn(cid, item, position, fromPosition)
  if(getCreatureSpeed(cid) ~= speed) then 
            doRemoveCondition(cid, CONDITION_HASTE) 
            doChangeSpeed(cid, c.speed - getCreatureSpeed(cid)) 
    end 
return true
end
 
 
]]> </movevent>
<globalevent name="timer" interval="1" event="script"><![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
function onThink(cid,interval)
   local half = c.original/2
   local random_item = c.rewards_id[math.random(1, #c.rewards_id)]
   if getGlobalStorageValue(1222) >= 0 then
      setGlobalStorageValue(1222,getGlobalStorageValue(1222) - 1)
   else
      setGlobalStorageValue(c.BLUE_SCORE,0)
      setGlobalStorageValue(c.RED_SCORE,0)
   end
   for _,cid in ipairs(getPlayersOnline()) do
      if getGlobalStorageValue(1222) >= 0 and getGlobalStorageValue(1222) < half then
         if getPlayerStorageValue(cid,c.storage) > 0 then
            doPlayerSendCancel(cid, "Time per half : "..( os.date("%M : %S",half)).."  |  Second half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."  |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
         end          
      elseif getGlobalStorageValue(1222) >= half and getGlobalStorageValue(1222) <= c.original then
         if getPlayerStorageValue(cid,c.storage) > 0 then
            doPlayerSendCancel(cid, "Time per half : "..( os.date("%M : %S", half )).."  |  First half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."  |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
         end
      end
      if getPlayerStorageValue(cid,c.storage) > 0 then
         if getGlobalStorageValue(1222) < 0 then
            doChangeSpeed(cid, getSpeed(cid, getPlayerLevel(cid)) - getCreatureSpeed(cid))
               if c.rewards == true then
                  if getGlobalStorageValue(c.RED_SCORE) > getGlobalStorageValue(c.BLUE_SCORE) then
                     if getPlayerStorageValue(cid,c.storage) > c.players then
                        doPlayerSendTextMessage(cid,25, "Your teams won the match. And recieved a ["..getItemNameById(random_item).."].")
                        doPlayerAddItem(cid,random_item,1)
                        addWin(cid)
                     elseif getPlayerStorageValue(cid,c.storage) <= c.players then
                        doPlayerSendTextMessage(cid,22,"You team have lost. No reward for you!")
                     end
                  elseif getGlobalStorageValue(c.BLUE_SCORE) > getGlobalStorageValue(c.RED_SCORE) then
                     if getPlayerStorageValue(cid,c.storage) <= c.players then
                        doPlayerAddItem(cid,random_item,1)
                        doPlayerSendTextMessage(cid,25, "Your teams won the match. And recieved a ["..getItemNameById(random_item).."].")
                        addWin(cid)
                     elseif getPlayerStorageValue(cid,c.storage) > c.players then
                           doPlayerSendTextMessage(cid,22,"You team have lost. No reward for you!")
                     end
                  else
                     doPlayerSendTextMessage(cid,22,"Neither of teams won. No rewards!")
                  end
               end
               doRemoveConditions(cid, FALSE)
               doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
               doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)
               setPlayerStorageValue(cid,c.storage,-1)
                  for i = c.pitchpos.fromy, c.pitchpos.toy do
                     for j = c.pitchpos.fromx, c.pitchpos.tox do
                        local pos = {x = j, y = i, z = c.pitchpos.z}
                        local ball = getTileItemById(pos,2109).uid
                        if ball > 0 then
                           doRemoveItem(ball)
                        end
                     end
                  end
                  if getTileItemById(c.ballpos,2109).uid < 1 then
                     doCreateItem(2109,1,c.ballpos)
                  end
 
         elseif getGlobalStorageValue(1222) == half then
            doTeleportThing(cid, (getPlayerStorageValue(cid,c.storage) <= c.players and c.destination[getPlayerStorageValue(cid,c.storage)+c.players] or c.destination[getPlayerStorageValue(cid,c.storage)-c.players]))
            doPlayerSendTextMessage(cid,22,"Refree : Second half begins.")
               for i = 1, #c.destination do
                  doSendMagicEffect(c.destination[i],10)
               end
               for i = c.pitchpos.fromy, c.pitchpos.toy do
                  for j = c.pitchpos.fromx, c.pitchpos.tox do
                     local pos = {x = j, y = i, z = c.pitchpos.z}
                     local ball = getTileItemById(pos,2109).uid
                        if ball > 0 then
                           doRemoveItem(ball)
                        end
                  end
               end
               if getTileItemById(c.ballpos,2109).uid < 1 then
                  doCreateItem(2109,1,c.ballpos)
               end
         end
      end
    end
return true
end
]]></globalevent>
<globalevent name="tim" type="start" event="script"><![CDATA[
      domodlib('tutorial_m')
      domodlib('football-lib')
      function onStartup()
         setGlobalStorageValue(c.BLUE_SCORE,0)
         setGlobalStorageValue(c.RED_SCORE,0)
            for i = c.pitchpos.fromy, c.pitchpos.toy do
               for j = c.pitchpos.fromx, c.pitchpos.tox do
                  local pos = {x = j, y = i, z = c.pitchpos.z}
                  local ball = getTileItemById(pos,2109).uid
                  if ball > 0 then
                     doRemoveItem(ball)
                  end
               end
            end
            if getTileItemById(c.ballpos,2109).uid < 1 then
               doCreateItem(2109,1,c.ballpos)
            end
         return true
      end
]]></globalevent>
</mod>
 
Plz i don't undertand how to edit this part:

XML:
    bluePos = {x = 1025, y = 1024, z = 7},
    redPos = {x = 1023, y = 1024, z = 7},
    reddestination = {x = 1027, y = 1019, z = 7},
    bluedestination = {x = 1020, y = 1019, z = 7}, 
    original = 60 , 
    team1pos = {
    {x = 997, y = 1207, z = 7},
    {x = 998, y = 1207, z = 7}},
    destination = {
    {x = 1027, y = 1019, z = 7},
    {x = 1020, y = 1019, z = 7}},

what is the difference between blue/red pos and blue/red destination? :/
could you explain me what is all that? D: i would be really apreciated :)
 
Last edited:
don't edit
Code:
bluePos = {x = 1025, y = 1024, z = 7},
    redPos = {x = 1023, y = 1024, z = 7},
    reddestination = {x = 1027, y = 1019, z = 7},
    bluedestination = {x = 1020, y = 1019, z = 7},

other i only adjunt ,read your script.
 
oooh Ok, and what uniques and actions ids should i use in lever and in the floor?

- - - Updated - - -

look i put 7070 in the first tile, 7071 in second and 7072 in third in both team tiles
in the lever i use 2275 i believe, but when i try to go to the tiles to pull the lever, this happens:

14:23 The tile seems to be protected against unwanted intruders.
and i can't pass, and when i use the lever not standing in the tiles it says that i need two more players :S
 
Last edited:
It seems like you have a football.lua in movements, I cannot find the variable the error refers to in the mod you posted anyway.
 
No no, the last mod is working, the problem is i don't know the actions or unique ids i have to use on the lever or the tiles :S

- - - Updated - - -

oooh Ok, and what uniques and actions ids should i use in lever and in the floor?

- - - Updated - - -

look i put 7070 in the first tile, 7071 in second and 7072 in third in both team tiles
in the lever i use 2275 i believe, but when i try to go to the tiles to pull the lever, this happens:


and i can't pass, and when i use the lever not standing in the tiles it says that i need two more players :S

that is my problem i have the MOD but idk what actions or uniques ids to use and where
 
Back
Top