Advertisement
Guest User

Untitled

a guest
May 27th, 2024
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. local SystemMain = {};
  2.  
  3. BridgeFunctionAttach("OnMonsterDie", "TriggerMonster_OnMonsterDie")
  4. function TriggerMonster_OnMonsterDie(aIndex,bIndex)
  5. for i, v in pairs(SystemMain.Boss) do
  6. if(v == GetObjectClass(aIndex)) then
  7. InsertSqlCode(bIndex,GetObjectClass(aIndex));
  8. return;
  9. end
  10. end
  11.  
  12.  
  13. end
  14.  
  15. function getDataTime(type)
  16.  
  17. local current_time = os.time()
  18. local datetime_string = ""
  19. local regex = "%Y-%m-%d %H:%M:%S"
  20.  
  21. type = type and type or false
  22.  
  23. if type == false then
  24.  
  25. regex = "%Y-%m-%d"
  26.  
  27. end
  28.  
  29. datetime_string = os.date(regex, current_time)
  30.  
  31. return datetime_string
  32.  
  33. end
  34.  
  35.  
  36. function InsertSqlCode(bIndex,Class)
  37.  
  38. SQLQuery(string.format("SELECT * FROM MUCMS_TRIGGER_MONSTER WHERE MonsterID = %d",Class))
  39. SQLFetch()
  40. MonsterID = SQLGetNumber("MonsterID")
  41. SQLClose()
  42.  
  43. if(MonsterID == Class) then
  44. SQLQuery(string.format("UPDATE MUCMS_TRIGGER_MONSTER SET Count = Count + 1, LastKilled = getdate() WHERE MonsterID = %d",Class))
  45. SQLFetch()
  46. SQLClose()
  47. else
  48. SQLQuery(string.format("INSERT INTO MUCMS_TRIGGER_MONSTER (AccountID,Name,Date,MonsterID,Count,LastKilled) VALUES ('%s','%s','%s',%d,%d,getdate())",GetObjectAccount(bIndex),GetObjectName(bIndex),getDataTime(false),Class,1))
  49. SQLFetch()
  50. SQLClose()
  51. end
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. end
  59.  
  60.  
  61. BridgeFunctionAttach("OnReadScript","TriggerMonster_OnReadScript");
  62. function TriggerMonster_OnReadScript()
  63. SystemMain.Boss = {275,561,459,673,716,734,746,794,735};
  64. LogColor(1,"[ValkyrieScript] TriggerMonster Carregado!!")
  65. end
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement