• 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 Onkill get storage id xxx

Bassam421

Lockout RPG/PVP Owner
Joined
Nov 8, 2008
Messages
359
Reaction score
7
Location
Sweden , Göteborg
Hello guys i need a script with this in it
Lua:
db.executeQuery('UPDATE accounts SET honor_points=honor_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))

And i want the script to give the Pk'er honor points in the database, and he if he dies he will lose one. can some1 do it?


or something like this :
Lua:
function onKill(cid, target, lastHit)
	if cid ~= target and isPlayer(target) then
    local Info = db.getResult("SELECT `players` FROM `honor_points` WHERE `player_id` = " .. getPlayerGUID(cid) .. "-1")
        if Info:getID() ~= LUA_ERROR then
        local amount= Info:getDataInt("honor_points")
        Info:free()
        return amount
    end
     return LUA_ERROR
end
function setPlayerReborn(cid, value)
    db.executeQuery("UPDATE `players` SET `honor_points` = " .. value .. " WHERE `id` = " .. getPlayerGUID(cid) .. "+1")
end
 
Last edited:
Is there any reason you aren't using storages? Mass executing database queries can be really inefficient for something that can be done simple through storages.
 
Back
Top