Premium Necro 80 Posted November 15, 2014 Premium Share Posted November 15, 2014 Hi, i try modified quest for Shop with the new currency but When i click on item in NPC shop it dont work and item cant buy. Sysser and syslog write me this: Nov 15 20:27:46 :: QUEST ScriptButton pid 4 idx 0 SYSERR: Nov 15 20:27:50 :: RunState: LUA_ERROR: [string "achievement_rivalia"]:2: attempt to concatenate local `coins' (a table value) WITH ERRORCODE 1 SYSERR: Nov 15 20:27:50 :: RunState: LUA_STATE: index 0 ref 3 SYSERR: Nov 15 20:27:50 :: WriteRunningStateToSyserr: LUA_ERROR: quest achievement_rivalia.start click Quest look like: quest achievement_rivalia begin state start begin ---------------------------------------------------------------------------------------------------- -- SKLEP -- ---------------------------------------------------------------------------------------------------- when 20095.chat."Sklep" begin cmdchat("SetIsNpc") npc.open_shop(16) setskin(NOWINDOW) cmdchat("SetPrice 200|200|200|200|200|0|0|100|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0") end when login begin loop_timer("casovac", 10) end when casovac.timer begin local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;") cmdchat("setPP "..coins) cmdchat("SetQuestIndex "..q.getcurrentquestindex()) end when button or info begin local items = { [0]={71124, 1, 200}, [1]={71125, 1, 200}, [2]={71126, 1, 200}, [3]={71127, 1, 200}, [4]={71128, 1, 200}, } local slot = tonumber(achievement_rivalia.GetInput("GetInput")) local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;") if coins >= items[slot][3] then local nastavit_mince = mysql_query("UPDATE account.account SET coins ='"..(coins.coins[1]-items[slot][3]).."' WHERE name ='"..pc.get_account_id().."' LIMIT 1") cmdchat("setPP "..coins) pc.give_item2(items[slot][1], items[slot][2]) else cmdchat("NieMamPP") end end function GetInput(value) cmdchat("GetInputStart") local ret = input(cmdchat(value)) cmdchat("GetInputStop") return ret end end end Any idea how to fix it? Thanks Link to comment Share on other sites More sharing options...
Denis 1477 Posted November 15, 2014 Share Posted November 15, 2014 cmdchat("setPP "..coins.coins[1]) Link to comment Share on other sites More sharing options...
Premium Necro 80 Posted November 15, 2014 Author Premium Share Posted November 15, 2014 Thanks for that, next is here: SYSERR: Nov 15 21:30:08 :: RunState: LUA_ERROR: [string "achievement_rivalia"]:10: attempt to compare number with table WITH ERRORCODE 1 SYSERR: Nov 15 21:30:08 :: RunState: LUA_STATE: index 0 ref 3 SYSERR: Nov 15 21:30:08 :: WriteRunningStateToSyserr: LUA_ERROR: quest achievement_rivalia.start click Link to comment Share on other sites More sharing options...
Denis 1477 Posted November 15, 2014 Share Posted November 15, 2014 if tonumber(coins.coins[1]) >= items[slot][3] then Instead of if coins >= items[slot][3] then Link to comment Share on other sites More sharing options...
Premium Necro 80 Posted November 15, 2014 Author Premium Share Posted November 15, 2014 Wow now its work fine You are the best, just the last question how to modified this: local nastavit_mince = mysql_query("UPDATE account.account SET coins ='"..(coins.coins[1]-items[slot][3]).."' WHERE name ='"..pc.get_account_id().."' LIMIT 1") Because system isnt subtract coins so i have still same count of coins..? /Solved - WHERE name -> WHERE id Link to comment Share on other sites More sharing options...
Denis 1477 Posted November 15, 2014 Share Posted November 15, 2014 Try that quest achievement_rivalia begin state start begin ---------------------------------------------------------------------------------------------------- -- SKLEP -- ---------------------------------------------------------------------------------------------------- when 20095.chat."Sklep" begin cmdchat("SetIsNpc") npc.open_shop(16) setskin(NOWINDOW) cmdchat("SetPrice 200|200|200|200|200|0|0|100|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0") end when login begin loop_timer("casovac", 10) end when casovac.timer begin local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;") cmdchat("setPP "..coins.coins[1]) cmdchat("SetQuestIndex "..q.getcurrentquestindex()) end when button or info begin local items = { [0]={71124, 1, 200}, [1]={71125, 1, 200}, [2]={71126, 1, 200}, [3]={71127, 1, 200}, [4]={71128, 1, 200}, } local slot = tonumber(achievement_rivalia.GetInput("GetInput")) local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;") if tonumber(coins.coins[1]) >= items[slot][3] then local nastavit_mince = mysql_query("UPDATE account.account SET coins = coins - "..items[slot][3].." WHERE name ='"..pc.get_account_id().."' LIMIT 1") cmdchat("setPP "..coins.coins[1]) pc.give_item2(items[slot][1], items[slot][2]) else cmdchat("NieMamPP") end end function GetInput(value) cmdchat("GetInputStart") local ret = input(cmdchat(value)) cmdchat("GetInputStop") return ret end end end 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