• 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 TFS 1.2 Looking for frag remover

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
Hi i have day/week/month frag system so im pretty sure all those codes in otland wont work. So this is my config

-- Skull System
banLength = 30 * 24 * 60 * 60
whiteSkullTime = 15 * 60
redSkullTime = 30 * 24 * 60 * 60
killsDayRedSkull = 25
killsWeekRedSkull = 50
killsMonthRedSkull = 100
killsDayBanishment = 50
killsWeekBanishment = 100
killsMonthBanishment = 200

And i need just a frag remover that removes all kills absolutely every single kill from day/week/month and it should allow to use every time even when you are not on PK. And removes Red Skull and White Skull if you have one, since i dont have black skull only Red and White
 
Solution
I had adjusted this code a bit for you and tried it. Now it removes all skulls and frags ... can use it also without skull --- JUST CHANGE MSG for what u want


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

if table.contains({SKULL_NONE, SKULL_WHITE, SKULL_BLACK, 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
Try this
it work fine on my server

<action itemid="X" script="frag_remover.lua"/>

script:

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
 
Try this
it work fine on my server

<action itemid="X" script="frag_remover.lua"/>

script:

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
But it says player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only remove red or black skulls!")
so it means it wont allow you to use it if you are not on skull or on white skull, you have to be on red or black skull to use it
 
I had adjusted this code a bit for you and tried it. Now it removes all skulls and frags ... can use it also without skull --- JUST CHANGE MSG for what u want


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

if table.contains({SKULL_NONE, SKULL_WHITE, SKULL_BLACK, 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
 
Last edited:
Solution
I had adjusted this code a bit for you and tried it. Now it removes all skulls and frags ... can use it also without skull --- JUST CHANGE MSG for what u want


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

if table.contains({SKULL_NONE, SKULL_WHITE, SKULL_BLACK, 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
 
Try to delate this whole line player:setSkullTime(0)

By me it works with this line and without it
So i think what this player:setSkullTime does is when you have a skull it sets time to 0 so it makes your current frag disappear so i dont know if its smart to remove it tho
 
Back
Top