Advertisement
Guest User

a

a guest
Jul 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. -------------- TASK SYSTEM --------------
  2. registerCreatureEvent(cid,"tasksystem")
  3. if getPlayerStorageValue(cid, 95673) < 0 then
  4. setPlayerStorageValue(cid, 95673, 0)
  5. end
  6. if getPlayerStorageValue(cid, 95674) < 0 then
  7. setPlayerStorageValue(cid, 95674, 0)
  8. end
  9. -----------------------------------
  10.  
  11.  
  12. local storages = {
  13. name = 95672,
  14. count = 95673,
  15. maxcount = 95674,
  16. }
  17.  
  18. local config = {
  19. partycount = true, --- true ou false pra ativar/desativar que os kills dos membros da party contem pra voce
  20. killdistance = 7 --- distancia que conta os kills
  21. }
  22.  
  23.  
  24. function onKill(cid, target, lastHit)
  25. if isMonster(target) and getPlayerStorageValue(cid, storages.maxcount) > 3 and (type(getCreatureMaster(target)) == 'nil' or getCreatureMaster(target) == target) and (not(isInParty(cid)) or config.partycount ~= true) then
  26. if getCreatureName(target):lower() == string.lower(getPlayerStorageValue(cid, storages.name)) then
  27. setPlayerStorageValue(cid, storages.count, getPlayerStorageValue(cid, storages.count) + 1)
  28. if getPlayerStorageValue(cid, storages.count) == getPlayerStorageValue(cid, storages.maxcount) then
  29. doPlayerSendTextMessage(cid, 19, "You finished your task.")
  30. elseif getPlayerStorageValue(cid, storages.count) < getPlayerStorageValue(cid, storages.maxcount) then
  31. doPlayerSendTextMessage(cid, 20, "Killed ".. getCreatureName(target) .."s [".. getPlayerStorageValue(cid, storages.count) .."/".. getPlayerStorageValue(cid, storages.maxcount) .."].")
  32. end
  33. end
  34. elseif isMonster(target) and (type(getCreatureMaster(target)) == 'nil' or getCreatureMaster(target) == target) and isInParty(cid) and config.partycount == true then
  35. leader = getPartyLeader(cid)
  36. party = getPartyMembers(leader)
  37. for i = 1, #party do
  38. pid = party[i]
  39. if getDistanceBetween(getThingPos(target), getThingPos(pid)) < config.killdistance then
  40. if getPlayerStorageValue(pid, storages.maxcount) > 3 then
  41. if getCreatureName(target):lower() == string.lower(getPlayerStorageValue(pid, storages.name)) then
  42. setPlayerStorageValue(pid, storages.count, getPlayerStorageValue(pid, storages.count) + 1)
  43. if getPlayerStorageValue(pid, storages.count) == getPlayerStorageValue(pid, storages.maxcount) then
  44. doPlayerSendTextMessage(pid, 19, "You finished your task.")
  45. elseif getPlayerStorageValue(pid, storages.count) < getPlayerStorageValue(pid, storages.maxcount) then
  46. doPlayerSendTextMessage(pid, 20, "Killed ".. getCreatureName(target) .."s [".. getPlayerStorageValue(pid, storages.count) .."/".. getPlayerStorageValue(pid, storages.maxcount) .."].")
  47. end
  48. end
  49. end
  50. end
  51. end
  52. end
  53. return true
  54. end
  55.  
  56.  
  57.  
  58.  
  59.  
  60. <event type="kill" name="tasksystem" script="tasksystem.lua"/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement