Jump to content

amosth

Inactive Member
  • Posts

    163
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by amosth

  1. Insert quest safebox

     

    6TIC6eXkTdS5q8ElEyD-kA.png

     

    my quest id 17 in locale_list

    quest armazem_portatil begin
    	state start begin
    		when button or info begin
    			local map = pc.get_map_index()
    			say("Deseja abrir o Armazém?")
    			local armazem = select("Sim","Fechar")
    			if armazem == 1 then
    			if map == 21 then
    			syschat("Você não pode abrir aqui.")
    			return
    			end
    			syschat("Abriu o armazém")
    			game.open_safebox()
    			setskin(NOWINDOW)
    			return
    			end
    		end -- w
    	end -- s
    end -- q
    	def ClickMallButton(self):
    		print "click_mall_button"
    		net.SendChatPacket("/click_mall") 

    to:

      

    def ClickMallButton(self):
            import event
            event.QuestButtonClick(17)

    No run =/

  2. Hello everyone,

    I'm having trouble using Switchbot, actually I think everyone is. I have tested all the files I found on the internet and all appear to have the same error.

    When I choose the bonus in the 1st option (6) it only works when the bonus appears in the 2nd option (7), when the selected bonus appears in the 1 option (6) it passes straight does not stay

     

    Mza5I1wPTmSHk4094IhrAA.png

  3. 29 minutes ago, Syreldar said:

    You still didn't learn to properly understand simple words yet you are still here asking for help.

    Ignorance should at least compensate with money those who compensate your ignorance with their knowledge.

    you are using my quest, if you want to delete the player kills use pc.delqf, since it works with QFs.

    Your mode worked..

     

    Total count ok
    kingdom count does not

     

    Edit: I got

     

    delete quest

    ./reload q ingame..

    reboot

    again :)

     

    Do not get me wrong, I just do not want to be a lazy man who tries only what they tell me.

    your quest is very good :)

     

    #closerequest

  4. 14 minutes ago, Tasho said:

    .

    • UPDATE = The UPDATE statement is used to modify the existing records in a table.
    • INSERT = The INSERT INTO statement is used to insert new records in a table.

     

    • You trying to update field id <which doesn't exist>
    • First one you need to do INSERT and after that UPDATE, there are many solutions for that, but i would like that one: INSERT ... ON DUPLICATE KEY UPDATE
    
    local quantidade = pc.getqf("total_players")
    mysql_direct_query(string.format("INSERT INTO player.kill_system (id, quantidade) VALUES(%d, %d) ON DUPLICATE KEY UPDATE quantidade = quantidade + %d;", pc.get_player_id(), quantidade, quantidade));

    If you specify an ON DUPLICATE KEY UPDATE clause and a row to be inserted would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row occurs.

    woool!!

    Very nice guy, perfect work :)

  5. 1 hour ago, Syreldar said:

    in what database is the kill_system table located?

    That's how you do it correctly:

    
    quest contador_kill begin
    	state start begin
    		function GetEmpireNames()
    			local data = {
    				[1] = "shinsoo",
    				[2] = "chunjo",
    				[3] = "jinno"
    			};
    			
    			return data;
    		end -- function
    		
    		when kill with npc.is_pc() begin
    			local qf_name = string.format("players_%s", contador_kill.GetEmpireNames()[npc.get_empire()]);
    
    			pc.setqf("total_players", pc.getqf("total_players")+1);
    			pc.setqf(qf_name, pc.getqf(qf_name)+1);
    			
    			-- Insert value in MySQL.
    			mysql_direct_query(string.format("UPDATE DATABASE.kill_system SET quantidade = %d WHERE id = %d;", pc.getqf("total_players"), pc.get_player_id()));
    		end -- when
    
    		when 11000.chat."Contador de Kills" or
    			11002.chat."Contador de Kills" or
    			11004.chat."Contador de Kills" begin
    
    			say_title("Contador de Kills:[ENTER]")
    			say_reward(string.format("You killed a total of %d players.[ENTER]", pc.getqf("total_players")))
    			say("Of which:[ENTER]")
    			for _, empire_name in ipairs(contador_kill.GetEmpireNames()) do
    				local qf_name = string.format("players_%s", empire_name);
    				say_reward(string.format("- %d from %s;", pc.getqf(qf_name), empire_name))
    			end -- for
    		end -- when
    	end -- state
    end -- quest

     

    you see the query includes the database and not just the table name?

    Substitute DATABASE. with the database where the table is located and you're done.

    no insert database count =/

    database player

    GoWA3JYOS2_lBKSu1tbRjg.png

     

    quest contador_kill begin
    	state start begin
    		when login begin
    			set_state(contador_kills)
    		end
    	end
    	state contador_kills begin
    		function GetEmpireNames()
    			local data = {
    				[1] = "shinsoo",
    				[2] = "chunjo",
    				[3] = "jinno"
    			};
    			
    			return data;
    		end -- function
    		
    		when kill with npc.is_pc() begin
    			local qf_name = string.format("players_%s", contador_kill.GetEmpireNames()[npc.get_empire()]);
    
    			pc.setqf("total_players", pc.getqf("total_players")+1);
    			pc.setqf(qf_name, pc.getqf(qf_name)+1);
    			
    			-- Insert value in MySQL.
    			mysql_direct_query(string.format("UPDATE player.kill_system SET quantidade = %d WHERE id = %d;", pc.getqf("total_players"), pc.get_player_id()));
    		end -- when
    
    		when 11000.chat."Contador de Kills" or 
    			11002.chat."Contador de Kills" or 
    			11004.chat."Contador de Kills" begin
    
    			say_title("Contador de Kills:[ENTER]")
    			say_reward(string.format("Você matou um total de %d players.[ENTER]", pc.getqf("total_players")))
    			say("Dos reinos:[ENTER]")
    			for _, empire_name in ipairs(contador_kill.GetEmpireNames()) do
    				local qf_name = string.format("players_%s", empire_name);
    				say_reward(string.format("- %d reino %s;", pc.getqf(qf_name), empire_name))
    			end -- for
    		end -- when
    	end
    end

     

  6. quest pextis begin
        state start begin
            when login or levelup begin
    			chat("teste")
    			chat("teste")
    			chat("teste")
    			notice_all("teste")
    			notice_all("teste")
            end -- when
        end -- state
    end -- quest

    0BZRCxoKRU_V5vBm7D_-YQ.png

     

    comand in putty

    Directory/Diretorio onde esta a quest

    cd /home/xx/game/share/locale/germany/quest

    and/depois

    ./qc namequest.lua

    ./qc namequest.quest

    login in game account GM/Logar com sua conta GM

    /reload q

    and

    /level xx or login logout

     

     

     

    • Love 1
  7. hi guys :)

     

    I'm trying to count the amount of kill in the database

     

    mysql_direct_query("INSERT INTO `kill_system` (`id`,  `quantidade`) VALUES ('"..pc.get_player_id().."', '"..total_players.."');")

    mysql_direct_query("UPDATE `kill_system` SET `quantidade`='"..total_players.."' WHERE id='"..pc.get_player_id().."';")

     

    Ps: ID = id player | quantidade = count kill

    No sucess =/ 

     

    My database

    GoWA3JYOS2_lBKSu1tbRjg.png

    My quest clean

    quest contador_kill begin
            state start begin
                    when login begin
                            set_state(contador_kills)
                    end
            end
            state contador_kills begin
                    when kill with npc.is_pc() begin
                            pc.setqf("total_players", pc.getqf("total_players") +1)
                            if npc.get_empire == 1 then
                                    pc.setqf("players_shinsoo", pc.getqf("players_shinsoo") +1)
                            elseif npc.get_empire == 2 then
                                    pc.setqf("players_chunjo", pc.getqf("players_chunjo") +1)
                            elseif npc.get_empire == 3 then
                                    pc.setqf("players_jinno", pc.getqf("players_jinno") +1)
                            end
                    end
                    when 11000.chat or 11002.chat or 11004.chat."Contador de Kills" with button or info begin
                    say_title("Contador de Kills:")
                    say("")
                    say("Aqui podes ver todas as")
                    say("tuas mortes feitas desde que começaste a jogar.")
                    say("Podes ver quantos Jogadores e")
                    say("Quantos Moobs ja mataste.")
    				say("")
                    say_reward("Escolhe uma opcao!")
    				say("")
                            local a = select ("Quantos Players Matei", "Sair")
                            if a == 2 then
                                    return
                            elseif a == 1 then
                                    say_title("Contador de Kills:")
                                    say("Queres ver Por Reinos, ou o Total?")
    								say("")
                                            local b = select ("Por Reinos", "Total", "Sair")
                                            if b == 3 then
                                                    return
                                            elseif b == 2 then
                                                    say_title("Contador de Kills:")
    												say("")
                                                    say_reward("No total, mataste "..pc.getqf("total_players").." Players.")
                                                    say("")
                                            elseif b == 1 then
                                                    say_title("Contador de Kills:")
                                                    say("De que Reino?")
    												say("")
                                                    local c = select ("Shinsoo", "Chunjo", "Jinno", "Sair")
                                                    if c == 4 then
                                                            return
                                                    elseif c == 1 then
                                                            say_title("Contador de Kills:")
    														say("")
                                                            say_reward("Mataste "..pc.getqf("players_shinsoo").." Players do Reino de Shinsoo.")
                                                            say("")
                                                    elseif c == 2 then
                                                            say_title("Contador de Kills:")
    														say("")
                                                            say_reward("Mataste "..pc.getqf("players_chunjo").." Players do Reino de Chunjo.")
                                                            say("")
                                                    elseif c == 3 then
                                                            say_title("Contador de Kills:")
    														say("")
                                                            say_reward("Mataste "..pc.getqf("players_jinno").." Players do Reino de Jinno.")
                                                            say("")
                                                    end
                                            end
                            end
                    end
            end
    end

     

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