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

Lua Can use with pz and without

Hbraveq

Active Member
Joined
Nov 11, 2012
Messages
167
Reaction score
39
Hello guys, I have simple script and I want to edit it, to protect it from using with pz. (Make it usable only ouf of fight)

function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)

if table.contains({SKULL_NONE, SKULL_WHITE, SKULL_RED}, player:getSkull()) then
player:setSkull(SKULL_NONE)
player:setSkullTime(0)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(player:getName()))
item:remove(1)
end

return true
end
 
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local tile = Tile(player:getPosition())
    if not tile then
        return false
    end
    if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendCancelMessage("You must be in a protection zone to use this item.")
        return true
    end

    if table.contains({SKULL_NONE, SKULL_WHITE, SKULL_RED}, player:getSkull()) then
        player:setSkull(SKULL_NONE)
        player:setSkullTime(0)
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
        db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(player:getName()))
        item:remove(1)
    end
    
    return true
end
 
Back
Top