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

Action Plastic Bomb

Some error. This bomb work 100% Buts it do that you cant close this door and windows been buged? I dont know why :S
 
What its wrong. I dont do some change of this script and adding it on my own forgotten server. But its do debugs on this doors and windows! Very wierd.
 
There's a small error in here:

PHP:
if (isCreature(victim.uid) == 1) then
	    doPlayerAddHealth(victim.uid,-hitpoints)
    end

There, u must change doPlayerAddHealth to doCreatureAddHealth , so the result is:

PHP:
if (isCreature(victim.uid) == 1) then
        doCreatureAddHealth(victim.uid,-hitpoints)
     end


Very nice script, by the way!! :)
 
Hey!

I use this script working 100% for me.

Code:
----------Plastic Bomb by Colex-----------

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

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

function explosion(info)
XY = {
{-1,-1},{00,-1},{01,-1},
{-1,00},{00,00},{01,00},
{-1,01},{00,01},{01,01} 
}
hitpos = {x=info.pos.x, y=info.pos.y, z=info.pos.z, stackpos=253}
for i in ipairs(XY) do
hitpos.x = info.pos.x + XY[i][1] 
hitpos.y = info.pos.y + XY[i][2] 
if (getTilePzInfo(hitpos) == 0) then 
victim = getThingfromPos(hitpos)
effect = 4
if ((hitpos.x == info.pos.x) and (hitpos.y == info.pos.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
doCreatureAddHealth(victim.uid,-hitpoints)
end
doSendMagicEffect(hitpos,effect)
end
end
mayNotLogout(info.player, 0)
return 1
end

function planting(info)
if info.num == PLANTING_DELAY then
doPlayerSendTextMessage(info.player,22,"Plastic Bomb successfully planted!")
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 
doSendMagicEffect(frompos,3) 
info = {player = cid, pos = position, num = 1} 
doPlayerSendTextMessage(cid,22,"Planting the bomb...")
doPlayerSendTextMessage(cid,22,"1...")
doRemoveItem(item.uid,1)
addEvent(planting,1000,info)
else
doPlayerSendCancel(cid,"You can not plant this bomb in a PZ!")
end 
return 1
end
 
Last edited by a moderator:
Lmao, still bugged. When I install this script, I cannot close any door.
 
i am using tfs how to make work?
Code:
Lua Script Error: [Action Interface] 
in a timer event called from: 
data/actions/scripts/tools/bomb.lua:onUse

data/actions/scripts/tools/bomb.lua:57: attempt to call global 'doPlayerAddHealth' (a nil value)
 
umm i got it set how i like it but they cant use it again after the first on explodes can someone help me


local PLANTING_DELAY = 3 --seconds
local EXPLOSION_DELAY = 500 --milliseconds
local MAX_HIT = 800
local MIN_HIT = 400

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)/2)+1
for j, v in ipairs(area) 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
end

function planting(info)
if info.num == PLANTING_DELAY then
doPlayerSendTextMessage(info.player,22,"Plastic Bomb successfully planted!")
addEvent(explosion,EXPLOSION_DELAY,info)
else
info.num = info.num + 1
doPlayerSendTextMessage(info.player,22,info.num.."...")
addEvent(planting,300,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...")
doRemoveItem(item.uid,1)
addEvent(planting,100,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
 
Greets,


Is it possible to make it for certain vocs and levels?
 
Last edited:
i am using tfs how to make work?
Code:
Lua Script Error: [Action Interface] 
in a timer event called from: 
data/actions/scripts/tools/bomb.lua:onUse

data/actions/scripts/tools/bomb.lua:57: attempt to call global 'doPlayerAddHealth' (a nil value)

replace doPlayerAddHealth with doCreatureAddHealth
 
Is it possible to make this script,
so you can throw it like a grenade,
and when it hits the ground you got 3 seconds
and itll blow up or something.
 
0o

i love it omg yes i do but how can i change it to do damage to players and creatures? and set more than one at a time? And players cant use one after one went off...... =\
 
Back
Top