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

Solved Is it possible to whipe out all items on the character with an db.executequery?

Imfreezing

Krossa Kapitalismen
Joined
Jun 7, 2012
Messages
1,009
Solutions
1
Reaction score
88
Location
Edron
Hello Im working on a little project, and I was woundering if it is possible to whipe a characters items out

a little example

Code:
local pos = {x = 652, y = 974, z = 7}
local playerId = 5
local reward = 8891--Itemid of the item which will the paladin gain
local reward1 = 7730--Itemid of the item which will the paladin gain
local reward2 = 2195--Itemid of the item which will the paladin gain
local reward3 = 7368--Itemid of the item which will the paladin gain
local reward4 = 2497--Itemid of the item which will the paladin gain
local reward5 = 2514--Itemid of the item which will the paladin gain
local reward6 = 1988--Itemid of the item which will the paladin gain



    function doUpdatePlayer(health, mana, level, playerId)
        db.executeQuery("UPDATE `players` SET `level` = "..level..", `health` = "..health..", `healthmax` = "..health..", `mana` = "..mana..", `manamax` = "..mana.." WHERE `id` ="..playerId..";")
    end

function onStepIn(cid, item, position, fromPosition)
            doTeleportThing(cid, pos)


>>db.executeQuery("DELETE FROM  `player_items` WHERE `id` ="..playerId..";")<< Help with this please!


            playerId = getPlayerAccountId(cid)
             doPlayerAddItem(cid,reward6)
             doPlayerAddItem(cid,reward)
             doPlayerAddItem(cid,reward1)
             doPlayerAddItem(cid,reward2)
             doPlayerAddItem(cid,reward3)
             doPlayerAddItem(cid,reward4)
             doPlayerAddItem(cid,reward5)

            doPlayerSetVocation(cid, 3)
            doRemoveCreature(cid, true)
            doUpdatePlayer(3605, 5220, 350, playerId)
        end
I was woundering if there is any db query for it? :p thanks alot! also I might need to use
Code:
            doRemoveCreature(cid, true)
Thanks Imfreezing
 
It is possible with a query but it won't do a thing if player is online, what do you want to do?
I want it to whipe out all of the items on a character then immedietly add another set of items

Code:
function onStepIn(cid, item, position, fromPosition)
            doTeleportThing(cid, pos)
            playerId = getPlayerAccountId(cid)
-- delete items
db.executeQuery("DELETE FROM `player_items`;")
-- Adds new items
             doPlayerAddItem(cid,reward6)
             doPlayerAddItem(cid,reward)
             doPlayerAddItem(cid,reward1)
             doPlayerAddItem(cid,reward2)
             doPlayerAddItem(cid,reward3)
             doPlayerAddItem(cid,reward4)
             doPlayerAddItem(cid,reward5)
            doPlayerSetVocation(cid, 1)
            doRemoveCreature(cid, true)
            doUpdatePlayer(1895, 10350, 350, playerId)  
        end
as you see it is logged out
Code:
            doRemoveCreature(cid, true)

Well, by adding
Code:
db.executeQuery("DELETE FROM player_items;")
behind
Code:
            doRemoveCreature(cid, true)
Makes it delete all items on the character, athough then I don't recieve the new items since it's placed before in the function, and I can't add the items whilst offline.
 
Last edited by a moderator:
Code:
for slot = CONST_SLOT_FIRST, CONST_SLOT_LAST do
   local item = getPlayerSlotItem(cid, slot)
   if (item.uid > 0) then
     doRemoveItem(item.uid)
   end
end
 
Back
Top