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

why does this script dont work

agomez

Member
Joined
Jan 28, 2009
Messages
211
Reaction score
5
i hate this script but it dont work, just say: 1...,2....,3....4,....5...., the bomb has planted :<and it dont explote

PHP:
local PLANTING_DELAY = 5 --seconds
local EXPLOSION_DELAY = 5000 --milliseconds
local MAX_HIT = 500
local MIN_HIT = 100

local PVP = true -- true for PVP, false for Non-PVP


local PLAYERS = {}

function isInArray(table, valor)
  for i,j in pairs(table) do
    if (j == valor) then
      return i
    end
  end
  return 0
end

function explosion(info)
   area = {
		{0,0,0,0,0},
		{0,1,1,1,0},
		{0,1,1,1,0},
		{0,1,1,1,0}, 
		{0,0,0,0,0},
	   }
	hitpos = {x=info.pos.x, y=info.pos.y, z=info.pos.z, stackpos=253}
        center = {}
        center.y = math.floor(table.getn(area)/2)+1
	for i in ipairs(area) do
          center.x = math.floor(table.getn(area[i])/2)+1
          for j, v in ipairs(area[i]) do
            if (v == 1) then
	      hitpos.x = info.pos.x + (j - center.x)
	      hitpos.y = info.pos.y + (i - center.y)
	      if (getTilePzInfo(hitpos) == 0) then   
	        victim = getThingfromPos(hitpos)
		effect = 4
		if ((j == center.x) and (i == center.y)) then
		  doSendAnimatedText(hitpos,"KABOOOOOM",TEXTCOLOR_RED)
		  hitpoints = MAX_HIT
		  effect = 5
		else
		  hitpoints = math.random(MIN_HIT,MAX_HIT)
		end
                if (isPlayer(victim.uid) == 1) then
		  if (PVP == true) then
                     doPlayerSendTextMessage(victim.uid,20,"You have lost "..hitpoints.." hitpoints by "..getPlayerName(info.player).."'s plastic bomb") 
                  else
                    hitpoints = 0
                  end
                end
		if (isCreature(victim.uid) == 1) then
		  doPlayerAddHealth(victim.uid,-hitpoints)
                end
	        doSendMagicEffect(hitpos,effect)
              end
            end
	  end
	end
  PLAYERS[isInArray(PLAYERS, info.player)] = 0
  mayNotLogout(info.player, 0)
  return 1
end

function planting(info)
  if info.num == PLANTING_DELAY then
	doPlayerSendTextMessage(info.player,22,"Plastic Bomb successfully planted!")
	mayNotMove(info.player,0)
	addEvent(explosion,EXPLOSION_DELAY,info)
  else
	info.num = info.num + 1
	doPlayerSendTextMessage(info.player,22,info.num.."...")
	addEvent(planting,1000,info)
  end
  return 1
end

function onUse(cid, item, frompos, item2, topos) 
  position = getThingPos(item.uid)
  if (getTilePzInfo(position) == 0) then
   	if (isInArray(PLAYERS, cid) == 0) then	
		table.insert(PLAYERS, cid)	
		doSendMagicEffect(frompos,3) 
		info = {player = cid, pos = position, num = 1} 
		doPlayerSendTextMessage(cid,22,"Planting the bomb...")
		doPlayerSendTextMessage(cid,22,"1...")
		mayNotMove(cid,1)
		mayNotLogout(cid, 1)
		doRemoveItem(item.uid,1)
		addEvent(planting,1000,info)
	else
		doPlayerSendCancel(cid,"You can only plant one bomb at the same time.")
	end
  else
	doPlayerSendCancel(cid,"You can not plant this bomb in a PZ!")
  end	
  return 1
end
 
well, this is a working polish time bomb :p
LUA:
-- Skrypt hecho por no se cual polaco, arreglado y traducido por Cybermaster, probado en TFS 0.3.6pl1 -- 
local mainStorage = 1500 -- Main storage value
local maxBombCount = 5 -- How many seconds you can plant a bomb. Each bomb storage needs 4
local podlozenoTime = 2 -- How many seconds loading bombs
local naCzas = 'yes' -- Is a time bomb (yes) or detonates when you use item (no)
local tekst = 'yes' -- Show a message when the bomb explodes?
local uciekac = 'no' -- display the inscription of running away when the bomb explodes?
local wybuchTime = 3 -- After how many seconds after a bomb...
local area = { -- 3 is bomb position, 1 is a tile which will explode
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}
local min = 100 -- Min. hp that will deal
local max = 300 -- Max. hp that will deal
local kolorTekstow = (TALKTYPE_MONSTER ~= nil and TALKTYPE_MONSTER or TALKTYPE_ORANGE_1) -- Color Messages
local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, key, value)
setConditionParam(condition, CONDITION_PARAM_TICKS,(podlozenoTime+wybuchTime+1)*1000)
area = createCombatArea(area)
naCzas = naCzas == 'yes' and true or false
tekst = tekst == 'yes' and true or false
uciekac = uciekac == 'yes' and true or false

