Query UPDATE does not update the record with cash

12/27/2014 15:26 ModdingMT2#1
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.



Code:
	
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


Edit

Hay, I fix the problem, but i have new problem.

Quest not checkingmy condition ( if id1 >= 100 then ). When click "Continue" nothing happens.

Why ?
Code:
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
12/28/2014 12:30 Zevion#2
#moved