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

Solved Noobie help

Core_

Well-Known Member
Joined
Jul 9, 2010
Messages
1,557
Solutions
1
Reaction score
50
:P well im rlly noob at lua so i need some one help that maybe easy or maybe not idk :P i just want, than when a player click in one item it cast a spell i try to make it but didnd work
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doPlayerBroadcastMessage(cid, exura, class, checkFlag, ghost)
  end

idk wath calss, checkflag, or ghost mean :s and idk if this will works, or it ust will make the player say exura, without a workin spell


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doCreatureSay(cid, 'exura', TALKTYPE_SAY)
  end

That works, the player say exura but the spell dont works :S is there other way to make players cast the spell when they click something?

like doplayercastspell or something
 
Last edited:
You can try:
LUA:
doCreatureSay(cid, 'exura', "say")
instead of using doPlayerBroadcastMessage.
Remember that every text that you want to say goes in between ' ' or " " .
 
:p thanks let my try it
:s well i change it and when i use it my tibia just crash without erros in the console, but in the debug window when i open tibia again, i saw something like unknown talktype = 0

i found that in my functions
doCreatureSay(cid, text, class, ghost, pid)

what class ghost and pid means :s?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doCreatureSay(cid, 'exura', TALKTYPE_SAY)
  end

That works, the player say exura but the spell dont works :S is there other way to make players cast the spell when they click something?

like doplayercastspell or something
 
Last edited:
Uhm, nope.

luascript.cpp
[cpp] //doPlayerCastSpell(cid, text)
lua_register(m_luaState, "doPlayerCastSpell", LuaScriptInterface::luaDoPlayerCastSpell);[/cpp]
and
[cpp]int32_t LuaScriptInterface::luaDoPlayerCastSpell(lua_State* L)
{
//doPlayerCastSpell(cid, text)
std::string text = popString(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
lua_pushboolean(L, g_spells->onPlayerSay(player, text));
else
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}

return 1;
}[/cpp]
luascript.h:
[cpp] static int32_t luaDoPlayerCastSpell(lua_State* L);[/cpp]
 
:S fuck i add it but when i try to compile :
opJg8ddyUr.png


:/ idk if i add it right:
DpUKbHuEUe.png

3NCKDT5nwE.png

GpjHWIOLgQ.png


:s whats wrong :( srry but im such a noob
 
theres conflicts, do you have another dev-cpp installed? also if your using latest mingw, you need to compile libs with latest mingw too not take them from an old version of mingw
 
:s i just delete one dev-cpp cuz i had 2 :3 but its not fixed :s i have the same problem
nQcMnVmbLK.png

im using stians dev-cpp 0.2 64bit :( idk what mingw is

i think i fuckd up my dev cpp when i move it :P and also i downloaded a new one so, i delete them and install another one but i think i fuck up the libs path :s how can i change it?


FIXED!!! :p thanks to all
 
Last edited:
Back
Top