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

TFS 0.X Exiva only in PKs (find person)

maikons

Member
Joined
Aug 1, 2015
Messages
227
Reaction score
16
What do i need to do to add this condition:
Code:
if(getCreatureSkullType(cid) ~= SKULL_YELLOW 
and getCreatureSkullType(cid) ~= SKULL_WHITE
and getCreatureSkullType(cid) ~= SKULL_RED
and getCreatureSkullType(cid) ~= SKULL_BLACK
) then
    doPlayerSendCancel(cid, "You can not locate players with no skulls!")
end

on exiva?
Code:
<instant name="Find Person" words="exiva" mana="20" aggressive="0" params="1" exhaustion="1000" needlearn="1" event="function" value="searchPlayer" />

 
Solution
Maybe:
C++:
if (!player->isPzLocked()) {
    // ...
}

Edit
===
It didn't work because I assumed you were using TFS 1.3. However, with the snippet above, it should work now. Again, I haven't tested.
On this line Here

Add something like this. (this code is untested as I'm not on my coding computer).
C++:
if(targetPlayer->getSkull() != SKULL_BLACK && targetPlayer->getSkull() != SKULL_WHITE && targetPlayer->getSkull() != SKULL_RED && targetPlayer->getSkull() != SKULL_YELLOW)
    {
        player->sendCancelMessage("You can not locate players with no skulls!");
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }
 
On this line Here

Add something like this. (this code is untested as I'm not on my coding computer).
C++:
if(targetPlayer->getSkull() != SKULL_BLACK && targetPlayer->getSkull() != SKULL_WHITE && targetPlayer->getSkull() != SKULL_RED && targetPlayer->getSkull() != SKULL_YELLOW)
    {
        player->sendCancelMessage("You can not locate players with no skulls!");
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }

ty!

this line cant be a string
player->sendCancelMessage("You can not locate players with no skulls!");

so i've change to
player->sendCancelMessage(RET_CREATUREISNOTREACHABLE);

only a last thing:
black,white,red is working
but yellow is not working...
do u know how to fix it?
 
Not tested, but you can give this a try:
C++:
if (targetPlayer->getClientIcons() & ICON_REDSWORDS == 0) {
    // ...
    return false;
}

Like this:
Code:
bool InstantSpell::SearchPlayer(const InstantSpell*, Creature* creature, const std::string& param)
{
    Player* player = creature->getPlayer();
    if(!player || player->isRemoved())
        return false;

    Player* targetPlayer = NULL;
    ReturnValue ret = g_game.getPlayerByNameWildcard(param, targetPlayer);
    if(ret != RET_NOERROR || !targetPlayer || targetPlayer->isRemoved())
    {
        player->sendCancelMessage(ret);
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }

    if(targetPlayer->hasCustomFlag(PlayerCustomFlag_NotSearchable) && !player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges))
    {
        player->sendCancelMessage(RET_PLAYERWITHTHISNAMEISNOTONLINE);
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }

    // <exiva only in PKs>
    if(
      (targetPlayer->getSkull() != SKULL_BLACK && targetPlayer->getSkull() != SKULL_WHITE && targetPlayer->getSkull() != SKULL_RED)
   || (targetPlayer->getClientIcons() & ICON_REDSWORDS == 0)
    ) {
        player->sendCancelMessage(RET_CREATUREISNOTREACHABLE);
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }
    // </exiva only in PKs>

    std::stringstream ss;
    ss << targetPlayer->getName() << " " << g_game.getSearchString(player->getPosition(), targetPlayer->getPosition(), true, true) << ".";
    player->sendTextMessage(MSG_INFO_DESCR, ss.str().c_str());

    g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);
    return true;
}
???

It not work
Code:
spells.cpp: In member function ‘uint32_t Spells::getInstantSpellCountCustom(const Player*)’:
spells.cpp:282:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         if (!instantSpell->hasVocation(player->getVocationId()))
         ^~
spells.cpp:285:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
             ++count;
             ^~
spells.cpp: In static member function ‘static bool InstantSpell::SearchPlayer(const InstantSpell*, Creature*, const string&)’:
spells.cpp:1361:22: error: ‘class Player’ has no member named ‘getClientIcons’; did you mean ‘getClientVersion’?
    || (targetPlayer->getClientIcons() & ICON_REDSWORDS == 0)
                      ^~~~~~~~~~~~~~
spells.cpp:1361:41: error: ‘ICON_REDSWORDS’ was not declared in this scope
    || (targetPlayer->getClientIcons() & ICON_REDSWORDS == 0)
                                         ^~~~~~~~~~~~~~
Makefile:33: recipe for target 'spells.o' failed
make: *** [spells.o] Error 1

I think i used wrong, so i look to the function and i found nothing; Fir3element/3777 (https://github.com/Fir3element/3777/search?q=getClientIcons)
 
Maybe:
C++:
if (!player->isPzLocked()) {
    // ...
}

Edit
===
It didn't work because I assumed you were using TFS 1.3. However, with the snippet above, it should work now. Again, I haven't tested.

It not work for red sword players:

Code:
    if(
      (targetPlayer->getSkull() != SKULL_BLACK 
    && targetPlayer->getSkull() != SKULL_WHITE
    && targetPlayer->getSkull() != SKULL_RED
    )
           && (!player->isPzLocked())
    ) {
        player->sendCancelMessage(RET_CREATUREISNOTREACHABLE);
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }

i've done something wrong?
 
I would go with this simpler logic:
C++:
if (player->isPzLocked() || player->getSkull() == SKULL_WHITE || player->getSkull() == SKULL_RED || player->getSkull() == SKULL_BLACK) {
    // exiva logic
    return true;
}
// send cancel
return false;
 
I would go with this simpler logic:
C++:
if (player->isPzLocked() || player->getSkull() == SKULL_WHITE || player->getSkull() == SKULL_RED || player->getSkull() == SKULL_BLACK) {
    // exiva logic
    return true;
}
// send cancel
return false;

it is only one if, that must be it
thank you so much bro!
 
Back
Top