function onUse(cid, item, fromPosition, itemEx, toPosition)    
    if item.itemid == 8300 then
        if naCzas then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You may not detonate a bomb.")
            return true
        end
        -- Bomb Detonation
        local aktualnyStorage = mainStorage+1
        local ileBomb = 0 -- How many bombs exploded in
        while getCreatureStorage(cid,aktualnyStorage) > 0 do
            local pos = {x=getCreatureStorage(cid,aktualnyStorage), y=getCreatureStorage(cid,aktualnyStorage+1), z=getCreatureStorage(cid,aktualnyStorage+2), stackpos=getCreatureStorage(cid,aktualnyStorage+3)}
            ileBomb = ileBomb+1
            detonujBombe(cid, pos, aktualnyStorage)
            aktualnyStorage = aktualnyStorage+4
        end
        if ileBomb == 0 then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'No has colocado una bomba.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,ileBomb ..' bomb'.. (ileBomb == 1 and 'a' or '') ..' Explotada'.. (ileBomb == 1 and '' or 'o') ..'.')
        end
        return true
    end
    -- Bomb
    local playerPos = getCreaturePosition(cid)
    if getTileInfo(playerPos).protection or getTileInfo(playerPos).house then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'No puedes poner una bomba en zona de protección.')
        return true
    end
    local aktualneBomby = getCreatureStorage(cid,mainStorage)
    if aktualneBomby+maxBombCount > os.time() then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Debes esperar para poner otra bomba.')
        return true
    end
    local ileMaBomb = 0
    local aktualnyStorage = mainStorage+1
    while(getCreatureStorage(cid,aktualnyStorage) > 0) do
        ileMaBomb = ileMaBomb+1
        aktualnyStorage = aktualnyStorage+4
    end
    if(item.type > 1) then
        doChangeTypeItem(item.uid,item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
    doCreatureSay(cid,'...',kolorTekstow)
    addEvent(podlozBombe,podlozenoTime*1000,cid,playerPos,aktualnyStorage)
    doCreatureSetStorage(cid,mainStorage,os.time())
end

function podlozBombe(cid, pozycjaGracza, storage)
    if not isPlayer(cid) then
        return false
    end
    local playerPos = getCreaturePosition(cid)
    if(playerPos.x ~= pozycjaGracza.x or playerPos.y ~= pozycjaGracza.y or playerPos.z ~= pozycjaGracza.z) then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Te moviste y no se pudo colocar la bomba.')
        return true
    end
    local bomba = doCreateItem(9893,1,pozycjaGracza)
    local bombaPos = getThingPos(bomba)
    doCreatureSetStorage(cid,storage,pozycjaGracza.x)
    doCreatureSetStorage(cid,storage+1,pozycjaGracza.y)
    doCreatureSetStorage(cid,storage+2,pozycjaGracza.z)
    doCreatureSetStorage(cid,storage+3,bombaPos.stackpos)
    if(not naCzas) then
        doCreatureSay(cid,'Bomba armada',kolorTekstow)
        doAddCondition(cid,condition)
    else
        if(uciekac) then
            doCreatureSay(cid,'Corre! La bomba estallará pronto!',kolorTekstow)
        end
        addEvent(detonujBombe,wybuchTime*1000,cid,bombaPos,storage)
        doAddCondition(cid,condition)
    end
    return true
end

function detonujBombe(cid, pos, storage)
    local playerPos = getCreaturePosition(cid)
    if(playerPos.x ~= pos.x or playerPos.y ~= pos.y or playerPos.z ~= pos.z) then
        pos.stackpos = pos.stackpos-1
    end
    local bomba = getThingfromPos(pos)
    if(bomba.itemid == 9893) then
        doAreaCombatHealth(0, COMBAT_PHYSICALDAMAGE, pos, area, -min, -max, CONST_ME_FIREAREA)
        doCreatureSetStorage(cid,storage,0)
        if(tekst) then
            doSendAnimatedText(pos,'Kaboom!!',TEXTCOLOR_RED)
        end
        doRemoveItem(bomba.uid,1)
        return true
    end
    return false
end
 
well, this is a working polish time bomb :p
LUA:
-- Skrypt hecho por no se cual polaco, arreglado y traducido por Cybermaster, probado en TFS 0.3.6pl1 -- 
local mainStorage = 1500 -- Main storage value
local maxBombCount = 5 -- How many seconds you can plant a bomb. Each bomb storage needs 4
local podlozenoTime = 2 -- How many seconds loading bombs
local naCzas = 'yes' -- Is a time bomb (yes) or detonates when you use item (no)
local tekst = 'yes' -- Show a message when the bomb explodes?
local uciekac = 'no' -- display the inscription of running away when the bomb explodes?
local wybuchTime = 3 -- After how many seconds after a bomb...
local area = { -- 3 is bomb position, 1 is a tile which will explode
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}
local min = 100 -- Min. hp that will deal
local max = 300 -- Max. hp that will deal
local kolorTekstow = (TALKTYPE_MONSTER ~= nil and TALKTYPE_MONSTER or TALKTYPE_ORANGE_1) -- Color Messages
local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, key, value)
setConditionParam(condition, CONDITION_PARAM_TICKS,(podlozenoTime+wybuchTime+1)*1000)
area = createCombatArea(area)
naCzas = naCzas == 'yes' and true or false
tekst = tekst == 'yes' and true or false
uciekac = uciekac == 'yes' and true or false

