Jump to content

Aveline™

Inactive Member
  • Posts

    190
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    0%

Posts posted by Aveline™

  1. so I would add the function and local then add the rest with an elseif statement somewhere after line 47 right?

    quest change_name_item begin
        state start begin
    		function isLongName(name)
    			return string.len(name) < 16
    		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("Error 1")
    				say("")
    				---
    				say("I'm sorry but your name very long")
    				say("and you don't do this. ")
    				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 available.")
                    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 available.")
                    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

    Like this?

  2. SYSERR: Feb 20 16:37:45 :: DoRefineWithScroll: REFINE : Unknown refine scroll item. Value0: 1

    This stuation associated with item_proto file. Your object value not exist in item_proto. Check item_proto ;)

    SYSERR: Feb 20 01:57:28 :: Start: TABLE_POSTFIX not configured use default

    It's not an error. Don't worry every server-files write this in syserr

     

     

  3. Again you remember. MySQL Function doesn't write with lua. That's write with c++ and your function with my function result same just different codes. And pc.setqf,pc.setf,pc.getqf,pc.setf use to mysql function so result samesame.

     

    your function is successful but everyone choose easy way.

     

     

    Best regards.

  4. Hello to everyone. I'm share my multi-language system with you. I hope you're like it.

     

    Step 1.

     

    - Open questlua_pc.cpp and add these.

    	int pc_get_lang(lua_State* L)
    	{
    		char szQuery[QUERY_MAX_LEN];
    		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
    		snprintf(szQuery,sizeof(szQuery),"select lang from player%s where id = '%u'",get_table_postfix(),ch->GetPlayerID());
    		SQLMsg * pMsg = DBManager::instance().DirectQuery(szQuery);
    		MYSQL_ROW row;
    		for(int i = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++i)
    		{
    			lua_pushstring(L,row[0]);
    		}
    		return 1;
    	}
    
    	int pc_set_lang(lua_State* L)
    	{
    		char szQuery[QUERY_MAX_LEN];
    		if(!lua_isstring(L,1))
    		{
    			return 0;
    		}
    		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
    		snprintf(szQuery,sizeof(szQuery),"update player%s set lang = '%s' where id = '%u'",get_table_postfix(),lua_tostring(L,1),ch->GetPlayerID());
    		std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
    		if(pmsg->Get()->uiInsertID == 0)
    		{
    			return 0;
    		}
    		return 1;
    	}
    

    - After add these.

    			{ "get_lang", pc_get_lang},
    			{ "set_lang", pc_set_lang},

    Step 2.

     

    - Player.sql

    CREATE TABLE `NewTable` (
    `id`  int(11) NOT NULL AUTO_INCREMENT ,
    `account_id`  int(11) NOT NULL DEFAULT 0 ,
    `name`  varchar(24) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'NONAME' ,
    `job`  tinyint(2) UNSIGNED NOT NULL DEFAULT 0 ,
    `voice`  tinyint(1) UNSIGNED NOT NULL DEFAULT 0 ,
    `dir`  tinyint(2) NOT NULL DEFAULT 0 ,
    `x`  int(11) NOT NULL DEFAULT 0 ,
    `y`  int(11) NOT NULL DEFAULT 0 ,
    `z`  int(11) NOT NULL DEFAULT 0 ,
    `map_index`  int(11) NOT NULL DEFAULT 0 ,
    `exit_x`  int(11) NOT NULL DEFAULT 0 ,
    `exit_y`  int(11) NOT NULL DEFAULT 0 ,
    `exit_map_index`  int(11) NOT NULL DEFAULT 0 ,
    `hp`  smallint(4) NOT NULL DEFAULT 0 ,
    `mp`  smallint(4) NOT NULL DEFAULT 0 ,
    `stamina`  smallint(6) NOT NULL DEFAULT 0 ,
    `random_hp`  smallint(5) UNSIGNED NOT NULL DEFAULT 0 ,
    `random_sp`  smallint(5) UNSIGNED NOT NULL DEFAULT 0 ,
    `playtime`  int(11) NOT NULL DEFAULT 0 ,
    `level`  tinyint(2) UNSIGNED NOT NULL DEFAULT 1 ,
    `level_step`  tinyint(1) NOT NULL DEFAULT 0 ,
    `st`  smallint(3) NOT NULL DEFAULT 0 ,
    `ht`  smallint(3) NOT NULL DEFAULT 0 ,
    `dx`  smallint(3) NOT NULL DEFAULT 0 ,
    `iq`  smallint(3) NOT NULL DEFAULT 0 ,
    `exp`  int(11) NOT NULL DEFAULT 0 ,
    `gold`  int(11) NOT NULL DEFAULT 0 ,
    `stat_point`  smallint(3) NOT NULL DEFAULT 0 ,
    `skill_point`  smallint(3) NOT NULL DEFAULT 0 ,
    `quickslot`  tinyblob NULL ,
    `ip`  varchar(15) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT '0.0.0.0' ,
    `part_main`  int(7) NOT NULL DEFAULT 0 ,
    `part_base`  tinyint(4) NOT NULL DEFAULT 0 ,
    `part_hair`  smallint(4) NOT NULL DEFAULT 0 ,
    `skill_group`  tinyint(4) NOT NULL DEFAULT 0 ,
    `skill_level`  blob NULL ,
    `alignment`  int(11) NOT NULL DEFAULT 0 ,
    `last_play`  datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ,
    `change_name`  tinyint(1) NOT NULL DEFAULT 0 ,
    `mobile`  varchar(24) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
    `sub_skill_point`  smallint(3) NOT NULL DEFAULT 0 ,
    `stat_reset_count`  tinyint(4) NOT NULL DEFAULT 0 ,
    `horse_hp`  smallint(4) NOT NULL DEFAULT 0 ,
    `horse_stamina`  smallint(4) NOT NULL DEFAULT 0 ,
    `horse_level`  tinyint(2) UNSIGNED NOT NULL DEFAULT 0 ,
    `horse_hp_droptime`  int(10) UNSIGNED NOT NULL DEFAULT 0 ,
    `horse_riding`  tinyint(1) NOT NULL DEFAULT 0 ,
    `horse_skill_point`  smallint(3) NOT NULL DEFAULT 0 ,
    `lang`  varchar(5) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,
    PRIMARY KEY (`id`),
    INDEX `account_id_idx` USING BTREE (`account_id`),
    INDEX `name_idx` USING BTREE (`name`)
    )
    ENGINE=MyISAM
    DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
    AUTO_INCREMENT=321434631
    CHECKSUM=0
    ROW_FORMAT=DYNAMIC
    DELAY_KEY_WRITE=0
    ;

    Step 3.

     

    - How to use to this system in my game? 

     

    I'll share example with you.

    quest mLanguage begin
    	state start begin
    		function load_setting()
    			local data = {
    				["extension"] = {"tr","en"},
    				["en"] = {
    					["letter"] = "Change Language"
    					["language"] = {"Turkish","English","Close"},
    					["dialog"] = {"Please select a language... ", "No longer your language is %s. "},
    				},
    				["tr"] = {
    					["letter"] = "Dilini Değiştir",
    					["language"] = {"Türkçe","Ingilizce","Kapat"},
    					["dialog"] = {"Lütfen bir dil seçiniz.. ","Artık diliniz %s oldu. "},
    				},
    			}
    			return data
    		end		
    		when letter begin
    			if(pc.get_lang() == 0) then
    				send_letter("Select language")
    			else
    				send_letter(mLanguage.load_setting()[pc.get_lang()]["letter"])
    			end
    		end
    		when button or info begin
    			local data = mLanguage.load_setting()		
    			if(pc.get_lang() != 0) then
    				say(data[pc.get_lang()]["dialog"][1])
    				say("")
    				local s = select_table(data[pc.get_lang()]["language"])
    				if(s >= table.getn(data[pc.get_lang()]["language"])) then
    					return
    				else
    					pc.set_lang(data["extension"][s])
    					say(string.format(data[pc.get_lang()]["dialog"][2],data[pc.get_lang()]["language"][s]))
    				end
    			else
    				say(data["en"]["dialog"][1])
    				say("")
    				local s = select_table(data["en"]["language"])
    				if(s >= table.getn(data["en"]["language"])) then
    					return
    				else
    					pc.set_lang(data["extension"][s])
    					say(string.format(data[pc.get_lang()]["dialog"][2],data[pc.get_lang()]["language"][s]))
    				end
    			end
    		end
    	end
    end
    

    This system just supported turkish and english language.

     

    Regards.

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