Lua:local wait = 30 -- seconds local storage = 20000 function onUse(cid, item, fromPos, toPos) if getCreatureStorage(cid, storage) > os.time() then doPlayerSendCancel(cid, "you must wait another "..getCreatureStorage(cid, storage)-os.time().." seconds before you can use the lever again.") else -- do other shit doCreatureAddStorage(cid, storage, os.time() + seconds) end return true end
Lua:local wait = 30 -- seconds local storage = 20000 function onUse(cid, item, fromPos, toPos) if getCreatureStorage(cid, storage) > os.time() then doPlayerSendCancel(cid, "you must wait another "..getCreatureStorage(cid, storage)-os.time().." seconds before you can use the lever again.") else -- do other shit doCreatureAddStorage(cid, storage, os.time() + seconds) end return true end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
local s = getStorage(1)
if os.time() < s then
return doPlayerSendCancel(cid, 'You must wait ' .. s - os.time() .. ' more seconds.')
end
local k = getTileItemById({x=1167, y=1155, z=7}, 2151).uid
if k ~= 0 then
doRemoveItem(k)
doCreateMonster('Bloody Mary', {x=1168, y=1156, z=7})
doCreateItem(2776, 1, {x=1168, y=1158, z=7})
doCreateItem(2776, 1, {x=1169, y=1158, z=7})
doCreateItem(2774, 1, {x=1170, y=1158, z=7})
doCreateItem(2776, 1, {x=1171, y=1157, z=7})
doCreateItem(2774, 1, {x=1171, y=1154, z=7})
doCreateItem(2776, 1, {x=1165, y=1153, z=7})
doCreateItem(2774, 1, {x=1169, y=1152, z=7})
doCreateItem(2776, 1, {x=1165, y=1157, z=7})
doSendMagicEffect({x=1168, y=1156, z=7}, CONST_ME_TELEPORT)
doCreatureSay(cid, 'Hahaha, now you are trapped!', TALKTYPE_ORANGE_1)
doSetStorage(1, os.time() + 3 * 3600)
else
return doPlayerSendCancel(cid, 'Sorry, not possible.')
end
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
Lua:function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 1945 then local s = getStorage(1) if os.time() < s then return doPlayerSendCancel(cid, 'You must wait ' .. s - os.time() .. ' more seconds.') end local k = getTileItemById({x=1167, y=1155, z=7}, 2151).uid if k ~= 0 then doRemoveItem(k) doCreateMonster('Bloody Mary', {x=1168, y=1156, z=7}) doCreateItem(2776, 1, {x=1168, y=1158, z=7}) doCreateItem(2776, 1, {x=1169, y=1158, z=7}) doCreateItem(2774, 1, {x=1170, y=1158, z=7}) doCreateItem(2776, 1, {x=1171, y=1157, z=7}) doCreateItem(2774, 1, {x=1171, y=1154, z=7}) doCreateItem(2776, 1, {x=1165, y=1153, z=7}) doCreateItem(2774, 1, {x=1169, y=1152, z=7}) doCreateItem(2776, 1, {x=1165, y=1157, z=7}) doSendMagicEffect({x=1168, y=1156, z=7}, CONST_ME_TELEPORT) doCreatureSay(cid, 'Hahaha, now you are trapped!', TALKTYPE_ORANGE_1) doSetStorage(1, os.time() + 3 * 3600) else return doPlayerSendCancel(cid, 'Sorry, not possible.') end end return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) end
[Error - Action Interface]
data/actions/scripts/bomb.luanUse
Description:
data/actions/scripts/bomb.lua:8: attempt to perform arithmetic on global 'seconds' (a nil value)
stack traceback:
data/actions/scripts/bomb.lua:8: in function <data/actions/scripts/bomb.lua:3>
Lua:local wait = 30 -- seconds local storage = 20000 function onUse(cid, item, fromPos, toPos) if getCreatureStorage(cid, storage) > os.time() then doPlayerSendCancel(cid, "you must wait another "..getCreatureStorage(cid, storage)-os.time().." seconds before you can use the lever again.") else -- do other shit doCreatureAddStorage(cid, storage, os.time() + seconds) end return true end
function getPlayersInRange(position, radiusx, radiusy)
local creaturesList = {}
for x = -radiusx, radiusx do
for y = -radiusy, radiusy do
if not (x == 0 and y == 0) then
local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
if creature.type == 1 then
table.insert(creaturesList, creature.uid)
end
end
end
end
local creature = getTopCreature(position)
if creature.type == 1 then
if not(table.find(creaturesList, creature.uid)) then
table.insert(creaturesList, creature.uid)
end
end
return creaturesList
end
local t, n, storage = {
{x=951, y=1442, z=14},
{x=951, y=1443, z=14},
{x=951, y=1444, z=14},
{x=951, y=1445, z=14},
{x=949, y=1445, z=14},
{x=950, y=1445, z=14},
{x=952, y=1445, z=14},
{x=953, y=1445, z=14}
}, {
{x=896, y=1434, z=14},
{x=930, y=1434, z=14},
{x=930, y=1464, z=14},
{x=896, y=1464, z=14},
{x=921, y=1454, z=14},
{x=905, y=1444, z=14},
{x=921, y=1444, z=14},
{x=905, y=1454, z=14},
{x=921, y=1454, z=14}
}, {
placed = 101,
max = 102,
radius = 103
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1946 then
return doTransformItem(item.uid, item.itemid - 1)
end
local v = getPlayersInRange({x=913,y=1449,z=14}, 34, 30)
if #v > 1 then
return doPlayerSendCancel(cid, "Please wait for the current match to end.")
end
local players = {}
for i = 1, #t do
local v = getTopCreature(t[i]).uid
players[i] = isPlayer(v) and v or nil
end
if #players < 2 then
return doPlayerSendCancel(cid, "You need at least 2 players to enter.")
end
local first = players[1] and 1 or players[2] and 2 or players[3] and 3 or players[4] and 4 or players[5] and 5 and 6 or players[6] and 7 or players[7] and 7 and 8 or players[8] and 8
for i = 1, 8 do
if players[i] then
setPlayerStorageValue(players[i], storage.placed, 0)
setPlayerStorageValue(players[i], storage.max, 1)
setPlayerStorageValue(players[i], storage.radius, 1)
doSendMagicEffect(t[i], CONST_ME_TELEPORT)
doTeleportThing(players[i], n[i])
doSendMagicEffect(n[i], CONST_ME_TELEPORT)
end
end
doTransformItem(item.uid, item.itemid + 1)
return true
end
updated previous post try again
I'm a donkey. I can't understand anything you just said
Get a family member to translate for you.I want a player can not do it, using a lever since its first use and he can get it after 6 minutes and go back time
sorry my english very bad
Use lever -> wait 6 minutesboa tarde, eu quero que qualquer jogador, que for usar a alavanca pela primeira vez não consiga, ai começa a contar um tempo de 6 minutos, caso um segundo tentar usar tbm não consiga e o tempo vai regredindo exemplo 5 minutos, e por ai vai, depois que o tempo acabar qualquer um consiga usar...
@Xikini
I think this will work. ¯\(ツ)/¯@Xikini yes, ty
global_lever_storage = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not global_lever_storage[1] then
global_lever_storage[1] = 7
global_lever_storage[2] = 0
end
if global_lever_storage[1] >= 0 then
local time = os.time()
if time < global_lever_storage[2] then
doCreatureSay(cid, "Lever can be used again in " .. (global_lever_storage[2] - time) .. " seconds.", TALKTYPE_ORANGE_1)
return true
else
global_lever_storage[1] = global_lever_storage[1] - 1
global_lever_storage[2] = time + (global_lever_storage[1] * 60)
end
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return true
end
function getPlayersInRange(position, radiusx, radiusy)
local creaturesList = {}
for x = -radiusx, radiusx do
for y = -radiusy, radiusy do
if not (x == 0 and y == 0) then
local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
if creature.type == 1 then
table.insert(creaturesList, creature.uid)
end
end
end
end
local creature = getTopCreature(position)
if creature.type == 1 then
if not(table.find(creaturesList, creature.uid)) then
table.insert(creaturesList, creature.uid)
end
end
return creaturesList
end
local t, n, storage = {
{x=951, y=1442, z=14},
{x=951, y=1443, z=14},
{x=951, y=1444, z=14},
{x=951, y=1445, z=14},
{x=949, y=1445, z=14},
{x=950, y=1445, z=14},
{x=952, y=1445, z=14},
{x=953, y=1445, z=14}
}, {
{x=896, y=1434, z=14},
{x=930, y=1434, z=14},
{x=930, y=1464, z=14},
{x=896, y=1464, z=14},
{x=921, y=1454, z=14},
{x=905, y=1444, z=14},
{x=921, y=1444, z=14},
{x=905, y=1454, z=14},
{x=921, y=1454, z=14}
}, {
placed = 101,
max = 102,
radius = 103
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1946 then
return doTransformItem(item.uid, item.itemid - 1)
end
local v = getPlayersInRange({x=913,y=1449,z=14}, 34, 30)
if #v > 1 then
return doPlayerSendCancel(cid, "Please wait for the current match to end.")
end
local players = {}
for i = 1, #t do
local v = getTopCreature(t).uid
players = isPlayer(v) and v or nil
end
if #players < 2 then
return doPlayerSendCancel(cid, "You need at least 2 players to enter.")
end
local first = players[1] and 1 or players[2] and 2 or players[3] and 3 or players[4] and 4 or players[5] and 5 and 6 or players[6] and 7 or players[7] and 7 and 8 or players[8] and 8
for i = 1, 8 do
if players then
setPlayerStorageValue(players, storage.placed, 0)
setPlayerStorageValue(players, storage.max, 1)
setPlayerStorageValue(players, storage.radius, 1)
doSendMagicEffect(t, CONST_ME_TELEPORT)
doTeleportThing(players, n)
doSendMagicEffect(n, CONST_ME_TELEPORT)
end
end
doTransformItem(item.uid, item.itemid + 1)
return true
end