• 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!

Lua Script 0.3.6 -> 1.2

Deletera28

Member
Joined
Apr 29, 2010
Messages
38
Reaction score
10
Hey, Im trying to convert a tfs script from 0.3.6 to 1.2 but im getting so many errors, so if there is someone who could help me would be awesome! Here is the original script:

Code:
-- This program is free software: you can redistribute it and/or modify

-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

-- //

function onStepIn(cid, item, pos, fromPosition)
local pos = getThingPos(cid)
if item.actionid == 16203 then
  if not isPlayer(cid) then
      return true
  end
  if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then
   doSendMagicEffect(getThingPos(cid), 14)
   doSendAnimatedText(pos, "CoH", math.random(1, 255))
  else
   doSendMagicEffect(getThingPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não pertence á guild "..getGlobalStorageValue(COH_STATUS)..".")
  end
  return true
end

    if item.actionid == 16202 then
     if not isPlayer(cid) then
      return true
  end

  if getPlayerGuildId(cid) > 0 then
   if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then
          doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!")
       setGlobalStorageValue(COH_PREPARE1, -1)
       setGlobalStorageValue(COH_PREPARE2, -1)
       setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid))
       doCastleRemoveEnemies()
    doBroadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estão no comando do castelo, vá dominar e impedir isso!")
      end
     else
   doSendMagicEffect(pos, 2)
   doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")
   end
      return true
end

    if item.actionid == 16200 then
  if not isPlayer(cid) then
      return true
  end
  if getPlayerGuildId(cid) > 0 then
   doSendAnimatedText(pos, "CoH", math.random(1, 255))
   if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then
    setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid))
    doBroadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está tentando dominar o castelo, preparem-se!")
   end
  else
   doSendMagicEffect(pos, 2)
   doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")
   return true
  end
end
if item.actionid == 16201 then
  if not isPlayer(cid) then
      return true
  end
  doSendAnimatedText(pos, "CoH", math.random(1, 255))
  if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then
   setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid))
   doBroadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está muito próxima do domínio, ataquem!")
  end
end
return true
end


@EDITI - Solved, if someone needs this scripts in tfs 1.2 here is the code working 100%

Code:
function onStepIn(cid, item, pos, fromPosition)
 local pos = getThingfromPos(cid)

 if item.actionid == 16203 then 
  if not isPlayer(cid) then
     return true
  end 
  if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then
   doSendMagicEffect(getThingfromPos(cid), 14)
   doPlayerSendTextMessage(cid, 4, "[CoH] Membros da guild dominante "..getGlobalStorageValue(COH_STATUS).." possuem o privilegio de passar por aqui!")
  else
   doSendMagicEffect(getThingfromPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não pertence á guild dominante "..getGlobalStorageValue(COH_STATUS)..".")
  end
  return true
 end

    if item.actionid == 16202 then
    if not isPlayer(cid) then
     return true
  end
  if getPlayerGuildLevel(cid) > 0 then
   if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then
          doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!")
     setGlobalStorageValue(COH_PREPARE1, -1)
       setGlobalStorageValue(COH_PREPARE2, -1)
     setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid))
     doCastleRemoveEnemies()
    broadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
      end
    else
   doSendMagicEffect(getThingfromPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")
   end
    return true
 end

    if item.actionid == 16200 then
  if not isPlayer(cid) then
     return true
  end
  if getPlayerGuildLevel(cid) > 0 then
   doPlayerSendTextMessage(cid, 4, "CoH Invasion Camp!")
   if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then
    setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid))
    broadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está indo em direção ao Castelo. Guild dominante preparem-se!")
   end
  else
   doSendMagicEffect(getThingfromPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")  
   return true
  end  
 end

 if item.actionid == 16201 then
  if not isPlayer(cid) then
     return true
  end
  doPlayerSendTextMessage(cid, 4, "CoH Invasion Castle!")
  if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then
   setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid))
   broadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
  end
 end
 return true
end
 
Last edited:
Back
Top