• 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 unjustified points (skulls)

darkmu

Well-Known Member
Joined
Aug 26, 2007
Messages
274
Solutions
1
Reaction score
50
Location
Paraná,Brazil
I am currently using the skull remover, but I found that it also removed all the frags from the player. But what is happening and that whenever he uses the item after he kills the next player he goes back to get skull again (red skull), is there any way I can reset his entire frag?

TFS 1.3

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

    
        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)
    

    return true
end

I have already done a good search and have not found a solution to this problem.

1610123256009.png
 
Hey, try with it:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getSkull() == SKULL_RED then
        db.query("UPDATE `players` SET `skull` = 0, `skulltime` = 0 WHERE `id` = " .. player:getGuid() .. "")
        player:setSkull(SKULL_NONE)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Your frags and skull have been removed.")
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        player:setSkullTime(0)
        item:remove()
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have a red skull.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end

    return true
end
 
Hey, try with it:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getSkull() == SKULL_RED then
        db.query("UPDATE `players` SET `skull` = 0, `skulltime` = 0 WHERE `id` = " .. player:getGuid() .. "")
        player:setSkull(SKULL_NONE)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Your frags and skull have been removed.")
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        player:setSkullTime(0)
        item:remove()
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have a red skull.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end

    return true
end
same thing, took out my red skull but on the next player I kill I get red skull again.
 
use addEvent and kick the player and then execute the query, otherwise the queries will not be executed
didn't know that, like this?:
untested
Code:
local function executeDbQuery(name)
    db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(name))
    return true
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getSkull() == SKULL_RED then
        local name = player:getName()
        player:setSkull(SKULL_NONE)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Your frags and skull have been removed.")
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        player:setSkullTime(0)
        item:remove()
        player:remove()
        addEvent(executeDbQuery, 10, name)
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have a red skull.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end

    return true
end
 
This works fine for me

Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local tile = Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
        if not tile then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be in protection zone to use this item.")
    return true
end
if isInArray({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.quer("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
    --db.query("UPDATE `players` SET `skulltime` = 0 WHERE `id` = " .. player:getGuid())
    item:remove(1)
    player:remove()
else
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end
 
This works fine for me

Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local tile = Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE)
        if not tile then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must be in protection zone to use this item.")
    return true
end
if isInArray({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.quer("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
    --db.query("UPDATE `players` SET `skulltime` = 0 WHERE `id` = " .. player:getGuid())
    item:remove(1)
    player:remove()
else
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end

I don't have any table named killers
 
Back
Top