function onUse(cid, item, fromPosition, itemEx, toPosition)    
    if item.itemid == 8300 then
        if naCzas then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You may not detonate a bomb.")
            return true
        end
        -- Bomb Detonation
        local aktualnyStorage = mainStorage+1
        local ileBomb = 0 -- How many bombs exploded in
        while getCreatureStorage(cid,aktualnyStorage) > 0 do
            local pos = {x=getCreatureStorage(cid,aktualnyStorage), y=getCreatureStorage(cid,aktualnyStorage+1), z=getCreatureStorage(cid,aktualnyStorage+2), stackpos=getCreatureStorage(cid,aktualnyStorage+3)}
            ileBomb = ileBomb+1
            detonujBombe(cid, pos, aktualnyStorage)
            aktualnyStorage = aktualnyStorage+4
        end
        if ileBomb == 0 then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'No has colocado una bomba.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,ileBomb ..' bomb'.. (ileBomb == 1 and 'a' or '') ..' Explotada'.. (ileBomb == 1 and '' or 'o') ..'.')
        end
        return true
    end
    -- Bomb
    local playerPos = getCreaturePosition(cid)
    if getTileInfo(playerPos).protection or getTileInfo(playerPos).house then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'No puedes poner una bomba en zona de protección.')
        return true
    end
    local aktualneBomby = getCreatureStorage(cid,mainStorage)
    if aktualneBomby+maxBombCount > os.time() then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Debes esperar para poner otra bomba.')
        return true
    end
    local ileMaBomb = 0
    local aktualnyStorage = mainStorage+1
    while(getCreatureStorage(cid,aktualnyStorage) > 0) do
        ileMaBomb = ileMaBomb+1
        aktualnyStorage = aktualnyStorage+4
    end
    if(item.type > 1) then
        doChangeTypeItem(item.uid,item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
    doCreatureSay(cid,'...',kolorTekstow)
    addEvent(podlozBombe,podlozenoTime*1000,cid,playerPos,aktualnyStorage)
    doCreatureSetStorage(cid,mainStorage,os.time())
end

function podlozBombe(cid, pozycjaGracza, storage)
    if not isPlayer(cid) then
        return false
    end
    local playerPos = getCreaturePosition(cid)
    if(playerPos.x ~= pozycjaGracza.x or playerPos.y ~= pozycjaGracza.y or playerPos.z ~= pozycjaGracza.z) then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Te moviste y no se pudo colocar la bomba.')
        return true
    end
    local bomba = doCreateItem(9893,1,pozycjaGracza)
    local bombaPos = getThingPos(bomba)
    doCreatureSetStorage(cid,storage,pozycjaGracza.x)
    doCreatureSetStorage(cid,storage+1,pozycjaGracza.y)
    doCreatureSetStorage(cid,storage+2,pozycjaGracza.z)
    doCreatureSetStorage(cid,storage+3,bombaPos.stackpos)
    if(not naCzas) then
        doCreatureSay(cid,'Bomba armada',kolorTekstow)
        doAddCondition(cid,condition)
    else
        if(uciekac) then
            doCreatureSay(cid,'Corre! La bomba estallará pronto!',kolorTekstow)
        end
        addEvent(detonujBombe,wybuchTime*1000,cid,bombaPos,storage)
        doAddCondition(cid,condition)
    end
    return true
end

function detonujBombe(cid, pos, storage)
    local playerPos = getCreaturePosition(cid)
    if(playerPos.x ~= pos.x or playerPos.y ~= pos.y or playerPos.z ~= pos.z) then
        pos.stackpos = pos.stackpos-1
    end
    local bomba = getThingfromPos(pos)
    if(bomba.itemid == 9893) then
        doAreaCombatHealth(0, COMBAT_PHYSICALDAMAGE, pos, area, -min, -max, CONST_ME_FIREAREA)
        doCreatureSetStorage(cid,storage,0)
        if(tekst) then
            doSendAnimatedText(pos,'Kaboom!!',TEXTCOLOR_RED)
        end
        doRemoveItem(bomba.uid,1)
        return true
    end
    return false
end

yeye, more like pl + spanish bomb
 
Back
Top