Jump to content

Duplicated name Quest VIP


Go to solution Solved by Syreldar,

Recommended Posts

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

Image error: https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

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

  • Premium
  • Solution
quest vip begin
	state start begin
		function IsAlreadyVIPName(name)
			return string.find(name, "[VIP]") ~= nil;
		end -- function

		when 40003.use begin
			say_title("Inel [VIP]:[ENTER]")
			say("Vrei sa ai VIP in fata numelui?[ENTER]")
			if (select("Da!", "Nu") == 1) then
				local id = pc.get_player_id();
				local name = mysql_query(string.format("SELECT name FROM player.player WHERE id = %d;", id))[1][1];
  
				say_title("Inel [VIP]:[ENTER]")
				if (vip.IsAlreadyVIPName(name)) then
					return say_reward("You are already VIP, you can't change your name.[ENTER]");
				end -- if

				pc.remove_item(item.get_vnum(), 1);
				mysql_query(string.format("UPDATE player.player SET name = '[VIP]%s' WHERE id = %d;", name, id));
				say("Votre demande à été envoyé au serveur. Votre")
				say("changera dès que le serveur aura retourné l'information!")
			end -- if
		end -- when
	end -- state
end -- quest

 

  • Love 1

 

"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

  • Premium
14 minutes ago, amosth said:

It did not work, it's saying that you already have the VIP, but you do not have

=/

		function IsAlreadyVIPName(name)
			return string.find(name, "[VIP]") ~= nil;
		end -- function

http://lua-users.org/wiki/StringLibraryTutorial

Works perfectly.

  • Love 1

 

"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.