Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local killCoordinator = {}
- local allowedClasses = {"CLeggedCharacterEntity"}
- local amount = 10
- -- entity : CLeggedCharacterEntity
- local handleEntity = function(entity)
- RunHandled(
- function()
- while not IsDeleted(entity) do
- Wait(CustomEvent("OnStep"))
- end
- end,
- -- kev : CDiedScriptEvent
- On(Event(entity.Died)),
- function(kev)
- local player = kev:GetKillerPlayer()
- if player ~= nil then
- if killCoordinator[player] == nil then
- killCoordinator[player] = 0
- end
- killCoordinator[player] = killCoordinator[player] + 1
- if killCoordinator[player] >= amount then
- SignalEvent("AmountReached", player)
- end
- end
- end
- )
- end
- RunHandled(
- function()
- WaitForever()
- end,
- -- ev : CEntitySpawnedScriptEvent
- -- entity : CBaseEntity
- OnEvery(CustomEvent("EntitySpawned")),
- function(ev)
- local entity = ev:GetSpawnedEntity()
- local class = entity:GetClassName()
- local hasFound = false
- for i = 1, #allowedClasses, 1 do
- if allowedClasses[i] == class then
- hasFound = true
- break
- end
- end
- if hasFound then
- RunAsync(
- function()
- handleEntity(entity)
- end
- )
- end
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement