• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Warning event onkill

Erazma

Banned User
Joined
Sep 3, 2012
Messages
265
Reaction score
4
Witam mam problem z taskami nie wiem co robic juz nie mam pomyslow podmienialem liby wiec to nie wina lib'ów... widocznie silnika mam taki problem
event::loadscript cid, target, damage, flags, war not found

Code:
function onKill(cid, target, lastHit)
Code:
<event type="kill" name="KillingInTheNameOf" event="script" value="killinginthenameof.lua"/>
Code:
registerCreatureEvent(cid, "KillingInTheNameOf")

taki sam problem mam jezeli chodzi o inq ;p ;/
nie mam juz pojecia co moze byc nie tak i jak to zrobic

w source mam

Code:
uint32_t CreatureEvent::executeKill(Creature* creature, Creature* target, const DeathEntry& entry)
{
	//onKill(cid, target, damage, flags)
	if(m_interface->reserveEnv())
	{
		uint32_t flags = 0;
		if(entry.isLast())
			flags |= 1;

		if(entry.isJustify())
			flags |= 2;

		if(entry.isUnjustified())
			flags |= 4;

		ScriptEnviroment* env = m_interface->getEnv();
		if(m_scripted == EVENT_SCRIPT_BUFFER)
		{
			env->setRealPos(creature->getPosition());
			std::stringstream scriptstream;
			scriptstream << "local cid = " << env->addThing(creature) << std::endl;

			scriptstream << "local target = " << env->addThing(target) << std::endl;
			scriptstream << "local damage = " << entry.getDamage() << std::endl;
			scriptstream << "local flags = " << flags << std::endl;
#ifdef __WAR_SYSTEM__
			scriptstream << "local war = " << entry.getWar().war << std::endl;
#endif

			scriptstream << m_scriptData;
			bool result = true;
			if(m_interface->loadBuffer(scriptstream.str()))
			{
				lua_State* L = m_interface->getState();
				result = m_interface->getGlobalBool(L, "_result", true);
			}

			m_interface->releaseEnv();
			return result;
		}
		else
		{
			#ifdef __DEBUG_LUASCRIPTS__
			std::stringstream desc;
			desc << creature->getName();
			env->setEventDesc(desc.str());
			#endif

			env->setScriptId(m_scriptId, m_interface);
			env->setRealPos(creature->getPosition());

			lua_State* L = m_interface->getState();
			m_interface->pushFunction(m_scriptId);

			lua_pushnumber(L, env->addThing(creature));
			lua_pushnumber(L, env->addThing(target));

			lua_pushnumber(L, entry.getDamage());
			lua_pushnumber(L, flags);
#ifndef __WAR_SYSTEM__

			bool result = m_interface->callFunction(4);
#else
			lua_pushnumber(L, entry.getWar().war);

			bool result = m_interface->callFunction(5);
#endif

			m_interface->releaseEnv();
			return result;
		}
	}
	else
	{
		std::cout << "[Error - CreatureEvent::executeKill] Call stack overflow." << std::endl;
		return 0;
	}
}

