Jump to content

ATAG

Active Member
  • Posts

    236
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by ATAG

  1. Try this one, maybe you get some information:

    function mysql_query(text)
        local tmp=number(11111111,99999999)
        os.execute('mysql -u root -pPASSWORD -N -e '..string.format("%q",text)..' 2>&1 > /tmp/'..tmp)
        local res,i={},1
        local f,e=io.open("/tmp/"..tmp)
        if f then
            local line=f:read("*l")
            while line do
                res[i]={}
                string.gsub(line,"([^t]+)t*", function(s)
                    table.insert(res[i],s)
                end)
                i=i+1
                line=f:read("*l")
            end
            f:close()
            os.execute("rm /tmp/"..tmp)
        else
            res[1] = {(e or "WTF??")}
        end
        return res
    end

    or remove the os.execute("rm /tmp/"..tmp) and check the random number named file in /tmp

  2. You don't have drop_gamble_with_flag function. Add this to questlib.lua:

    function get_today_count(questname, flag_name)
        local today = math.floor(get_global_time() / 86400)
        local today_flag = flag_name.."_today"
        local today_count_flag = flag_name.."_today_count"
        local last_day = pc.getf(questname, today_flag)
        if last_day == today then
            return pc.getf(questname, today_count_flag)
        else
            return 0
        end
    end
    -- "$flag_name"_today unix_timestamp % 86400
    -- "$flag_name"_count count
    function inc_today_count(questname, flag_name, count)
        local today = math.floor(get_global_time() / 86400)
        local today_flag = flag_name.."_today"
        local today_count_flag = flag_name.."_today_count"
        local last_day = pc.getqf(questname, today_flag)
        if last_day == today then
            pc.setf(questname, today_count_flag, pc.getf(questname, today_count_flag) + 1)
        else
            pc.setf(questname, today_flag, today)
            pc.setf(questname, today_count_flag, 1)
        end
    end
    
    -- This function will return true always in window os,
    --  but not in freebsd.
    -- (In window os, RAND_MAX = 0x7FFF = 32767.)
    function drop_gamble_with_flag(drop_flag)
            local dp, range = pc.get_killee_drop_pct()
            dp = 40000 * dp / game.get_event_flag(drop_flag)
            if dp < 0 or range < 0 then
                return false
            end
            return dp >= number(1, range)
    end
    • Love 3
  3.  

    os.execute ([command])

    This function is equivalent to the ANSI C function system. It passes command to be executed by an operating system shell. Its first result is true if the command terminated successfully, or nil otherwise. After this first result the function returns a string and a number, as follows:

        "exit": the command terminated normally; the following number is the exit status of the command.

        "signal": the command was terminated by a signal; the following number is the signal that terminated the command.

    When called without a command, os.execute returns a boolean that is true if a shell is available.

    You have to use a mysql_query function...

     

    eg:

    function mysql_query(text)
    	local tmp=number(11111111,99999999)
    	os.execute('mysql -u root -pPASSWORD -N -e '..string.format("%q",text)..' 2>&1 > /tmp/'..tmp)
    	local res,i={},1
    	local f,e=io.open("/tmp/"..tmp)
    	if f then
    		local line=f:read("*l")
    		while line do
    			res[i]={}
    			string.gsub(line,"([^t]+)t*", function(s)
    				table.insert(res[i],s)
    			end)
    			i=i+1
    			line=f:read("*l")
    		end
    		f:close()
    		os.execute("rm /tmp/"..tmp)
    	end
    	--[[if table.getn(res)==1 and table.getn(res[1])==1 then --only 1 variable returns
    		res=res[1][1]
    	end]]
    	return res
    end

    And how-to use in quest:

    --by ATAG
    quest sqltest begin
    	state start begin
    		when 20016.chat."test list" begin
    			local tbl=mysql_query("SELECT id, account_id, name from player.player LIMIT 10;")
    			say("userlist: "..table.getn(tbl))
    			for i,v in ipairs(tbl) do
    				say(v[1].." "..v[2].." "..v[3])
    			end
    			say("")
    		end
    	end
    end
  4. Hi!

     

    I don't know if it is a perfect solution, but it works fine for me.

     

    Open game/char_item.cpp and find this:

    if (false == CanUnequipNow(item2) || false == CanEquipNow(item1))

    Replace to this:

    		//if (false == CanUnequipNow(item2) || false == CanEquipNow(item1))
    		if (false == CanEquipNow(item1))
    			return false;
    		if (item2->IsDragonSoul() && false == CanUnequipNow(item2))
    			return false;

    Then compile and run...

    • Love 21
  5.  

    Not sure to undestand my english is bad.. want remove all hair from player? if yes, try from db with sql like 

    update player.player set part_hair = '0' where part_hair >= '1'

    if the question is another sry  :wacko:

     

    That`s the problem ... i set manualy and by query and the old part_hair apears again and again and again when i use bersek or mount & horse..

     

     

    Do you modify the database when the server is off? What db/game versin do you use?

     

×
×
  • 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.