Sir Lancelot Publicado 10 de Diciembre del 2015 Reportar Compartir Publicado 10 de Diciembre del 2015 Muy buenas chicos, estuve navegando por ahí y me encontre esto... lo cual me parece interesante ya que en el foro esta como quitar el nombre. Vamos a empezar: GAME: Busamos la siguiente linea en petsystem.cpp #include "item.h" Debajo de eso agregamos: #include "db.h" Luego de agregar eso vamos a buscar lo siguiente en el mismo cpp. void CPetActor::SetName(const char* name) Lo que van a hacer es reemplazar esa linea por esta: void CPetActor::SetName(const char* name) { std::string petName = m_pkOwner->GetName(); if (0 != m_pkOwner && 0 == name && 0 != m_pkOwner->GetName()) { petName += "'s Pet"; } else petName += name; char sorgu[512]; snprintf(sorgu, sizeof(sorgu), "SELECT name FROM pet_name WHERE id = %u", m_pkOwner->GetPlayerID()); std::auto_ptr<SQLMsg> cekgelsin( DBManager::instance().DirectQuery(sorgu) ); if (cekgelsin->Get()->uiNumRows != 0) { MYSQL_ROW row = mysql_fetch_row(cekgelsin->Get()->pSQLResult); char petad[CHARACTER_NAME_MAX_LEN + 1]; strlcpy(petad, row[0], sizeof(petad)); petName = petad; } if (true == IsSummoned()) m_pkChar->SetName(petName); m_name = petName; } Ya terminamos con petsystem.cpp, ahora nos vamos a questlua_pet.cpp y buscamos lo siguiente: #include "PetSystem.h" Debajo de eso agregamos: #include "db.h" Ahora buscamos dentro del mismo cpp la siguiente linea: int pet_spawn_effect(lua_State* L) Debajo de eso vamos a agregar las siguientes lineas: int pet_namever(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr() ; if ( lua_isstring(L, 1) != true ) { lua_pushnumber(L, 1); return 1; } const char * szName = lua_tostring(L, 1); char sorgu[512]; snprintf(sorgu, sizeof(sorgu), "REPLACE INTO pet_name VALUES(%u, '%s')", ch->GetPlayerID(), szName); std::auto_ptr<SQLMsg> yolla( DBManager::instance().DirectQuery(sorgu) ); if (yolla->Get()->uiAffectedRows != 0) { lua_pushnumber(L, 3); return 3; } return 4; } Ahora buscamos lo siguiente en el mismo archivo: { "spawn_effect", pet_spawn_effect }, Debajo de esto agregamos lo siguiente: { "adver", pet_namever }, Ya terminamos de editar nuestro game, ahora toca la parte de NAVICAT: Debemos agregar esto en la parte de mysql (Navicat-->Query): DROP TABLE IF EXISTS `pet_name`; CREATE TABLE `pet_name` ( `id` int(11) NOT NULL DEFAULT '0', `name` varchar(24) CHARACTER SET utf8 COLLATE utf8_turkish_ci NOT NULL DEFAULT 'NONAME', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; Ahora vamos a FTP y nos dirigimos a ques_functions a agregar las funciones necesarias para la quest que utiliza este sistema: pet.adver Recuerden que si pide otra función la deben agregar. Ahora toca la parte de quest: quest ademin begin state start begin when 71115.use begin say_title("yeni isim ver") local str = input() if str == "" or str == nill then say_title("Kutuyu bos birakma") return end if string.len(str) <= 0 or string.len(str) > 12 then say_title("isim en fazla 12 karakter olabilir") return end local tt = "%'" local ct = "%:" local nk = "%." local vg = "%," if string.find(str, tt) or string.find(str, ct) or string.find(str, nk) or string.find(str, vg) then say_title("ozel isaret kullanamazsin") return end local t = pet.adver(str) say_title("pet adi degistirildi. peti gonder") if t == 1 then say_title("kutuyu bos bırakma") return elseif t == 2 then say_title("12 karakteri gecme") return elseif t == 3 then say_title("isim degisti") end end end end Code: local tt = "%'" local ct = "%:" local nk = "%." local vg = "%," LINK de lo aportado: Debes iniciar sesión para ver el contenido del enlace en esta publicación. Bueno espero que les haya servido la GUIA . Saludos! PD: Fuente 4Metin 2x1alex, PENTAGRAMA, Titan y 2 mas reacciono a esto 4 1 Citar Enlace para comentar Compartir en otros sitios Mas opciones de compartir...
Mensajes recomendados
Unirse a la conversación
Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.