Jump to content

Quest with MySQL select function


Recommended Posts

  • Management

Hello,

I would like to open my test server just to some selected persons, but they need a key that they receive when registered...

I did a quest like this:

quest testsv begin
	state start begin
		when login with is_test_server() and pc.getqf("testsv") == 0 begin
			local query = "SELECT key_testsv FROM account.account_teste WHERE login = '"..pc.get_account().."' LIMIT 1"
			say("Insere a senha:")
			local key = tonumber(input())
			if tostring(key) == tostring(query) then
				pc.setqf("testsv", 1)
			else
				say("Senha incorreta...")
			end	
		end
	end
end

But doesn't work, someone could give me a hand?

Thanks,

King Regards

raw

raw

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Management

Try this:

 

local query = mysql_query("SELECT key_testsv FROM account.account WHERE login = '"..pc.get_account().."' LIMIT 1")[1][1]

 

Not working :S

 

local query = mysql_query("SELECT key_testsv FROM account.account WHERE id = '"..pc.get_account_id().."' LIMIT 1")

 

Not working too...

syserr of the first option:

SYSERR: Jul 12 22:40:32 :: RunState: LUA_ERROR: [string "testsv"]:1: attempt to index field `?' (a nil value)
SYSERR: Jul 12 22:40:32 :: WriteRunningStateToSyserr: LUA_ERROR: quest testsv.start click
syserr of the second option:
SYSERR: Jul 12 22:54:49 :: operator(): QUEST NOT END RUNNING on Login/Logout - testsv
SYSERR: Jul 12 22:54:51 :: Input: no quest running for pc, cannot process input : 57711

 

raw

raw

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.