Jump to content

ERROR mysql_query Event Points


Recommended Posts

Use game core 40k and files with vrunner

Need urgent help, please someone help me!

questlib.lua

-- MySQL
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? MySQL51
	os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- f? 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,b)
        out[i-1]               = out[i-1] or {}
        out[i-1][a]            = tonumber(b) or b or 'NULL'
        out[t[1][a]]           = out[t[1][a]] or {}
        out[t[1][a]][i-1]      = tonumber(b) or b or 'NULL'
    end) end
    return out
end

quest

quest test begin
    state start begin
        when 20095.chat."Event Points" begin
        say("event points go? ")
        local s = select("Yes", "No")
            if s == 1 then
                local value = 1
                mysql_query('UPDATE player.player SET points = points+'..value..' WHERE id = '..pc.get_player_id()..' LIMIT 1')
                chat("+1 point!")
            elseif s == 2 then
                return
            end --if
        end -- w
    end -- s
end -- q

 

Link to comment
Share on other sites

  • 2 years later...

Here has the following functions in C ++

 

mysql.query

mysql.direct_query

mysql.update

mysql.real_escape_string

mysql.get_table_postfix

 

go to game / src

 

open queslua.cpp

 

under

RegisterDragonSoulFunctionTable();

add

RegisterMysqlFunctionTable();

open queslua.h

 

under

extern void RegisterDragonSoulFunctionTable();

add

extern void RegisterMysqlFunctionTable();

add in the makefile 

questlua_mysql.cpp

Download the file

 

This is the hidden content, please

 

VirusTotal

 

This is the hidden content, please

  • Love 2
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.