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

Item Depot

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
I wanted a script that when you talk /add name of player, ID
and this item would go to the dp player
:ninja:
 
Code:
function doPlayerAddDepotItem(cid, item, count)
	local item, count, pid = type(item)=="table" and item or {item}, type(count)=="table" and count or {(count or 1)}, getPlayerGUID(cid)
	doRemoveCreature(cid)
	for k,v in ipairs(item) do
		local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = " .. pid .. " ORDER BY `sid` DESC LIMIT 1")
		return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES (" .. pid .. ", " .. (ls:getDataInt("sid")+1) .. ", 101, " .. v .. ", " .. count[k] .. ", '" ..(count[k] > 1 and string.format("%x",count[k]) or '') .. "')") or false
	end
end
 
function:
LUA:
function doPlayerAddDepotItem(cid, item, count)
    local item,count,pid = type(item)=="table" and item or {item},type(count)=="table" and count or {(count or 1)},getPlayerGUID(cid)
    doRemoveCreature(cid)
    for k,v in ipairs(item) do
        local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = "..pid.." ORDER BY `sid` DESC LIMIT 1")
        return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES ("..pid..", "..(ls:getDataInt("sid")+1)..", 101, "..v..", "..count[k]..", '"..(count[k] > 1 and string.format("%x",count[k]) or '').."')") or false
    end
end
and scripter?
talkaction?;x
 
Code:
local function doPlayerAddDepotItem(cid, item, count)
    local item,count,pid = type(item)=="table" and item or {item},type(count)=="table" and count or {(count or 1)},getPlayerGUID(cid)
    doRemoveCreature(cid)
    for k,v in ipairs(item) do
        local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = "..pid.." ORDER BY `sid` DESC LIMIT 1")
        return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES ("..pid..", "..(ls:getDataInt("sid")+1)..", 101, "..v..", "..count[k]..", '"..(count[k] > 1 and string.format("%x",count[k]) or '').."')") or false
    end
end
function onSay(cid, words, param, channel)
	local t = string.explode(param, ",")
	if t[1] and t[2] then
		doPlayerAddDepotItem(cid, t[1], t[2])
	end
	return true
end
 
Back
Top