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

no lose skull when lose the pz

kropa997

Premium User
Premium User
Joined
Oct 30, 2009
Messages
15
Reaction score
1
Hey Guys have a problem i must edit player.cpp but i dont know where i must change.
I need have a skull when lose pz. This is for war ots with skull system.
This is my player.cpp. I using OTX Server 2.X.S - 3 :: Version "LORD ZEDD"

ps sorry for my weak english
 
check this thread :)

Feature - Every changes you need to a Hardcore/War Server


they're are not the same as the otx 2 sources but will give you an idea
i have made the changes in 7.7 sources if you want it let me know

here i give you my player 7.x otx war if you want for higher versions check the thread because you need more changes than just player.cpp

player-7.7x- otx -war.cpp

also you must add later some lua scripts to make work the system as it should(keep skull if login and just lost if the player has died)
i never found properly scripts for otx 2 sadly there are tons but i didn't found a way to make it works properly

if you found them please post them here simce i want a 7.7 war server(i need scripts)


here a script i use it doesnt works as i want
with this script the player loose skull when log out and when die could be usefull for you anyway

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes">
<config name="SkullC_func"><![CDATA[
function setSkullColor(cid)
  if not isPlayer(cid) then
      return
  end
  local t = {
      [{1,2}] = SKULL_WHITE,
      [{3,4}] = SKULL_YELLOW,
      [{5,6}] = SKULL_GREEN,
      [{7,math.huge}] = SKULL_RED
  }
  local frags = getPlayerFrags(getPlayerGUID(cid))
  for var, ret in pairs(t) do
      if frags >= var[1] and frags <= var[2] then
          doCreatureSetSkullType(cid, ret)
      end
  end
end
function getPlayerFrags(guid)
   local result = db.getResult("SELECT COUNT(*) as count FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. guid)
   if(result:getID() ~= -1) then
      local count = result:getDataInt("count")
       result:free()
      return count
   end
end
]]></config>
<event type="login" name="SkullLogin" event="script"><![CDATA[
domodlib('SkullC_func')
function onLogin(cid)
  registerCreatureEvent(cid, "ColorKill")
  setSkullColor(cid)
  return true
end]]></event>
<event type="kill" name="ColorKill" event="script"><![CDATA[
domodlib('SkullC_func')
function onKill(cid, target)
  if isPlayer(cid) and isPlayer(target) then
      doCreatureSetSkullType(target, 0)
      addEvent(setSkullColor, 100, cid)
  end
  return true
end]]></event>
</mod>

regards
 
Last edited:
i use
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes">
<config name="SkullC_func"><![CDATA[
function setSkullColor(cid)
  if not isPlayer(cid) then
      return
  end
  local t = {
      [{1,2}] = SKULL_WHITE,
      [{3,4}] = SKULL_YELLOW,
      [{5,6}] = SKULL_GREEN,
      [{7,math.huge}] = SKULL_RED
  }
  local frags = getPlayerFrags(getPlayerGUID(cid))
  for var, ret in pairs(t) do
      if frags >= var[1] and frags <= var[2] then
          doCreatureSetSkullType(cid, ret)
      end
  end
end
function getPlayerFrags(guid)
   local result = db.getResult("SELECT COUNT(*) as count FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. guid)
   if(result:getID() ~= -1) then
      local count = result:getDataInt("count")
       result:free()
      return count
   end
end
]]></config>
<event type="login" name="SkullLogin" event="script"><![CDATA[
domodlib('SkullC_func')
function onLogin(cid)
  registerCreatureEvent(cid, "ColorKill")
  setSkullColor(cid)
  return true
end]]></event>
<event type="kill" name="ColorKill" event="script"><![CDATA[
domodlib('SkullC_func')
function onKill(cid, target)
  if isPlayer(cid) and isPlayer(target) then
      doCreatureSetSkullType(target, 0)
      addEvent(setSkullColor, 100, cid)
  end
  return true
end]]></event>
</mod>
this mod but still no work and use this lua

Code:
local storage = 9000
local skull = {
    [1] = SKULL_GREEN,
    [2] = SKULL_YELLOW,
    [3] = SKULL_WHITE,
    [4] = SKULL_RED
}
function onKill(cid, target, lastHit)
    if cid ~= target and isPlayer(target) then
        local skullType = getCreatureStorage(cid, storage) + 1
        skullType = (skullType > 0 and skullType <= 4) and skullType or (skullType > 4 and 4 or 1)
        doCreatureSetStorage(cid, storage, skullType)
        doCreatureSetSkullType(cid, skull[skullType])
    end
    return true
end

and work but when i lose pz skull lose too ;//
 
Back
Top