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

Skull/frags remover

zapo

Member
Joined
Nov 10, 2020
Messages
129
Solutions
3
Reaction score
11
Skrypt usuwa skulla, ale fragi pozostają, mianowicie gdy zabije jedną osobę od razu red skull

Po użyciu nie usuwają się fragi.
Adnotacja 2021-01-03 183343.png
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.executeQuery("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
 
Jesteś pewien, że pozostają też server-side?
Jeśli używasz OTC to możliwe, że w module który jest odpowiedzialny za pokazywanie fragów po prostu się nie odświeżają w momencie gdy używasz frag removera.
 
Jesteś pewien, że pozostają też server-side?
Jeśli używasz OTC to możliwe, że w module który jest odpowiedzialny za pokazywanie fragów po prostu się nie odświeżają w momencie gdy używasz frag removera.
Zauważyłem, że fragi usuwają się ale po około 10h... czyli faktycznie odświeżanie musi być źle ustawione. Wiesz może jak to zmienić?
 
execute the queries after removing the players or they wont be executed, also you will need to wait a little after the player logout so use AddEvent, something like this:
 
Tak jak kolega wyżej pisze gracz musi zostać usunięty a dopiero potem wykonujesz zapytania do bazy, dodatkowo brakuje ci zapytania do usuwania fragów.
Jak wygląda to zapytanie?
Post automatically merged:

execute the queries after removing the players or they wont be executed, also you will need to wait a little after the player logout so use AddEvent, something like this:
This code remove player but dont remove frags and skull
Lua:
local skull = Action()
 
 function skull.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:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!")
    player:remove()
    addEvent(db.query, 1, "UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " ..  db.escapeString(player:getName()))
    player:setSkull(SKULL_NONE)
    player:setSkullTime(0)
    item:remove(9969)
    player:save()
else
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
    return true
end

skull:id(9969)
skull:register()
 
Last edited:
something like this:
Lua:
local skull = Action()

function skull.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 table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!")
        player:setSkull(SKULL_NONE)
        player:setSkullTime(0)
        item:remove(1)
        local name = player:getName()
        player:remove()
        addEvent(db.query, 2, "UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " ..  db.escapeString(name))
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end

skull:id(9969)
skull:register()
 
Last edited by a moderator:
something like this:
Lua:
local skull = Action()

function skull.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 table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!")
        player:setSkull(SKULL_NONE)
        player:setSkullTime(0)
        item:remove(1)
        local name = player:getName()
        player:remove()
        addEvent(db.query, 2, "UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " ..  db.escapeString(name))
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end

skull:id(9969)
skull:register()

Why are you doing it with addEvent? As far as I know TFS is not async = )

so just after player:remove() is finished it should call db.query
 
Still not working, skull removes but frags remain. Sometimes when I close client and relog it doesn't show frags, but when I kill I get rs
i database unjustifield change to 0...
 
something like this:
Lua:
local skull = Action()

function skull.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 table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull has been removed!")
        player:setSkull(SKULL_NONE)
        player:setSkullTime(0)
        item:remove(1)
        local name = player:getName()
        player:remove()
        addEvent(db.query, 2, "UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " ..  db.escapeString(name))
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end

skull:id(9969)
skull:register()
this work to me. thanks <3

FLP
 
Back
Top