warriorfrog
Active Member
- Joined
- Jul 29, 2015
- Messages
- 334
- Reaction score
- 35
I'm using this system:
https://otland.net/threads/bounty-hunters-system-player-hunt-system.27721/
But i've used this commands:
So my bounty_hunters DB is:
This system is too good, but i needed to make a script to clean the olds ones and send money back to bank for who made the hunted
So i made this script looking in others scripts here on forum, but i just don't know how to do, i made it searching a lot and editing scripts
bountyhuntercleaner.lua
It's good?
It's not work (delete/send money back) and printing it on console when start:
Someone could help me to finish/fix it?
https://otland.net/threads/bounty-hunters-system-player-hunt-system.27721/
But i've used this commands:
PHP:
ALTER TABLE `bounty_hunters` DROP `kill_time`;
ALTER TABLE `bounty_hunters` DROP `killed`;
ALTER TABLE `bounty_hunters` DROP `k_id`;
PHP:
ALTER TABLE `bounty_hunters` CHANGE `added` `date` INT(15) NOT NULL;
So my bounty_hunters DB is:
PHP:
1 id [Primary] int(11)
2 fp_id int(11)
3 sp_id int(11)
4 date int(15)
5 prize bigint(20)
This system is too good, but i needed to make a script to clean the olds ones and send money back to bank for who made the hunted
So i made this script looking in others scripts here on forum, but i just don't know how to do, i made it searching a lot and editing scripts
Code:
<globalevent name="bountyhuntercleaner" type="startup" event="script" value="bountyhuntercleaner.lua"/>
bountyhuntercleaner.lua
Code:
function onStartup()
local result = db.getResult("SELECT `id`, `fp_id`, `sp_id`, `date`, `prize` FROM `bounty_hunters` ORDER by `date` ASC;")
local days = 1*3600*1
--local days = 30*3600*24
local nowtime = os.date('*t')
if(result:getID() ~= -1) then
while(true) do
local id = result:getDataInt("id")
local date = result:getDataInt("date")
local player = result:getDataInt("fp_id")
local prize = result:getDataInt("prize")
local time = os.time(nowtime) - date
local duedate = time - days
if duedate >= 0 then
-- send money back
local tid = getPlayerByGUID(result:getDataInt("player"))
if(isPlayer(tid)) then
doPlayerSetBalance(tid, getPlayerBalance(tid) + prize)
else
db.executeQuery("UPDATE `players` SET `balance` = `balance` + " .. prize .. " WHERE `id` = " .. result:getDataInt("player") .. ";")
end
-- delete
db.executeQuery("DELETE FROM `auction_system` WHERE `id` = '".. id .."';")
end
if not(result:next()) then
break
end
end
result:free()
end
end
It's good?
It's not work (delete/send money back) and printing it on console when start:
Code:
[16:47:06.806] Error during getDataInt(player).
[16:47:06.806] Error during getDataInt(player).
[16:47:07.342] Error during getDataInt(player).
[16:47:07.342] Error during getDataInt(player).
[16:47:07.392] Error during getDataInt(player).
[16:47:07.392] Error during getDataInt(player).
Someone could help me to finish/fix it?
Last edited: