• 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 Skull System Not Working!

Extrodus

|| Blazera.net ||
Premium User
Joined
Dec 22, 2008
Messages
2,738
Solutions
7
Reaction score
541
Location
Canada
[Distro: 0.3.6 Printers Release] [Type: CreatureEvent] [Error: Works on Type PVP but with errors, and not at all on PVP-Enforced]

When I use this script with World Type PvP, it works but when players attack eachother it sets them with a white skull. From my understanding I am supposed to use PVP-Enforced for the script, but then the skull system is completely disabled it seems because the script no longer works at all and no skulls come up when attacking.

Example:
Code:
function onLogin(cid)
local frags = getPlayerPoints(cid)
   if frags >= 10 and frags < 30 then
     doCreatureSetSkullType(cid, SKULL_YELLOW)
   elseif frags >= 30 and frags < 80 then
     doCreatureSetSkullType(cid, SKULL_GREEN)
   elseif frags >= 80 and frags < 150 then
     doCreatureSetSkullType(cid, SKULL_WHITE)
   elseif frags >= 150 and frags < 300 then
     doCreatureSetSkullType(cid, SKULL_RED)
   elseif frags > 300 then
     doCreatureSetSkullType(cid, SKULL_BLACK)
   end
   return true
end

Example 2:
Code:
function onKill(cid, target, flags, damage)
   if isPlayer(target) then
         local frags = getPlayerPoints(cid)
           if frags >= 10 and frags < 30 then
             doCreatureSetSkullType(cid, SKULL_YELLOW)
           elseif frags >= 30 and frags < 80 then
             doCreatureSetSkullType(cid, SKULL_GREEN)
           elseif frags >= 80 and frags < 150 then
             doCreatureSetSkullType(cid, SKULL_WHITE)
           elseif frags >= 150 and frags < 300 then
             doCreatureSetSkullType(cid, SKULL_RED)
           elseif frags > 300 then
             doCreatureSetSkullType(cid, SKULL_BLACK)
         end
   end
   return true
end

Is there anyway to disable white skulls when using pvp as a world type, because it seems to work flawlessly on that other than the fact it brings up a white skull when players attack each other and defeats the purpose of the skull system.

I would greatly appreciate any help, as this is a key function to my test server and it is not working!

Regards,
Extrodus
 
Last edited:
I only showed one part of the script, I added part too. The fact still stands that the white skull is added when players attack eachother which I do not want happening.
 
I downloaded dev-cpp and I can now make source edits if that helps, still havent found the answer yet! I heard this has something to do with it.

Code:
void Player::setSkullEnd(time_t _time, bool login, Skulls_t _skull)
{
   if(g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED)
     return;

   bool requireUpdate = false;
   if(_time > time(NULL))
   {
     requireUpdate = true;
     setSkull(_skull);
   }
   else if(skull == _skull)
   {
     requireUpdate = true;
     setSkull(SKULL_NONE);
     _time = 0;
   }

   if(requireUpdate)
   {
     skullEnd = _time;
     if(!login)
       g_game.updateCreatureSkull(this);
   }
}
bool Player::addUnjustifiedKill(const Player* attacked)
{
   if(g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED || attacked == this || hasFlag(
     PlayerFlag_NotGainInFight) || hasCustomFlag(PlayerCustomFlag_NotGainSkull))
     return false;

   if(client)
   {
     char buffer[90];
     sprintf(buffer, "Warning! The murder of %s was not justified.",
       attacked->getName().c_str());
     client->sendTextMessage(MSG_STATUS_WARNING, buffer);
   }

   time_t now = time(NULL), today = (now - 84600), week = (now - (7 * 84600));
   std::vector<time_t> dateList;
   IOLoginData::getInstance()->getUnjustifiedDates(guid, dateList, now);

   dateList.push_back(now);
   uint32_t tc = 0, wc = 0, mc = dateList.size();
   for(std::vector<time_t>::iterator it = dateList.begin(); it != dateList.end(); ++it)
   {
     if((*it) > week)
       wc++;

     if((*it) > today)
       tc++;
   }

   uint32_t d = g_config.getNumber(ConfigManager::RED_DAILY_LIMIT), w = g_config.getNumber(
     ConfigManager::RED_WEEKLY_LIMIT), m = g_config.getNumber(ConfigManager::RED_MONTHLY_LIMIT);
   if(skull < SKULL_RED && ((d > 0 && tc >= d) || (w > 0 && wc >= w) || (m > 0 && mc >= m)))
     setSkullEnd(now + g_config.getNumber(ConfigManager::RED_SKULL_LENGTH), false, SKULL_RED);

   if(!g_config.getBool(ConfigManager::USE_BLACK_SKULL))
   {
     d += g_config.getNumber(ConfigManager::BAN_DAILY_LIMIT);
     w += g_config.getNumber(ConfigManager::BAN_WEEKLY_LIMIT);
     m += g_config.getNumber(ConfigManager::BAN_MONTHLY_LIMIT);
     if((d <= 0 || tc < d) && (w <= 0 || wc < w) && (m <= 0 || mc < m))
       return true;

     if(!IOBan::getInstance()->addAccountBanishment(accountId, (now + g_config.getNumber(
       ConfigManager::KILLS_BAN_LENGTH)), 20, ACTION_BANISHMENT, "Unjustified player killing.", 0, guid))
       return true;

     sendTextMessage(MSG_INFO_DESCR, "You have been banished.");
     g_game.addMagicEffect(getPosition(), MAGIC_EFFECT_WRAPS_GREEN);
     Scheduler::getInstance().addEvent(createSchedulerTask(1000, boost::bind(
       &Game::kickPlayer, &g_game, getID(), false)));
   }
   else
   {
     d += g_config.getNumber(ConfigManager::BLACK_DAILY_LIMIT);
     w += g_config.getNumber(ConfigManager::BLACK_WEEKLY_LIMIT);
     m += g_config.getNumber(ConfigManager::BLACK_MONTHLY_LIMIT);
     if(skull < SKULL_BLACK && ((d > 0 && tc >= d) || (w > 0 && wc >= w) || (m > 0 && mc >= m)))
     {
       setSkullEnd(now + g_config.getNumber(ConfigManager::BLACK_SKULL_LENGTH), false, SKULL_BLACK);
       setAttackedCreature(NULL);
       destroySummons();
     }
   }

   return true;
}

If you help me out with this I can send you a few bucks on paypal! I need this working.
 
In a PVP-E world people dont get skulls.

That is why it does not work.

You could try to remove this lines, to see what happens.

Code:
if(g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED)
    return;

Code:
if(g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED || attacked == this || hasFlag(
    PlayerFlag_NotGainInFight) || hasCustomFlag(PlayerCustomFlag_NotGainSkull))
    return false;
 
Hey man, already fixed it since I've been looking around. I had to remove the part where players get white skull on pvp worlds, and set it so if you have lower than a yellow skull it gets set to no skull. Meaning, it will never remove a skull. Then just used PVP world type instead.

I fixed it, thank you very much!
 
Back
Top