Sziasztok!
Egy olyan questre lenne szükségem, ami egy adott item mennyiséget sére vált be, szóval nem a tipikus beváltó quest, hanem mondjuk tegyük fel van 33db pontod, azt beváltod egy npcnél és 33sére írja jóvá a számládon.
Ha 34db pontod van azt 34sárkányérmére írja jóvá.
Fontos lenne az, hogy nem sé jegyre, hanem egyből az accountján írja jóvá neki.
Tud valaki ilyen questet?:)
quest
quest bevaltas begin
state start begin
when 9003.chat."beváltás sére" begin
local adnivalose = pc.count_item("50513")
say("szeretnél beváltani "..adnivalose.." tárgyat ugyanennyi séért?")
local q = select("Igen", "Nem")
if q == 1 then
if pc.count_item("50513") > 0 then
pc.remove_item(50513,adnivalose)
pc.change_coins(adnivalose)
else
syschat(""..mob_name(9003)..": Nincs elegendő tárgy ")
end
end
if q == 2 then
return
end
end
end
end
ezt questlibbe
function split(str, delim, maxNb)
if str == nil then return str end
if string.find(str, delim) == nil then return { str } end
if maxNb == nil or maxNb < 1 then maxNb = 0 end
local result = {}
local pat = "(.-)" .. delim .. "()"
local nb = 0
local lastPos
for part, pos in string.gfind(str, pat) do
nb = nb + 1
result[nb] = part
lastPos = pos
if nb == maxNb then break end
end
if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end
return result
end
mysql_query = function(query)
if not pre then
local rt = io.open('CONFIG','r'):read('*all')
pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')
end
math.randomseed(os.time())
local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}
-- os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- fur MySQL51
os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- fur MySQL55
for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi);
for i = 2, table.getn(t) do table.foreach(t[i],function(a,b)
out[i-1] = out[i-1] or {}
out[i-1][a] = tonumber(b) or b or 'NULL'
out[t[1][a]] = out[t[1][a]] or {}
out[t[1][a]][i-1] = tonumber(b) or b or 'NULL'
end) end
return out
end
function pc.change_coins(x)
mysql_query("UPDATE account.account SET coins=coins+'"..x.."' WHERE id='"..pc.get_account_id().."' LIMIT 1")
end