ConAn Edujawa
Member
- Joined
- Feb 23, 2015
- Messages
- 457
- Reaction score
- 17
im use 0.4 and i use this fuction Feature - Creatureevent OnGainExp (https://otland.net/threads/creatureevent-ongainexp.123221/)
and im add this for monster level
but when use this script always say 07:56 Congratulations, your 2 point!.
anyone know how to fix this and don't add exp
and im add this for monster level
Lua:
int32_t LuaInterface::luaGetMonsterLevel(lua_State* L)
{
// getMonsterLevel()
ScriptEnviroment* env = getEnv();
Creature* creature = env->getCreatureByUID(popNumber(L));
const Monster* monster = creature->getMonster();
if (monster) {
lua_pushnumber(L, monster->getLevel());
}
else{
lua_pushnumber(L, -1);
}
return 1;
}
but when use this script always say 07:56 Congratulations, your 2 point!.
Code:
local config = {
{"hero", 9512021, 12010, 4501021},
}
function onGainExp(cid, value)
local k,x = 108745, 0
for i = 1, #config do
local name = getCreatureByName(config[i][1])
local levelmonster = getMonsterLevel(name)
if levelmonster > 1 then
local exp =math.floor(value*getMonsterLevel(name))
doPlayerAddExp(cid, exp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ("Congratulations, your "..getMonsterLevel(name).." point!."))
end
end
return true
end