Jump to content

Quest problem pc.change_name function


Recommended Posts

I have a problem with a quest when i use "["this symbol in pc.change_name function doesn't work like doesnt read and when i use "(" return :

				elseif (ret == 2) then
					say("Invalid name, please only use letters and numbers.[ENTER]")

What i need to to to make this quest put tag [VIP] in front of my name. Here is line:            local new_name = "[VIP]"..pc.get_name();

When i change "[VIP]" With simple "VIP" work but i want "[" this symbol and doesn't work.

quest vip begin
	state start begin
		when 40003.use begin
			local item_vnum = item.get_vnum();

			say_title(string.format("%s:[ENTER]", item_name(item_vnum)))
			if (string.find(pc.get_name(), "[VIP]") ~= nil) then
				return say("You already have a VIP name.[ENTER]");
			end -- if

			local new_name = "[VIP]"..pc.get_name();
			say("By continuing, you will be able to change")
			say("your character's name into a VIP name.[ENTER]")
			say_reward(string.format("Your new name will be: %s.[ENTER]", new_name))

			say("Are you sure you want to continue?[ENTER]")
			if (select("Yes, I'm sure", "No, I'm not") == 1) then
				say_title(string.format("%s:[ENTER]", item_name(item_vnum)))
				local ret = pc.change_name(new_name);
				if (ret == 0) then
					say("An error occurred. (ret == 0).[ENTER]")
				elseif (ret == 1) then
					say("An error occurred. (ret == 1).[ENTER]")
				elseif (ret == 2) then
					say("Invalid name, please only use letters and numbers.[ENTER]")
				elseif (ret == 3) then
					say("That name is already being used")
					say("by another player.[ENTER]")
				elseif (ret == 4) then
					pc.remove_item(item_vnum, 1);
					say("The name has been successfully changed,")
					say("re-log to see the changes.[ENTER]")
				else
					say("The change_name function is blocked for")
					say("this locale.[ENTER]")
				end -- if/elseif/else
			end -- if
		end -- when
	end -- state
end -- quest

 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Premium

If pc.change_name() doesn't work (normal thing,since you're using parenthesis), use a query:

quest vip begin
	state start begin
		when 40003.use begin
			local name = pc.get_name();
			local item_vnum = item.get_vnum();

			say_title(string.format("%s:[ENTER]", item_name(item_vnum)))
			if (string.find(pc.get_name(), "[") ~= nil or pc.is_gm()) then
				say("You already have a VIP name")
				say("or you are a staff member.[ENTER]")
			end -- if

			local new_name = string.format("[VIP]%s", name);
			say("By continuing, you will be able to change")
			say("your character's name into a VIP name.[ENTER]")
			say_reward(string.format("Your new name will be: %s.[ENTER]", new_name))

			say("Are you sure you want to continue?[ENTER]")
			if (select("Yes, I'm sure", "No, I'm not") == 1) then
				mysql_query(string.format("UPDATE player.player SET name = '%s' WHERE name = '%s';", new_name, name));
				pc.remove_item(item_vnum, 1);

				say_title(string.format("%s:[ENTER]", item_name(item_vnum)))
				say("The name has been successfully changed,")
				say("You will see the changes soon.[ENTER]")
			end -- if
		end -- when
	end -- state
end -- quest

 

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

I tried with this quest

quest vip begin
    state start begin
        when 40003.use begin
            if pc.count_item(40003)>=1 then
                say_title("Inel [VIP]")
                say("Vrei sa ai VIP in fata numelui")
                local a = select("Da!", "Nu")
                if a == 1 then
                    local name = pc.get_name()
                    local find_id = mysql_query("SELECT account_id from player.player WHERE name='"..name.."' LIMIT 1;")
                    local id = find_id[1][1]+1-1
                    mysql_query("UPDATE player.player SET name='[VIP]"..name.."' WHERE account_id='"..id.."' LIMIT 1;")
                    pc.remove_item(40003)
                    syschat("Votre demande à été envoyé au serveur. Votre")
                    syschat("changera dès que le serveur aura retourné l'information!")
                else
                    return
                end
            else
                say_title("Inel [VIP]")
                say("Aveti Nevoie de")
                say("Inelul VIP pentru a activa numele:")
                say_item_vnum(40003)
                say("Intoarcete cand ai.")
                return
            end
        end
    end
end

But doesn't work when i use ingame item i have this problem :  mysql: ambiguous option '--e=SELECT account_id from player.player WHERE name='Kaden' LIMIT 1;' (enable_cleartext_plugin, execute) si acest warning Mysql warning "password on the command line . Mentioning i use server with source 40k. Sorry for my bad english.

 

Link to comment
Share on other sites

  • Premium
9 hours ago, bloody said:

I tried with this quest


quest vip begin
    state start begin
        when 40003.use begin
            if pc.count_item(40003)>=1 then
                say_title("Inel [VIP]")
                say("Vrei sa ai VIP in fata numelui")
                local a = select("Da!", "Nu")
                if a == 1 then
                    local name = pc.get_name()
                    local find_id = mysql_query("SELECT account_id from player.player WHERE name='"..name.."' LIMIT 1;")
                    local id = find_id[1][1]+1-1
                    mysql_query("UPDATE player.player SET name='[VIP]"..name.."' WHERE account_id='"..id.."' LIMIT 1;")
                    pc.remove_item(40003)
                    syschat("Votre demande à été envoyé au serveur. Votre")
                    syschat("changera dès que le serveur aura retourné l'information!")
                else
                    return
                end
            else
                say_title("Inel [VIP]")
                say("Aveti Nevoie de")
                say("Inelul VIP pentru a activa numele:")
                say_item_vnum(40003)
                say("Intoarcete cand ai.")
                return
            end
        end
    end
end

But doesn't work when i use ingame item i have this problem :  mysql: ambiguous option '--e=SELECT account_id from player.player WHERE name='Kaden' LIMIT 1;' (enable_cleartext_plugin, execute) si acest warning Mysql warning "password on the command line . Mentioning i use server with source 40k. Sorry for my bad english.

 

Use my quest then?

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

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.