Jump to content

Quest - Change Name Improved


Rumor

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

This problem didn't exist in the 2089 core but once I started using 34083 my players kept getting really long names like "ooooooooommmmmmmmmmmgggg" and "KissOfDeathAndSweetNight".

Thanks to Shogun, HaveBeen™ and PACIFICADOR for quest edit and MySQL query.

Go to the player database and player table and run this query:

SELECT name FROM player WHERE CHAR_LENGTH(name) > 12;

This will show you all the names that are longer than the maximum that can be typed into a PM window.

 

Go and edit all their names to something, I set all the names to "ShortName1", "ShortName2", "ShortName3" and so on. I dumped a list of names and player IDs so that players can be given a free name change scroll, and the log of player IDs will  ensure that nobody renames to these names to receive a free one. If you have several players with long names it may be better to just credit all their accounts with what's necessary for the name change item.

 

Here's the updated quest to prevent users from selecting long names (tested and works):

quest change_name_item begin
    state start begin
        function isLongName(name)
            return string.len(name) < 13
        end
        when 71055.use begin
            say_title("Change of Name List")
            if pc.is_married() then
                say("")
                say("You can't change names when you're married.")
                say("")
                return
            elseif pc.is_polymorphed() then
                say("")
                say("You can't change names when you're transformed.")
                say("")
                return
            elseif pc.has_guild() then
                say("")
                say("You can't change names when you're in a guild.")
                say("")
                return
            elseif party.is_party() then
                say("")
                say("You can't change names when you're in a party.")
                say("")
                return
            elseif pc.get_level() < 80 then
                say("")
                say("You can't change names before level 80.")
                say("")
                return
            elseif get_time() < pc.getqf("next_time") then
                say("")
                say("You've recently changed your name.")
                say("You can't change your name right now.")
                say("")
                return
            end
            say("Please enter the name you want.")
            local name = pc.name
            local str = input()
            if(change_name_item.isLongName(tostring(str)) == false) then
                say_title("Change of Name List")
                say("")
                say("The entered name is too long.")
                say("Please select another name.")
				say("")
				char_log(0, "CHANGE_NAME", "NAME TOO LONG")
                return
            end
            local ret = pc.change_name(str)
            say_title("Change of Name List")
            if ret == 0 then
            say("")
                say("You have not relogged since the last time you")
                say("changed your name. Please relog now.")
                say("")
                char_log(0, "CHANGE_NAME", "HAVE NOT RE-LOGIN")
            elseif ret == 1 then
                say("")
                say("There was a problem. Please try again.")
                say("")
                char_log(0, "CHANGE_NAME", "ITEM USE PROBLEM")
            elseif ret == 2 then
                say("")
                say("This name is not avaliable.")
                say("Please select another name.")
                say("")
                char_log(0, "CHANGE_NAME", "CAN NOT USE NAME")
            elseif ret == 3 then
                say("")
                say("This name is not avaliable.")
                say("Please select another name.")
                say("")
                char_log(0, "CHANGE_NAME", "ALREADY USING NAME")
            elseif ret == 4 then
                say("")
                say("Successful name change!")
                say("You cannot change your name again for")
                say("another 24 hours.")
                say("")
                pc.remove_item("71055", 1)
                pc.setqf("next_time", get_time() + time_hour_to_sec(24*1))
                horse.set_name(""..str"'s Horse")
                char_log(0, "CHANGE_NAME", "SUCCESS: from "..name.." to "..str)
                wait()
                pc.warp(pc.get_x()*100, pc.get_y()*100)
            else
                say("")
                say("Unknown error.")
                say("Please notify Rumor with this number:")
                say(ret)
                say("and he will take a look at the issue.")
                say("")
                char_log(0, "CHANGE_NAME", "UNKNOWN NAME")
            end
        end
    end
end
  • Metin2 Dev 4
  • Good 1
  • Love 5
