I seen a lot of posts about this looking for frag remover that doesn't remove all frags, here you can choose the amount to remove but never removing more than a months worth
I posted a partial script for week in someones post and they did not reply, so I tested myself and works, Enjoy
Now can make it not remove frags only skull
Please note that if a player uses this and it is set to not remove any frags then, the player will get their skull back as soon as they frag again
I posted a partial script for week in someones post and they did not reply, so I tested myself and works, Enjoy
Lua:
local skulls = {
SKULL_NONE,
SKULL_YELLOW,
SKULL_GREEN,
SKULL_WHITE
}
local killIds = {}
local choice = ""
local timeremove = "none" -- Choices = day, week, month, none -- If none then the script will not remove frags only skull
function onUse(cid, item, frompos, item2, topos)
local times = {today = (time - 86400), week = (time - (7 * 86400)), month = (time - (30*86400))}
if timeremove == 'day' then
choice = times.today
elseif timeremove == 'week' then
choice = times.week
elseif timeremove == 'month' then
choice = times.month
end
local playerskull = getCreatureSkullType(cid)
if timeremove == "none" then
if isInArray(skulls, playerskull) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This can only be used on red skull")
return 0
else
doCreatureSetSkullType(cid, skulls[1])
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) - 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your skull has been removed!")
end
else
local result = db.getResult("SELECT `pk`.`kill_id` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. choice)
if(result:getID() ~= -1) then
repeat
table.insert(killIds, result:getDataInt("kill_id"))
until not result:next()
result:free()
end
if isInArray(skulls, playerskull) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This can only be used on red skull")
return 0
else
doCreatureSetSkullType(cid, skulls[1])
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) - 1)
for i=1, #killIds do
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN ("..killIds[i]..")")
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your frags have been removed!")
end
end
doRemoveItem(item.uid)
return true
end
Now can make it not remove frags only skull
Please note that if a player uses this and it is set to not remove any frags then, the player will get their skull back as soon as they frag again
Last edited: