Advertisement
Guest User

Untitled

a guest
May 2nd, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. -----------------------------------
  2. ---------SCRIPT por PC98------------ NAO REMOVA OS CREDITOS
  3. -----------------------------------
  4.  
  5.  
  6. function onUse(cid, item, frompos, item2, topos)
  7.  
  8. ------------------ Inicio das Config ------------
  9.  
  10. local castle_one_name = "castelo" -- Nome do castelo 1
  11. local storages = {154154,54321,123123} -- Storages ( se vc eh iniciante, deixe como está...)
  12.  
  13. -------PREMIOs I N D I V I D U A L ---------
  14.  
  15. local premio_por_vezes = 1 -- Premio por vezes de conquista de castelo. (1) = Ativo (0) = Desativa.
  16. local premio_vezes = 1 -- Caso ativo, a quantidade de conquista que o player tem, para ganhar PREMIO.
  17. local premio = 5956 -- ID do Premio
  18. local premio_cont = 1 -- Quantidade do Premio
  19. local premio_reset = 1 -- Resetar o contador do premio depois que atingir a meta?? (1) = SIM (0) = NAO
  20. local expe = 2
  21.  
  22. -------FIM PREMIOs I N D I V I D U A L ---------
  23.  
  24.  
  25. ----------------- FIM DAS CONFIG -----------------
  26.  
  27.  
  28.  
  29. local hora = tonumber(os.date("%H"))
  30.  
  31. if hora < 04 or hora > 05 then
  32. doPlayerSendTextMessage(cid,18,"A Guild House só pode ser invadida entre as 22 e 23 horas.")
  33. return true
  34. end
  35.  
  36.  
  37.  
  38. local sto_ativ = getGlobalStorageValue(storages[2])
  39. position = getCreaturePosition(cid)
  40.  
  41.  
  42.  
  43. if item.itemid == 9826 then
  44. doTransformItem(item.uid,item.itemid-1)
  45. doPlayerSendCancel(cid,"A Guild House ja foi invadida hoje.")
  46. return false
  47. end
  48.  
  49. if item.itemid == 9825 then
  50. for posx = 1254,1256 do -- checar posição X, começo e final da sala
  51. for posy = 690,690 do -- checar posicao Y, começo e final da sala
  52. local pos = {x=posx, y=posy, z=6, stackpos=253} -- posição que ira verificar se existe creatures (stackpos = 253)
  53. local creature = getThingfromPos(pos) -- pega informações da creature da posição
  54. if isMonster(creature.uid) then -- verifica se é um monster
  55. doTransformItem(item.uid,item.itemid+1)
  56. doPlayerSendTextMessage(cid,18,"Para dominar a guild house é necessario matar os guardas.")
  57. return false
  58. end
  59. end
  60. end
  61. end
  62.  
  63.  
  64.  
  65. if isPlayerGuild(cid) == TRUE then
  66. if sto_ativ == 1 or sto_ativ == -1 then
  67.  
  68. guildname = getPlayerGuildName(cid)
  69. guild = getPlayerGuildId(cid)
  70. guild_sto = getGlobalStorageValue(storages[3])
  71.  
  72. if guild ~= guild_sto then
  73. setPlayerStorageValue(cid,guild_sto,guild)
  74. if getPlayerStorageValue(cid,storages[1]) == -1 then
  75. setPlayerStorageValue(cid,storages[1],0)
  76. end
  77.  
  78. sto_vezes = getPlayerStorageValue(cid,storages[1])
  79.  
  80. setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
  81. setPlayerStorageValue(cid,storages[1], sto_vezes + 1)
  82.  
  83. sto_vezes_total = getPlayerStorageValue(cid,storages[1])
  84.  
  85. doBroadcastMessage("A guild "..getPlayerGuildName(cid).." acaba de dominar o Castelo")
  86. doPlayerSetExperienceRate(cid, expe)
  87. doSendMagicEffect(getThingPos(cid), 12)
  88.  
  89. for _, player in pairs(getPlayersOnline()) do
  90. if getPlayerStorageValue(player, guild_sto) < 1 then
  91. doPlayerSetExperienceRate(player, 1)
  92. doSendMagicEffect(getPlayerPosition(cid), 2)
  93. break
  94. end
  95. end
  96.  
  97. if premio_por_vezes == 1 then
  98. if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
  99. if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
  100. doPlayerAddItem(cid, premio,premio_cont)
  101. ----------------------------------------------- --
  102. if premio_reset == 1 then --
  103. setPlayerStorageValue(cid,storages[1],0) -- Resetar a contagem
  104. end --
  105. ----------------------------------------------- --
  106.  
  107. else
  108. doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
  109. addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
  110. end
  111. end
  112. end
  113. else
  114. doPlayerSendCancel(cid,"Sua guild já está dominando a guild house.")
  115. doTransformItem(item.uid,item.itemid+1)
  116. end
  117. else
  118. doPlayerSendCancel(cid,"O sistema está desativado")
  119. end
  120. else
  121. doPlayerSendCancel(cid,"É nescessario ter guild para dominar a guild house.")
  122. doTransformItem(item.uid,item.itemid+1)
  123. end
  124. end
  125.  
  126. ------------------------- por pc98
  127.  
  128.  
  129. ------------------------- por pc98
  130. function isPlayerGuild(cid)
  131. if getPlayerGuildName(cid) ~= "" then
  132. return TRUE
  133. else
  134. return FALSE
  135. end
  136. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement