• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Need an action script that removes frags of the day and week but not the month!

rakan95

Hoster
Joined
Feb 1, 2013
Messages
25
Reaction score
0
Location
KSA
So I have a problem in my server in which when I ever I get a red skull......I use the frag remover and it eventually removes all the frags and set them to 0 :( Then when I check top fraggers I find myself having 0 frags ! and all my work is gone! So I thought of having a script that resets your day and week frags...........but keeps your month frags so that your score wont get affected!

If it is not possible! maybe you can just give me the script that resets days frags! only! no need to reset weekly ones :(

Can anyone help me? for item id : 7846 ?


REP+++

- - - Updated - - -

Bump
 
Try this
LUA:
local skulls = {
	SKULL_NONE,
	SKULL_YELLOW,
	SKULL_GREEN,
	SKULL_WHITE
}
local killIds = {}

function onUse(cid, item, frompos, item2, topos)
	local playerskull = getCreatureSkullType(cid)
	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` >= " .. (time - (7 * 86400)))
	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
	doRemoveItem(item.uid)
	return true
end
 
Last edited:
Back
Top