Ir para conteúdo

Featured Replies

Postado

me desculpa, eu tinha acabado de acordar e não li seu código, só li o que você disse.

mas nessa parte, que supostamente verifica se o look é em você ou outro player, não ha erros:

 

  if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerFrags(thing.uid)..']')
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..']')

pode postar a msg quando da look em outro player? aparece normal?

  • Respostas 8
  • Visualizações 621
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor
  Em 15/03/2017 em 19:54, x1zy disse:

me desculpa, eu tinha acabado de acordar e não li seu código, só li o que você disse.

mas nessa parte, que supostamente verifica se o look é em você ou outro player, não ha erros:

 


  if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerFrags(thing.uid)..']')
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..']')

pode postar a msg quando da look em outro player? aparece normal?

 

16:47 You see Zika memo (Level 896). She is an royal paladin
 Military Rank: Command Sergeant Major.

Postado

penso que já descobrimos o problema, no codigo, não ha nada que chame: Military Rank: Command Sergeant Major, isso vem de outra função onLook, que de certesa, esta interferindo. pode postar a outra onLook?

Postado
  • Autor
<?xml version = "1.0" encoding = "UTF-8"?>
<mod name = "Military Ranks" version = "1.0" author = "Teckman" enabled = "yes">
  <config name = "ranks"><![CDATA[
   titles = {
        [5] = "Private First Class",
        [10] = "Specialist",
        [15] = "Corporal",
        [20] = "Sergeant",
        [25] = "Staff Sergeant",
        [30] = "Sergeant First Class",
        [35] = "Master Sergeant",
        [40] = "First Sergeant",
        [45] = "Sergeant Major",
        [50] = "Command Sergeant Major",
        [55] = "Sergeant Major of the Army",
        [60] = "Second Lieutenant",
        [65] = "First Lieutenant",
        [70] = "Captain",
        [75] = "Major",
        [80] = "Lieutenant Colonel",
        [85] = "Colonel",
        [90] = "Brigadier General",
        [95] = "Major General",
        [100] = "Lieutenant General",
        [105] = "General",
        [110] = "General of the Army",
        [115] = "Marechal",
        [120] = "Like a Boss"
   }
   fragsStorage = 600
  ]]></config>
  <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>
  <event type = "kill" name = "ranksKill" event = "script"><![CDATA[
   domodlib("ranks")
   function onKill(cid, target)
        if(isPlayer(target)) then
         setPlayerStorageValue(cid, fragsStorage, math.max(0, getPlayerStorageValue(cid, fragsStorage) + 1))
         if(titles[getPlayerStorageValue(cid, fragsStorage)]) then
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You advanced to military rank: " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. ". Congratulations " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. "!")
         end
        end
        return true
   end
  ]]></event>
  <event type = "login" name = "ranksLogin" event = "script"><![CDATA[
   function onLogin(cid)
        registerCreatureEvent(cid, "ranksKill")
        registerCreatureEvent(cid, "ranksLook")
        return true
   end
  ]]></event>
</mod>

 

  Em 16/03/2017 em 01:59, JcA disse:

<?xml version = "1.0" encoding = "UTF-8"?>
<mod name = "Military Ranks" version = "1.0" author = "Teckman" enabled = "yes">
  <config name = "ranks"><![CDATA[
   titles = {
        [5] = "Private First Class",
        [10] = "Specialist",
        [15] = "Corporal",
        [20] = "Sergeant",
        [25] = "Staff Sergeant",
        [30] = "Sergeant First Class",
        [35] = "Master Sergeant",
        [40] = "First Sergeant",
        [45] = "Sergeant Major",
        [50] = "Command Sergeant Major",
        [55] = "Sergeant Major of the Army",
        [60] = "Second Lieutenant",
        [65] = "First Lieutenant",
        [70] = "Captain",
        [75] = "Major",
        [80] = "Lieutenant Colonel",
        [85] = "Colonel",
        [90] = "Brigadier General",
        [95] = "Major General",
        [100] = "Lieutenant General",
        [105] = "General",
        [110] = "General of the Army",
        [115] = "Marechal",
        [120] = "Like a Boss"
   }
   fragsStorage = 600
  ]]></config>
  <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>
  <event type = "kill" name = "ranksKill" event = "script"><![CDATA[
   domodlib("ranks")
   function onKill(cid, target)
        if(isPlayer(target)) then
         setPlayerStorageValue(cid, fragsStorage, math.max(0, getPlayerStorageValue(cid, fragsStorage) + 1))
         if(titles[getPlayerStorageValue(cid, fragsStorage)]) then
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You advanced to military rank: " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. ". Congratulations " .. titles[getPlayerStorageValue(cid, fragsStorage)] .. "!")
         end
        end
        return true
   end
  ]]></event>
  <event type = "login" name = "ranksLogin" event = "script"><![CDATA[
   function onLogin(cid)
        registerCreatureEvent(cid, "ranksKill")
        registerCreatureEvent(cid, "ranksLook")
        return true
   end
  ]]></event>
</mod>

 

 

Isso é um Rank do Tecman, vou estar removendo para testar

  Em 15/03/2017 em 20:01, x1zy disse:

penso que já descobrimos o problema, no codigo, não ha nada que chame: Military Rank: Command Sergeant Major, isso vem de outra função onLook, que de certesa, esta interferindo. pode postar a outra onLook?

 

Você estava certo, realmente estava em conflito, bom, sera que você faz um de morte pra mim? Death [10]; igual esse?

Editado por JcA (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo