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

Lua Anti Aoe Spell

beliar34

Member
Joined
Feb 28, 2012
Messages
307
Solutions
7
Reaction score
11
Hello
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/AntiAOE.lua:onCombat

luaGetCreatureName(). Creature not found

Code:
function onStatsChange(cid, attacker, type, combat, value)
    if(attacker and isPlayer(attacker) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getCreatureName(getCreatureTarget(attacker)) ~= getCreatureName(cid)) then
        if combat ~= COMBAT_HEALING then
    return doPlayerSendCancel(cid, 'You must mark player.') and false
end
end
return true
end
function onCombat(cid, target) 
    if(target and isPlayer(target) and getCreatureName(getCreatureTarget(cid)) ~= getCreatureName(target)) then 
    return doPlayerSendCancel(cid, 'You must mark player.') and false
end
return true 
end

I think you understand, that happens if somebody try to mark somebody or hit with aoe spell, anyway script work in 50% cuz players dont hit each other with aoe spells but i dont have PVP on server
 
Code:
function onStatsChange(cid, attacker, type, combat, value)
    if(attacker and isPlayer(attacker) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getCreatureName(getCreatureTarget(attacker)) ~= getCreatureName(cid)) then
        if combat ~= COMBAT_HEALING then
    return doPlayerSendCancel(cid, 'You must mark player.') and false
end
end
return true
end
function onCombat(cid, target)
    if(target and isPlayer(target) and getCreatureName(target) == false) then
    return doPlayerSendCancel(cid, 'You must mark player.') and false
end
return true
end

or

Code:
function onStatsChange(cid, attacker, type, combat, value)
    if(attacker and isPlayer(attacker) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getCreatureName(getCreatureTarget(attacker)) ~= getCreatureName(cid)) then
        if combat ~= COMBAT_HEALING then
    return doPlayerSendCancel(cid, 'You must mark player.') and false
end
end
return true
end
function onCombat(cid, target)
    if(target and isPlayer(target) and getCreatureTarget(cid) == false) then
    return doPlayerSendCancel(cid, 'You must mark player.') and false
end
return true
end

or

luascripts.cpp
Code:
int32_t LuaScriptInterface::luaGetPlayerSecureMode(lua_State* L)
{
    //getPlayerSecureMode(cid)
    ScriptEnviroment* env = getScriptEnv();
    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->getSecureMode());

    return 1;
}
 
Last edited:
I compiled with securemode !

But securemode dosent work for me i got
Code:
'getPlayerSecureMode' (a nil value)
Any solutions ?
 
Last edited:
change tfs ;d
check this simple script
Code:
function onSay(cid, words, param, channel)
if getPlayerSecureMode(cid) == true then
doPlayerSendTextMessage(cid,22,"i cant attack other players")
else
doPlayerSendTextMessage(cid,22,"i can attack")
end
end
 
Back
Top