Link to comment
Share on other sites

Well the erro is one

 

say("")

                say("Unknown error.")
                say("Please notify Rumor with this number:")
                say(ret)

                say("and he will take a look at the issue."

 

 

Somthing like: Unknown error. Please notify Rumor with this number: 5 ... like that!

Link to comment
Share on other sites

Well the erro is one

 

say("")

                say("Unknown error.")
                say("Please notify Rumor with this number:")
                say(ret)

                say("and he will take a look at the issue."

 

 

Somthing like: Unknown error. Please notify Rumor with this number: 5 ... like that!

 

well, no.. there's nothing wrong with that.. it's returning whatever it can return because it's a miscellaneous error. The guy is saying he has a problem but not explaining what the problem is ^^. It does for sure work the way it's shown in this thread.

Link to comment
Share on other sites

what do you mean you "have this error too" ? Nobody else has "this error" or any error as far as I know.. atleast nobody has said they have some error related to that part of the quest, or anywhere at all in the quest. You and the other guy are really hard to understand because you don't really make sense with your replies. I tested this and it works fine, and 6 people have changed their names since I've added this updated version of the quest to my server.

Link to comment
Share on other sites

  • Premium

here is mine...

quest chagne_name begin
	state start begin
		when 71055.use begin
			if pc.is_married() then
				say("You cannot change your name if you are married.")
				say("")
				return
			end

			if pc.is_polymorphed() then
				say("You cannot change your name if you are transformed.")
				say("")
				return
			end

			if pc.has_guild() then
				say("You cannot change your name if you are in a guild. ")
				say("")
				return
			end

			if party.is_party() then
				say("You cannot change your name if you are in a party.")
				say("")
				return
			end

			if pc.get_level() < 35 then
				say("You need level 35 to change your name!")
				say("")
				return
			end

			if get_time() < pc.getqf("next_time") then
				say("You can not use it now.")
				say("")

				if is_test_server() == true then
					say("Since it's test server, you can go")
					say("")
				else
					return
				end
			end

			say("Please enter the name you want to have") ;

			local name = pc.name ;
			local str = input() ;
			if string.len(str) > 16 then
				say("This name is too long. Please try again.")
				say("")
				return
				
			end
			local ret = pc.change_name(str) ;

			if ret == 0 then
				say("You didn't log in after you have changed your name.")
				say("please re-log in.")
				say("")

				char_log(0, "CHANGE_NAME", "HAVE NOT RE-LOGIN")
			elseif ret == 1 then
				say("The problem occured while using the item.")
				say("Please use again.")
				say("")
				
				char_log(0, "CHANGE_NAME", "ITEM USE PROBLEM")
			elseif ret == 2 then
				say("The name is not available.")
				say("Please enter other name.")
				say("")

				char_log(0, "CHANGE_NAME", "CAN NOT USE NAME")
			elseif ret == 3 then
				say("The name is not available.")
				say("Please enter other name.")
				say("")

				char_log(0, "CHANGE_NAME", "ALREADY USING NAME")
			elseif ret == 4 then
				say("You have changed your name successfully.")
				say("Please log in again.")
				say("")

				item.remove() ;

				pc.setqf("next_time", get_time() + time_hour_to_sec(24*15))

				char_log(0, "CHANGE_NAME", "SUCCESS: from "..name.." to "..str)
			else
				say("Unknown error occured.")
				say("")

				char_log(0, "CHANGE_NAME", "UNKNOWN NAME")
			end
		end
	end
end
  • Good 1
  • Love 1
Link to comment
Share on other sites

Rumor one my server your quest not work, I talking with PACIFICADOR I ask him if he know something about the erro ( : 5 )

and he tell me that you'r use diff for the function, that you use in this quest..

 

 

Thanks

Shogun

 

I go test it.

 

 

well no work..

 

KgcPe.png

 

and in-game..

 

CgM7f.png

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

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.