• 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!

Fixing a little QUERY - Paying 3 USD.

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Hi, I have this query:

Code:
UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")

This query free all your injustified, but I want to remove a specefied frag, the frag of the player that you killed....

It should add a AND `death_id` = something...

PS: Im using

LUA:
function onKill(cid, target, lastHit)

Maybe you can use getPlayerGUID(target) to search the death_id at player_deaths...
 
LUA:
function getKill(myID, targetID)
    local res = db.getResult("SELECT k.id AS this FROM `killers` AS k INNER JOIN `player_deaths` AS pd ON k.death_id = pd.id INNER JOIN `player_killers` AS pk ON k.id = pk.kill_id WHERE pd.player_id = " .. targetID .. " AND pk.player_id = " .. myID .. " ORDER BY k.id DESC LIMIT 1;")
    if (res:getID() ~= -1) then
        local ret = (res:getDataInt("this"))
        res:free()
        return ret
    end
    return -1
end
 
LUA:
local player = change here
local k = db.getResult("SELECT `id` FROM `killers` WHERE `death_id` = "..getPlayerGUID(player)..";"):getDataInt('id')
UPDATE `killers` SET `unjustified` = 0 WHERE `id` = "..k.."
 
LUA:
local player = change here
local k = db.getResult("SELECT `id` FROM `killers` WHERE `death_id` = "..getPlayerGUID(player)..";"):getDataInt('id')
UPDATE `killers` SET `unjustified` = 0 WHERE `id` = "..k.."

lol, i think he wants Jano's query, so it will remove the last frag u got, not just a specific player.
 
Back
Top