kubasiek221 0 Posted December 27, 2014 Share Posted December 27, 2014 Hey! My quest does not work. Query UPDATE does not update the record mysql with cash. Why ? State coins shows correctly. How fix the problem ? Please, help me. http://wklej.to/FVkvp quest test begin state start begin when 9001.click begin say_title(" xx ") local cost = 100 local id1 = query("SELECT cash FROM account.account WHERE id ='"..pc.get_account_id().."';") say(" Current state your coins: "..id1.." ") wait() query("UPDATE account.account SET cash=cash-"..cost.." WHERE id='"..id1.."';") say(" Click continue ") wait() say("Your money: "..id1) end end end Link to comment Share on other sites More sharing options...
Premium Shogun 4592 Posted December 27, 2014 Premium Share Posted December 27, 2014 id is a number not a string, remove the '' Are you sure it's not updating? You are not updating the id1 variable so it will show the same number both times. 1 Link to comment Share on other sites More sharing options...
kubasiek221 0 Posted December 27, 2014 Author Share Posted December 27, 2014 Hay, I fix the problem, but i have new problem. Quest not checkingmy condition ( if id1 >= 100 then ). When click "Continue" nothing happens. Why ? quest test begin state start begin when 9001.click begin say_title(" xx ") local cena = 100 local id1 = query("SELECT cash FROM account.account WHERE id ='"..pc.get_account_id().."';") say(" State your money : "..id1.." ") wait() if id1 >= 100 then -- this if does not work query("UPDATE account.account SET cash=cash-"..cena.." WHERE id='"..pc.get_account_id().."';") local current = id1-100 say("Current state your money:: "..current.." ") else local new = 100-id1 say(" Your money is so small, you need: "..new.." SM! ") end end end end Link to comment Share on other sites More sharing options...
Denis 1474 Posted December 27, 2014 Share Posted December 27, 2014 Try this: quest test begin state start begin when 9001.click begin say_title(" xx ") local cena = 100 local id1 = query("SELECT cash FROM account.account WHERE id ='"..pc.get_account_id().."';") say(" State your money : "..id1.cash[1].." ") wait() if tonumber(id1.cash[1]) >= 100 then -- this if does not work query("UPDATE account.account SET cash=cash-"..cena.." WHERE id='"..pc.get_account_id().."';") local aktualne = tonumber(id1.cash[1])-100 say("Current state your money:: "..aktualne.." ") else local new = 100-tonumber(id1.cash[1]) say(" Your money is so small, you need: "..new.." SM! ") end end end end 2 Link to comment Share on other sites More sharing options...
Solution kubasiek221 0 Posted December 27, 2014 Author Solution Share Posted December 27, 2014 This is effect: http://scr.hu/1wsp/a2vra After click nothing happens Edit I fix the problem. Correct condition: if tonumber(id1) >= 100 then Regards! 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