Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RunHandled(WaitForever,
- OnEvery(CustomEvent("EntitySpawned")),
- function(payload)
- --payload : CEntitySpawnedScriptEvent
- if not IsDeleted(payload) then
- local entity = payload:GetSpawnedEntity()
- if (entity:GetClassName() == "CPlayerPuppetEntity") then
- while not IsDeleted(entity) do
- entity:SetHealth(entity:GetHealth() + 1)
- Wait(CustomEvent("OnStep"))
- end
- end
- end
- end)
- Note that here I have to check if the entity is not deleted *right* as it spawns, as it sometimes happens that by the time the event is caught, the entity is already deleted.
- I also have to check if it is the entity of the desired type to handle only those entities which I want to (in this case, player puppets).
Add Comment
Please, Sign In to add comment