Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SystemMain = {};
- BridgeFunctionAttach("OnMonsterDie", "TriggerMonster_OnMonsterDie")
- function TriggerMonster_OnMonsterDie(aIndex,bIndex)
- for i, v in pairs(SystemMain.Boss) do
- if(v == GetObjectClass(aIndex)) then
- InsertSqlCode(bIndex,GetObjectClass(aIndex));
- return;
- end
- end
- end
- function getDataTime(type)
- local current_time = os.time()
- local datetime_string = ""
- local regex = "%Y-%m-%d %H:%M:%S"
- type = type and type or false
- if type == false then
- regex = "%Y-%m-%d"
- end
- datetime_string = os.date(regex, current_time)
- return datetime_string
- end
- function InsertSqlCode(bIndex,Class)
- SQLQuery(string.format("SELECT * FROM MUCMS_TRIGGER_MONSTER WHERE MonsterID = %d",Class))
- SQLFetch()
- MonsterID = SQLGetNumber("MonsterID")
- SQLClose()
- if(MonsterID == Class) then
- SQLQuery(string.format("UPDATE MUCMS_TRIGGER_MONSTER SET Count = Count + 1, LastKilled = getdate() WHERE MonsterID = %d",Class))
- SQLFetch()
- SQLClose()
- else
- 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))
- SQLFetch()
- SQLClose()
- end
- end
- BridgeFunctionAttach("OnReadScript","TriggerMonster_OnReadScript");
- function TriggerMonster_OnReadScript()
- SystemMain.Boss = {275,561,459,673,716,734,746,794,735};
- LogColor(1,"[ValkyrieScript] TriggerMonster Carregado!!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement