Hi.
Note: For all codes: [Only registered and activated users can see links. Click Here To Register...]
open petsystem.cpp
find:
add
find:
change code block:
open questlua_pet.cpp
find:
add
find
add code block
find
add
Navicat mysql query :
Open Navicat > Click to "Query":
add to in Quest_functions
Quest:
Yukarıda :
tt > '
ct > :
nk > .
vg > ,
Pet name given apply to all pets.
Note: Pet name > max 24 characters
|
|
Note: For all codes: [Only registered and activated users can see links. Click Here To Register...]
open petsystem.cpp
find:
Code:
#include "item.h"
Code:
#include "db.h"
Code:
void CPetActor::SetName(const char* name)
Code:
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;
}
find:
Code:
#include "PetSystem.h"
Code:
#include "db.h"
find
Code:
int pet_spawn_effect(lua_State* L)
Code:
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;
}
Code:
{ "spawn_effect", pet_spawn_effect },
Code:
{ "adver", pet_namever },
Navicat mysql query :
Open Navicat > Click to "Query":
Code:
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;
Code:
pet.adver
Code:
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 = "%,"
Yukarıda :
tt > '
ct > :
nk > .
vg > ,
Pet name given apply to all pets.
Note: Pet name > max 24 characters