Mila 3 Posted October 28, 2014 Share Posted October 28, 2014 I use its quest, quest coins begin state start begin when 80017.use or 80014.use or 80015.use or 80016.use begin local mysql_user = "user"; local mysql_pass = "passs"; local rr = { [80017] = {"Cupon de Coins (50)", 50}, [80014] = {"Cupon de Coins (100)", 100}, [80015] = {"Cupon de Coins (200)", 200}, [80016] = {"Cupon de Coins (500)", 500} } syschat(""..pc.get_name().." has usado "..rr[item.get_vnum()][1].." con exito.") item.remove() os.execute("mysql -u '"..mysql_user.."' --password='"..mysql_pass.."' --execute='UPDATE account.account SET coins = coins + "..rr[item.get_vnum()][2].." WHERE id = "..pc.get_account_id()..";'") end end end But in syser its error. SYSERR: Oct 28 22:46:11 :: RunState: LUA_ERROR: [string "coins"]:11: attempt to index field `?' (a nil value) SYSERR: Oct 28 22:46:11 :: WriteRunningStateToSyserr: LUA_ERROR: quest coins.start click Plz help. Link to comment Share on other sites More sharing options...
Rumor 2606 Posted October 29, 2014 Share Posted October 29, 2014 Quest: quest givecoins begin state start begin when 80014.use or 80015.use or 80016.use begin local count = pc.count_item(item.get_vnum()) local value = ({ [80014] = 10, [80015] = 25, [80016] = 50, })[item.get_vnum()] say_title('Coin Scroll') say('') say('This coin scroll is worth: '..value..' NM.') say('Nirvana Marks can be used in the itemshop!') say('Would you like to add the NM to your acccount?') say('You can only use this item once.') say('') if select('Yes','No') == 2 then return end if count ~= pc.count_item(item.get_vnum()) then -- BUGUSER! say('') say_reward('Bug use attempted. Coin reward has been cancelled.') say('') return end mysql_query('UPDATE account.account SET nm = nm+'..value..' WHERE id = '..pc.get_account_id()..' LIMIT 1') mysql_query('INSERT INTO log.coinscroll_log (account_id, marks, time) VALUES (".. pc.get_account_id() ..", ".. value ..", NOW())') pc.remove_item(item.get_vnum()) syschat('Your account has successfully been rewarded with NM.') -- If item is not stackable use: -- item.remove() end end end Add to questlib.lua: 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) -- für MySQL51 os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für 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, out[i-1] = out[i-1] or {} out[i-1][a] = tonumber( or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber( or b or 'NULL' end) end return out end Make edits to the quest to put it in your language and include whichever item IDs you need. Also update the part that says "marks" to whatever your coins are and update "nm" and "nm+" to whatever your coins are. Set the amount of coins in the value array. Link to comment Share on other sites More sharing options...
Mila 3 Posted October 29, 2014 Author Share Posted October 29, 2014 thx rumor but mysql_query not found with vrunner Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now