Jump to content
External pictures are being replaced... ×
×
×
  • Create New...
  • 0

Query problem in quest


avertuss

Question

Hi. I have

when kill with npc.is_pc() and pc.get_map_index() == 41 begin
			local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
			local namet = pc.get_name()
			local levt = pc.get_level()
			local vid = npc.get_vid()
			local old_pc = pc.select(vid)
			if old_pc != 0 then
				local lev = pc.get_level()
				local name = pc.get_name()
				query("UPDATE player.player_arena SET deaths = deaths+1 where name = '"..name.."';")
				pc.select(old_pc)
				if lev == levt then
					pkt = 2
					query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
					local points1 = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
					chat("2 points")
					chat("You have: "..points1.." points.")
					query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
				elseif lev > levt then
					pkt = 3
					query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
					local points1 = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
					chat("3 points")
					chat("You have: "..points1.." points.")
					query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
				elseif lev < levt and lev >= levt-5 then
					pkt = 1
					query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
					local points1 = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
					chat("1 point")
					chat("You have: "..points1.." points.")
					query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
				else
					chat("0 points")
				end
			end
		end

My player_arena table looks like 

4eb6feb5a5b834cbc7ffa3b1c5ab12b8.png

I don't know why but query doesn't work, i have still empty table. In syserr i have 

attempt to concatenate local `points1' (a nil value)

 

Link to comment
Share on other sites

  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

6 answers to this question

Recommended Posts

  • 0
  • Moon

Do you try it like that?
 

Spoiler

when kill with npc.is_pc() and pc.get_map_index() == 41 begin
            local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
            local namet = pc.get_name()
            local levt = pc.get_level()
            local vid = npc.get_vid()
            local old_pc = pc.select(vid)
            if old_pc != 0 then
                local lev = pc.get_level()
                local name = pc.get_name()
                query("UPDATE player.player_arena SET deaths = deaths+1 where name = '"..name.."';")
                pc.select(old_pc)
                if lev == levt then
                    pkt = 2
                    query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
                    local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
                    chat("2 points")
                    chat("You have: "..points.." points.")
                    query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
                elseif lev > levt then
                    pkt = 3
                    query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
                    local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
                    chat("3 points")
                    chat("You have: "..points.." points.")
                    query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
                elseif lev < levt and lev >= levt-5 then
                    pkt = 1
                    query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
                    local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
                    chat("1 point")
                    chat("You have: "..points.." points.")
                    query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
                else
                    chat("0 points")
                end
            end
        end

 

Link to comment
Share on other sites

  • 0
2 godziny temu, enzi napisał:

Do you try it like that?
 

  Odkryj ukrytą treść

when kill with npc.is_pc() and pc.get_map_index() == 41 begin
            local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
            local namet = pc.get_name()
            local levt = pc.get_level()
            local vid = npc.get_vid()
            local old_pc = pc.select(vid)
            if old_pc != 0 then
                local lev = pc.get_level()
                local name = pc.get_name()
                query("UPDATE player.player_arena SET deaths = deaths+1 where name = '"..name.."';")
                pc.select(old_pc)
                if lev == levt then
                    pkt = 2
                    query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
                    local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
                    chat("2 points")
                    chat("You have: "..points.." points.")
                    query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
                elseif lev > levt then
                    pkt = 3
                    query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
                    local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
                    chat("3 points")
                    chat("You have: "..points.." points.")
                    query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
                elseif lev < levt and lev >= levt-5 then
                    pkt = 1
                    query("UPDATE player.player_arena SET points = points+"..pkt.." WHERE name = '"..namet.."';")
                    local points = query("SELECT points from player.player_arena WHERE name = '"..pc.get_name().."';")
                    chat("1 point")
                    chat("You have: "..points.." points.")
                    query("UPDATE player.player_arena SET kills = kills+1 WHERE name = '"..namet.."';")
                else
                    chat("0 points")
                end
            end
        end

 

Still the same. I think that it doesn't work because i don't have query to add nickname to name column but i'm not sure. 

Link to comment
Share on other sites

  • 0
17 minut temu, Root napisał:

check this topic and try stuff from there :) 

  Ukryj treść

 

 

I'm not sure. That quest in original version works on player.player table. I want move these points to player_arena but as you see it doesn't work. Imo i need one more argument in query or something to add nickname to new table. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


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.