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

Onlook

imback1

Unknown member
Joined
Jul 11, 2013
Messages
785
Solutions
1
Reaction score
46
Hello otlanders Actually I've got problem with onlook with 2 different scripts i mean i can't switch them together
When i removed Rebirth Description i found description of my military system and when i added it i couldn't find my military system description like those photos
First one without Rebirth Description
33vgugj.jpg

And when i tried to add my Rebirth Description again i couldn't find my Military description
smxeyv.jpg

Military Onlook function (this one is MOD)
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
            domodlib("ranks")
            function onLook(cid, thing, position, lookDistance)
                if(isPlayer(thing.uid)) then
                    local rank = {rank = "Private", frags = 0}
                    for k, v in pairs(titles) do
                        if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                            if(k - 1 > rank.frags) then
                                rank.rank, rank.frags = v, k - 1
                            end
                        end
                    end
                    doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank)
                end
                return true
            end
        ]]></event>
Rebirth Description (Creature Script)
Code:
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        local sex = getPlayerSex(thing.uid)
        local message = "You see " .. getPlayerName(thing.uid) .. " (Level " .. getPlayerLevel(thing.uid) .. ")."
        if(getPlayerFlagValue(thing.uid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. getPlayerGroupName(thing.uid) .. "."
        elseif(getPlayerVocation(thing.uid) ~= 0) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. getPlayerVocationName(thing.uid):lower() .. "."
        else
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " has no vocation."
        end

        if(getPlayerNameByGUID(getPlayerPartner(thing.uid), false, false) ~= nil) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (sex == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(thing.uid)) .. "."
        end

        if(getPlayerGuildId(thing.uid) > 0) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (getPlayerGuildRank(thing.uid) == "" and "a member" or getPlayerGuildRank(thing.uid)) .. " of the " .. getPlayerGuildName(thing.uid)
            message = getPlayerGuildNick(thing.uid) ~= "" and message .. " (" .. getPlayerGuildNick(thing.uid) .. ")." or message .. "."
        end

        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
            message = message .. "\nHealth: [" .. getCreatureHealth(thing.uid) .. " / " .. getCreatureMaxHealth(thing.uid) .. "], Mana: [" .. getCreatureMana(thing.uid) .. " / " .. getCreatureMaxMana(thing.uid) .. "]."
        end

        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
            message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
        end

        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times."))
        return false
    elseif thing.uid == cid then
        local message = "You see yourself."
        if(getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
            message = message .. " You are " .. getPlayerGroupName(cid) .. "."
        elseif(getPlayerVocation(cid) ~= 0) then
            message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. "."
        else
            message = message .. " You have no vocation."
        end

        if(getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil) then
            message = message .. " You are " .. (getPlayerSex(cid) == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(cid)) .. "."
        end

        if(getPlayerGuildId(cid) > 0) then
            message = message .. " You are " .. (getPlayerGuildRank(cid) == "" and "a member" or getPlayerGuildRank(cid)) .. " of the " .. getPlayerGuildName(cid)
            message = getPlayerGuildNick(cid) ~= "" and message .. " (" .. getPlayerGuildNick(cid) .. ")." or message .. "."
        end

        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
            message = message .. "\nHealth: [" .. getCreatureHealth(cid) .. " / " .. getCreatureMaxHealth(cid) .. "], Mana: [" .. getCreatureMana(cid) .. " / " .. getCreatureMaxMana(cid) .. "]."
        end

        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
            message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
        end

        return false, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. " \nYou have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times."))
    end

    return true
end
May you tell me where is the problem with those scripts? And how can i make them work together? Like
Military Ranks:Master Serpent, She has prestiged 0 times.
TFS 0.3.6
Thanks in advance
 
Last edited:
test
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
  domodlib("ranks")
  function onLook(cid, thing, position, lookDistance)
  if(isPlayer(thing.uid)) then
  local rank = {rank = "Private", frags = 0}
  for k, v in pairs(titles) do
  if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
  if(k - 1 > rank.frags) then
  rank.rank, rank.frags = v, k - 1
  end
  end
  end
  doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank)

  if (thing.uid ~= cid) then
  local sex = getPlayerSex(thing.uid)
  doPlayerSetSpecialDescription(thing.uid,". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times."))
  else
  doPlayerSetSpecialDescription(cid, ". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times."))
  end
  end
  return true
  end
  ]]></event>
 
test
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
  domodlib("ranks")
  function onLook(cid, thing, position, lookDistance)
  if(isPlayer(thing.uid)) then
  local rank = {rank = "Private", frags = 0}
  for k, v in pairs(titles) do
  if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
  if(k - 1 > rank.frags) then
  rank.rank, rank.frags = v, k - 1
  end
  end
  end
  doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank)

  if (thing.uid ~= cid) then
  local sex = getPlayerSex(thing.uid)
  doPlayerSetSpecialDescription(thing.uid,". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times."))
  else
  doPlayerSetSpecialDescription(cid, ". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times."))
  end
  end
  return true
  end
  ]]></event>
