Jump to content

Recommended Posts

Good afternoon guys, I have this quest for achievement points, where you exchange points for a certain item, but it's not working. Can someone help me

 

quest point_change begin
    state start begin
        when 20082.chat."Exchange Points" with pc.getqf("exchange_access") == 1 begin
            -- Simulating that there is a mysql_query function that queries the database.
            local result_achievement = mysql_query("SELECT ranking_of_boss FROM player WHERE id = "..pc.get_player_id())
            local points_achievement = result_achievement[1] -- Assuming that the result is a table where the first element is the desired value.
            local result_kills = mysql_query("SELECT ranking_kills FROM player WHERE id = "..pc.get_player_id())
            local points_kills = result_kills[1]

            say("Welcome to the points exchange system!")
            say("You can exchange your achievement points and kills for valuable items here.")
            local s = select("Exchange achievement points", "Exchange kill points", "Cancel")
            
            if s == 1 then
                say("You have " .. conquest_points .. " conquest points.")
                say("Every 10 points can be exchanged for 1 Big Red Potion.")
                if achievement_points >= 10 then
                    local choice = select("Exchange 10 points for 1 Potion", "Cancel")
                    if choice == 1 then
                        -- Assuming the item can be added directly to the player's inventory.
                        pc.give_item2("ITEM_ID_POT_GREEN", 1)
                        -- Updating the database directly
                        mysql_query("UPDATE player SET ranking_of_boss = ranking_of_boss - 10 WHERE id = "..pc.get_player_id())
                        say("Exchange successful!")
                    end else
                else
                    say("You don't have enough points.")
                end else
            elseif s == 2 then
                say("You have " .. points_kills .. " kill points.")
                say("Every 15 points can be exchanged for 1 War Armor.")
                if points_kills >= 15 then
                    local choice = select("Exchange 15 points for 1 Armor", "Cancel")
                    if choice == 1 then
                        pc.give_item2("ITEM_ID_ARMADURA_GUERRA", 1)
                        mysql_query("UPDATE player SET ranking_of_kills = ranking_of_kills - 15 WHERE id = "..pc.get_player_id())
                        say("Exchange successful!")
                    end else
                else
                    say("You don't have enough points.")
                end
            end
        end
    end
end

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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.