• 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!

Jak skonfigurować poprawnie kod c++

Nothxbye

Banned User
Joined
Jan 22, 2012
Messages
1,124
Reaction score
174
Witam.
Jestem prawie, że zielony w c++ i mam tutaj skrypt z innego silnika który trzeba umieścić w moim sliniku. Jestem przekonany, że dla was to nic trudnego.

W skrypcie umieściłem błędy na czerwono.

SKRYPT 2 posty niżej.
 
Last edited:
nie jestem expertem ale tak sobie myślę

że onCombat ~= onLook

onCombat != onLook
 
nie jestem expertem ale tak sobie myślę

że onCombat ~= onLook

onCombat != onLook

Nie wiem o czym mowisz lecz sam doszedłem do tego ostatni błąd nie wiem czemu.

Code:
uint32_t CreatureEvent::executeCombat(Creature* creature, Creature* target)
{
         //onCombat(cid, target)
         if(m_scriptInterface->reserveScriptEnv())
         {
                 ScriptEnviroment* env = m_scriptInterface->getScriptEnv();
                 if(m_scripted == 1)
                 {
                         env->setRealPos(creature->getPosition());
                         std::stringstream scriptstream;

                         scriptstream << "local cid = " << env->addThing(creature) << std::endl;
                         scriptstream << "local target = " << env->addThing(target) << std::endl;

                         scriptstream << m_scripted;
                         bool result = true;
                         if(m_scriptInterface->loadBuffer(scriptstream.str()[U])[/U]) --- [COLOR="#FF0000"]Error: too few arguments in function call[/COLOR][COLOR="#FF0000"][/COLOR]
                         {
                                 lua_State* L = m_scriptInterface->getLuaState();
                                 result = m_scriptInterface->callFunction(3);
                         }

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

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

                         lua_State* L = m_scriptInterface->getLuaState();
                         m_scriptInterface->pushFunction(m_scriptId);

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

                         bool result = m_scriptInterface->callFunction(2);
                         m_scriptInterface->releaseScriptEnv();
                         return result;
                 }
         }
         else
         {
                 std::cout << "[Error - CreatureEvent::executeCombat] Call stack overflow." << std::endl;
                 return 0;
         }
}

Nie jestem też pewien czy całosć jest poprawnie sprecyzowana.
 
Last edited:
bo przed edytem podałeś 2 skrypty i napisałeś, że masz drugi podobny, a on był zupełnie do czego innego :D
 
Back
Top