same thing
Code:
19:10 You see Wars (Level 3777). She is a elder druid.
She has prestiged 0 time.
 
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
   domodlib("ranks")
   function onLook(cid, thing, position, lookDistance)
       if(isPlayer(thing.uid)) then
           local str = ""
           local rank = {rank = "Private", frags = 0}
           for k, v in pairs(titles) do
               if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                   if(k - 1 > rank.frags) then
                       rank.rank, rank.frags = v, k - 1
                   end
               end
           end
           str = ". Military rank: " .. rank.rank)

         if (thing.uid ~= cid) then
            local sex = getPlayerSex(thing.uid)
            str = str ..". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times.")
         else
            str = str ..". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times.")
         end
         doPlayerSetSpecialDescription(thing.uid, str)

       end
       return true
   end
]]></event>
 
Last edited:
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
   domodlib("ranks")
   function onLook(cid, thing, position, lookDistance)
       if(isPlayer(thing.uid)) then
           local str = ""
           local rank = {rank = "Private", frags = 0}
           for k, v in pairs(titles) do
               if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                   if(k - 1 > rank.frags) then
                       rank.rank, rank.frags = v, k - 1
                   end
               end
           end
           str = "\n Military rank: " .. rank.rank)

         if (thing.uid ~= cid) then
            local sex = getPlayerSex(thing.uid)
            str = str ..". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times.")
         else
            str = str ..". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times.")
         end
         doPlayerSetSpecialDescription(thing.uid, str)

       end
       return true
   end
]]></event>
:( sorry but caused a bug
314c6qu.jpg
 
wtf, try now:
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
   domodlib("ranks")
   function onLook(cid, thing, position, lookDistance)
       if(isPlayer(thing.uid)) then
           local str = ""
           local rank = {rank = "Private", frags = 0}
           for k, v in pairs(titles) do
               if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                   if(k - 1 > rank.frags) then
                       rank.rank, rank.frags = v, k - 1
                   end
               end
           end
           str = "\n Military rank: " .. rank.rank


         if (thing.uid ~= cid) then
            local sex = getPlayerSex(thing.uid)
            str = str ..". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(thing.uid, str)
         else
            str = str ..". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(cid, str)
         end
       

       end
       return true
   end
]]></event>
 
Last edited:
wtf, try now:
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
   domodlib("ranks")
   function onLook(cid, thing, position, lookDistance)
       if(isPlayer(thing.uid)) then
           local str = ""
           local rank = {rank = "Private", frags = 0}
           for k, v in pairs(titles) do
               if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                   if(k - 1 > rank.frags) then
                       rank.rank, rank.frags = v, k - 1
                   end
               end
           end
           str = "\n Military rank: " .. rank.rank)


         if (thing.uid ~= cid) then
            local sex = getPlayerSex(thing.uid)
            str = str ..". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(thing.uid, str)
         else
            str = str ..". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(cid, str)
         end
       

       end
       return true
   end
]]></event>
Same debug :(
 
i mean this one:
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
   domodlib("ranks")
   function onLook(cid, thing, position, lookDistance)
       if(isPlayer(thing.uid)) then
           local str = ""
           local rank = {rank = "Private", frags = 0}
           for k, v in pairs(titles) do
               if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                   if(k - 1 > rank.frags) then
                       rank.rank, rank.frags = v, k - 1
                   end
               end
           end
           str = "\n Military rank: " .. rank.rank


         if (thing.uid ~= cid) then
            local sex = getPlayerSex(thing.uid)
            str = str ..". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(thing.uid, str)
         else
            str = str ..". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(cid, str)
         end
      

       end
       return true
   end
]]></event>
 
i mean this one:
Code:
<event type = "look" name = "ranksLook" event = "script"><![CDATA[
   domodlib("ranks")
   function onLook(cid, thing, position, lookDistance)
       if(isPlayer(thing.uid)) then
           local str = ""
           local rank = {rank = "Private", frags = 0}
           for k, v in pairs(titles) do
               if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
                   if(k - 1 > rank.frags) then
                       rank.rank, rank.frags = v, k - 1
                   end
               end
           end
           str = "\n Military rank: " .. rank.rank


         if (thing.uid ~= cid) then
            local sex = getPlayerSex(thing.uid)
            str = str ..". ".. (sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (getCreatureStorage(thing.uid, 85987) == -1 and "0" or getCreatureStorage(thing.uid, 85987)) .. " " .. (math.abs(getCreatureStorage(thing.uid, 85987)) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(thing.uid, str)
         else
            str = str ..". You have prestiged " .. (getCreatureStorage(cid, 85987) == -1 and "0" or getCreatureStorage(cid, 85987)) .. " " .. (getCreatureStorage(cid, 85987) == 1 and "time." or "times.")
            doPlayerSetSpecialDescription(cid, str)
         end
     

       end
       return true
   end
]]></event>
Yea i tried this one and still same thing
 
Back
Top