I can do this script for you, for free so no more trollin' here... -.-
.../data/lib/050-functions.lua:
LUA:
function getTargetBehind(cid) -- function by WotT
local target = getCreatureTarget(cid)
local targetPos = getCreaturePosition(target)
local direction = getCreatureLookDirection(target)
local SQM = 1
local positions = {
north = {x = targetPos.x, y = targetPos.y-SQM, z = targetPos.z},
south = {x = targetPos.x, y = targetPos.y+SQM, z = targetPos.z},
west = {x = targetPos.x-SQM, y = targetPos.y, z = targetPos.z},
east = {x = targetPos.x+SQM, y = targetPos.y, z = targetPos.z}
}
if(direction == NORTH) then
return positions.south
elseif(direction == SOUTH) then
return positions.north
elseif(direction == WEST) then
return positions.east
elseif(direction == EAST) then
return positions.west
end
return true
end
function isWalkable(cid,pos)
local aux = pos
aux.stackpos = 253
if doTileQueryAdd(cid, pos) == 1 and getTilePzInfo(pos) == FALSE and isCreature(getThingFromPos(aux).uid) == FALSE then
return TRUE
end
return FALSE
end
.../spells/scripts/attack/backstab.lua:
LUA:
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if(isWalkable(cid, getTargetBehind(cid))) then
doTeleportThing(cid, getTargetBehind(cid))
doPlayerCastSpell(cid, "Hard Strike") -- [url]http://otland.net/f35/doplayercastspell-cid-spell-80043/[/url]
else
doPlayerSendCancel(cid, "You cannot teleport to your target while the tile is blocked.")
return false
end
return true
end
COMPILE:
source:
http://otland.net/f35/doplayercastspell-cid-spell-80043/
Luascript.cpp:
after:
[CPP]
//getCreatureHealth(cid)
lua_register(m_luaState, "getCreatureHealth", LuaScriptInterface::luaGetCreatureHealth);[/CPP]
add this:
[CPP]
//doPlayerCastSpell(cid, spell)
lua_register(m_luaState, "doPlayerCastSpell", LuaScriptInterface::luaDoPlayerCastSpell);[/CPP]
after:
[CPP]
int32_t LuaScriptInterface::luaGetPlayerSex(lua_State* L)
{
//getPlayerSex(cid[, full = false])
bool full = false;
if(lua_gettop(L) > 1)
full = popNumber(L);
ScriptEnviroment* env = getEnv();
Player* player = env->getPlayerByUID((uint32_t)popNumber(L));
if(!player)
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
else
lua_pushnumber(L, player->getSex(full));
return 1;
}[/CPP]
add this:
[CPP]
int32_t LuaScriptInterface::luaDoPlayerCastSpell(lua_State* L)
{
//doPlayerCastSpell(cid, spell)
std::string spell = popString(L);
ScriptEnviroment* env = getEnv();
Player* player = env->getPlayerByUID(popNumber(L));
if(!player)
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
ReturnValue ret = RET_NOERROR;
ret = g_spells->onPlayerSay(player, spell);
if(ret == RET_NOERROR || (ret == RET_NEEDEXCHANGE && !g_config.getBool(ConfigManager::BUFFER_SPELL_FAILURE)))
return true;
lua_pushboolean(L, true);
return 1;
}[/CPP]
Luascript.h
after:
[CPP]
static int32_t luaDoRemoveItem(lua_State* L);[/CPP]
add this:
[CPP]
static int32_t luaDoPlayerCastSpell(lua_State* L);[/CPP]
Done!