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

C++ Reset skull ticks for skulled [red/black] players after 24 hrs from last kill

S

Shadow_

Guest
i made a new variable to add in it the constant value of skull ticks at the moment the player did the last kill, frag_time is 24 hours too, so what am i doing wrong here makes it doesn't reset after 24hrs for skulled players
C++:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_EVENT_ADVANCE, "Warning! The murder of " + attacked->getName() + " was not justified.");

    skullTicks += g_config.getNumber(ConfigManager::FRAG_TIME);
    skullFragTicks = skullTicks;
    if (getSkull() != SKULL_BLACK) {
        if (g_config.getNumber(ConfigManager::KILLS_TO_BLACK) != 0 && skullTicks > (g_config.getNumber(ConfigManager::KILLS_TO_BLACK) - 1) * static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))) {
            setSkull(SKULL_BLACK);
            }
        else if (getSkull() != SKULL_RED && g_config.getNumber(ConfigManager::KILLS_TO_RED) != 0 && skullTicks > (g_config.getNumber(ConfigManager::KILLS_TO_RED) - 1) * static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))) {
            setSkull(SKULL_RED);
        }
    }
}

void Player::checkSkullTicks(int64_t ticks)
{
    int64_t newTicks = skullTicks - ticks;
    if (newTicks < 0) {
        skullTicks = 0;
    }
    else {
        skullTicks = newTicks;
    }

    if ((skull == SKULL_RED || skull == SKULL_BLACK) && skullTicks < skullFragTicks - g_config.getNumber(ConfigManager::FRAG_TIME) && !hasCondition(CONDITION_INFIGHT)) {
        setSkull(SKULL_NONE);
        skullTicks = 1000;
    }
}



edit, can it be that im not using getSkull() function and comparing the variable (int) to the constant of skulls?
C++:
    if ((skull == SKULL_RED || skull == SKULL_BLACK) && skullTicks < skullFragTicks - g_config.getNumber(ConfigManager::FRAG_TIME) && !hasCondition(CONDITION_INFIGHT)) {
 
Back
Top