zexus
Member
- Joined
- Oct 1, 2016
- Messages
- 133
- Reaction score
- 18
Looking this system:
https://otland.net/threads/bounty-list-on-npc.246375/
I saw 3 things unnecessary saved on DB
Who Kill
Who kill id again
Date when have killed
So i delete it from MYSQL
Using:
Now what i need to change here in onkill event script to dont save this things and delete
It's just changes here?
https://otland.net/threads/bounty-list-on-npc.246375/
I saw 3 things unnecessary saved on DB
Who Kill
Who kill id again
Date when have killed
So i delete it from MYSQL
Using:
PHP:
ALTER TABLE `bounty_hunters` DROP `kill_time`;
ALTER TABLE `bounty_hunters` DROP `killed`;
ALTER TABLE `bounty_hunters` DROP `k_id`;
Now what i need to change here in onkill event script to dont save this things and delete
PHP:
function onKill(cid, target)
if isPlayer(target) == TRUE then
---- BOUNTY HUNTERS START -----
pid = cid
pid2 = getPlayerGUID(target)
local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..pid2.." AND `killed` = 0;")
if(result_plr:getID() ~= -1) then
prize = tonumber(result_plr:getDataInt("prize"))
bid = tonumber(result_plr:getDataInt("id"))
result_plr:free()
else
prize = 0
bid = 0
end
if (bid ~= 0 and prize ~= 0 and not(getTileInfo(getCreaturePosition(cid)).pvp)) then
db.executeQuery("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
doPlayerAddMoney(cid,prize/2)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[BOUNTY HUNTERS] You killed hunted player, so you gained the reward!')
end
---- BOUNTY HUNTERS END -----
end
return TRUE
end
It's just changes here?
PHP:
db.executeQuery("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")