Maybe someone need it? :w00t:
And...
For an example:
Code:
int32_t LuaScriptInterface::luaDoPlayerCastSpell(lua_State* L)
{
//doPlayerCastSpell(uid, spellname)
uint32_t uid = 0;
std::string text = popString(L);
uid = popNumber(L);
ScriptEnviroment* env = getEnv();
Player* player = env->getPlayerByUID(uid);
if(!player)
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
InstantSpell* instantSpell = g_spells->getInstantSpell(text);
if(!instantSpell)
{
errorEx(getError(LUA_ERROR_SPELL_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
return g_spells->onPlayerSay(player, text);
}
Code:
//doPlayerCastSpell(uid, spellname)
lua_register(m_luaState, "doPlayerCastSpell", LuaScriptInterface::luaDoPlayerCastSpell);
For an example:
Code:
function onUse(cid)
doPlayerCastSpell(cid, "Exevo Gran Mas Vis") //when player use item of actionid then automatically cast spell
end