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

[Request] onDeath doRemoveItem

przemek1991

New Member
Joined
Feb 17, 2008
Messages
25
Reaction score
0
Hi, I need a script that remove item created by script onStepIn when someone dies in area. I writed something like that but it don't work
PHP:
local tree = {x = 32716, y = 32345, z = 7, stackpos=1}
local frompos = {x = 32705, y = 32343, y = 7, stackpos=1}
local topos = {x = 32726, y = 32357, y = 7, stackpos=1}

function onDeath(cid, pos)
if isInArea(getPlayerPosition(cid), frompos, topos) then
doRemoveItem(2717, tree)

end 
return TRUE
end
If somebody know how to do it I give rep+ :p thanks
 
What about using getThingFromPos(pos)?

Lua:
local treePos = {x = 32716, y = 32345, z = 7, stackpos=1}
local frompos = {x = 32705, y = 32343, y = 7}
local topos = {x = 32726, y = 32357, y = 7}

function onDeath(cid, pos)
	if isInArea(getPlayerPosition(cid), frompos, topos) then
		doRemoveItem(getThingFromPos(treePos).uid, 1)
		end 
	return TRUE
end
 
If you are using 0.3.4 or 0.3.3 iI'm not sure, then change from isInArea to isInArray.

try

Lua:
local treePos = {x = 32716, y = 32345, z = 7, stackpos=1}
local frompos = {x = 32705, y = 32343, y = 7}
local topos = {x = 32726, y = 32357, y = 7}

function onDeath(cid, pos)
	if isInArray({frompos, topos}, getPlayerPosition(cid)) then
		doRemoveItem(getThingFromPos(treePos).uid, 1)
		end 
	return TRUE
end
 
Last edited:
still the same with that script :(
PHP:
  local treePos = {x = 32716, y = 32345, z = 7, stackpos=1}
local frompos = {x = 32705, y = 32343, y = 7}
local topos = {x = 32726, y = 32357, y = 7}

function onDeath(cid, pos)
        if isInArray({frompos, topos}, getPlayerPosition(cid)) then
                doRemoveItem(getThingFromPos(treePos).uid, 1)
                end
        return TRUE
end
PHP:
<event type="death" name="PlayerDeath" event="script" value="DOQdeath.lua"/>
the floor uid 32193, tree dont have uid
 
Last edited:
yes, i tried and it didnt work ;x i get error in console error with db
Code:
mysql_real_query(): DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = 9 ORDER BY `time` LIMIT 1); - MYSQL ERROR: Unknown column 'rowid' in 'where clause' (1054)
 
Last edited:
I solved the problem with db and I only have this in console I use newest tfs 0.3.4 rev55
Code:
[21/06/2009 15:50:57] Lua Script Error: [CreatureScript Interface] 
[21/06/2009 15:50:57] data/creaturescripts/scripts/playerdeath.lua:onDeath

[21/06/2009 15:50:57] luaGetCreatureName(). Creature not found
 
I solved the problem with db and I only have this in console I use newest tfs 0.3.4 rev55
Code:
[21/06/2009 15:50:57] Lua Script Error: [CreatureScript Interface] 
[21/06/2009 15:50:57] data/creaturescripts/scripts/playerdeath.lua:onDeath

[21/06/2009 15:50:57] luaGetCreatureName(). Creature not found

something is wrong with the thing or it's position :S
 
I solved the problem with db and I only have this in console I use newest tfs 0.3.4 rev55
Code:
[21/06/2009 15:50:57] Lua Script Error: [CreatureScript Interface] 
[21/06/2009 15:50:57] data/creaturescripts/scripts/playerdeath.lua:onDeath

[21/06/2009 15:50:57] luaGetCreatureName(). Creature not found

This always happens in 0.3.4, it's a known problem.
Not a big bug, nothing happens.
 
data/lib/function.lua put at the end
Lua:
--function by colandus
function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return true
            end
        end
    end
    return FALSE
end
script.

Lua:
local treePos = {x = 32716, y = 32345, z = 7, stackpos=1}
local frompos = {x = 32705, y = 32343, y = 7}
local topos = {x = 32726, y = 32357, y = 7}

function onDeath(cid, pos)
        if isInArea(getPlayerPosition(cid), frompos, topos) then
                doRemoveItem(getThingFromPos(treePos).uid, 1)
                end
        return TRUE
end
 
i get this
Code:
[21/06/2009 16:37:39] Lua Script Error: [CreatureScript Interface] 
[21/06/2009 16:37:39] data/creaturescripts/scripts/playerdeath.lua:onDeath

[21/06/2009 16:37:39] luaGetCreatureName(). Creature not found
 
Back
Top