<action itemid="XXXX" script="frag_remover.lua"/>
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
if table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
player:setSkull(SKULL_NONE)
player:setSkullTime(0)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!")
db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(player:getName()))
item:remove(1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or...
<action itemid="XXXX" script="frag_remover.lua"/>
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
if table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
player:setSkull(SKULL_NONE)
player:setSkullTime(0)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!")
db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(player:getName()))
item:remove(1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return true
end
Done edited main post, removed them I think it should work now.Might error with that db query because of the BBCode tags.
Is it possible to add a condition where the frag remover is only usable if the player is not PZ-locked?Try this one
actions.xml
actions/scriptsXML:<action itemid="XXXX" script="frag_remover.lua"/>
frag_remover.lua
LUA:function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey) if table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then player:setSkull(SKULL_NONE) player:setSkullTime(0) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!") db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(player:getName())) item:remove(1) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!") player:getPosition():sendMagicEffect(CONST_ME_POFF) end return true end
Is it possible to add a condition where the frag remover is only usable if the player is not PZ-locked?
if player:hasCondition(CONDITION_INFIGHT) then
-- has battle lock
else
-- doesn't
end