uint32_t CreatureEvent::executeDeath(Creature* creature, Item* corpse, DeathList deathList)
{
a w innym silniku mam
Code:
uint32_t CreatureEvent::executeKill(Creature* creature, Creature* target, bool lastHit)
{
	//onKill(cid, target, lastHit)
	if(m_interface->reserveEnv())
	{
		ScriptEnviroment* env = m_interface->getEnv();
		if(m_scripted == EVENT_SCRIPT_BUFFER)
		{
			env->setRealPos(creature->getPosition());
			std::stringstream scriptstream;
			scriptstream << "local cid = " << env->addThing(creature) << std::endl;

			scriptstream << "local target = " << env->addThing(target) << std::endl;
			scriptstream << "local lastHit = " << (lastHit ? "true" : "false") << std::endl;

			scriptstream << m_scriptData;
			bool result = true;
			if(m_interface->loadBuffer(scriptstream.str()))
			{
				lua_State* L = m_interface->getState();
				result = m_interface->getGlobalBool(L, "_result", true);
			}

			m_interface->releaseEnv();
			return result;
		}
		else
		{
			#ifdef __DEBUG_LUASCRIPTS__
			std::stringstream desc;
			desc << creature->getName();
			env->setEventDesc(desc.str());
			#endif

			env->setScriptId(m_scriptId, m_interface);
			env->setRealPos(creature->getPosition());

			lua_State* L = m_interface->getState();
			m_interface->pushFunction(m_scriptId);

			lua_pushnumber(L, env->addThing(creature));
			lua_pushnumber(L, env->addThing(target));
			lua_pushboolean(L, lastHit);

			bool result = m_interface->callFunction(3);
			m_interface->releaseEnv();
			return result;
		}
	}
	else
	{
		std::cout << "[Error - CreatureEvent::executeKill] Call stack overflow." << std::endl;
		return 0;
	}
}

uint32_t CreatureEvent::executeDeath(Creature* creature, Item* corpse, DeathList deathList)
{
 
Last edited:
Code:
function onKill(cid, target)

local pit = getCreatureStorage(cid, STORAGE_PIT)
local arena = getCreatureStorage(cid, STORAGE_ARENA)
if isPlayer(target) then return true end
if pit < 1 or pit > 10 then return true end
if arena < 1 then return true end

if isInArray(ARENA[arena].creatures, getCreatureName(target):lower()) then
local pillar = getTopItem(PITS[pit].pillar)
if pillar.itemid == ITEM_STONEPILLAR then
doRemoveItem(pillar.uid)
else
print("[Svargrond Arena::CreatureEvent] Cannot remove stone pillar on position X: " .. PITS[pit].pillar.x .. ", Y: " .. PITS[pit].pillar.y .. ", Z: " .. PITS[pit].pillar.z .. ".")
end
doCreatureSetStorage(cid, STORAGE_PIT, pit + 1)
doCreatureSay(cid, "Victory! Head through the new teleporter into the next room.", TALKTYPE_MONSTER)
end
return true
end

Najkrótszy kod na arene onkill mi nie dziala nie wiem juz sam czemu.. ale ok blad z silnika...
xaovol.jpg

xaovol.jpg
 
wiem ale taki sam blad mi wywala przy inq arenie i killing of the name wiec jeden huj xd wiesz o co loco?

- - - Updated - - -

Prosze o pomoc :) probowałem dodać opcję onkill w source ale kompletnie sie na tym nie znam

- - - Updated - - -

JEDNAK SOBIE PORADZIŁEM hehe :) męczyłem się 2h zmieniałem silniki i wg... a się okazało że wystarczyło dodać 2 linijki no cóż każdy uczy się z czasem.
 
Last edited:
wiem ale taki sam blad mi wywala przy inq arenie i killing of the name wiec jeden huj xd wiesz o co loco?

- - - Updated - - -

Prosze o pomoc :) probowałem dodać opcję onkill w source ale kompletnie sie na tym nie znam

- - - Updated - - -

JEDNAK SOBIE PORADZIŁEM hehe :) męczyłem się 2h zmieniałem silniki i wg... a się okazało że wystarczyło dodać 2 linijki no cóż każdy uczy się z czasem.


napisz które by potem ludzie mieli rozwiązanie
 
zaraz zobacze w source ale nie wiem czy znajde xd

- - - Updated - - -

Zmieniłem creaturescript.cpp
Code:
case CREATURE_EVENT_CAST:
return "cid, target";
case CREATURE_EVENT_DEATH:
return "cid, corpse, deathList";
case CREATURE_EVENT_PREPAREDEATH:

Code:
case CREATURE_EVENT_CAST:
return "cid, target";
[COLOR="#FF0000"]case CREATURE_EVENT_KILL:
return "cid, target, lastHit";[/COLOR]
case CREATURE_EVENT_DEATH:
return "cid, corpse, deathList";
case CREATURE_EVENT_PREPAREDEATH:

tego brakowało nie wiem co jeszcze nie pamiętam no ale się starałem xd
 
Last edited:
Back
Top