Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- corpses = corpses or {}
- corpses.list= corpses.list or {}
- corpses.count = corpses.count or 0
- function corpses.init()
- local temp = gmcp.Char.Items.List
- if temp.location == "inv" then
- corpses.list = {}
- corpses.count = 0
- for k, v in ipairs(temp.items) do
- if v.icon == "deadbody" then
- table.insert(corpses.list,v.id)
- end
- end
- raiseEvent("corpse_update")
- corpses.count = #corpses.list
- end
- end
- function corpses.addInv()
- local temp = gmcp.Char.Items.Add
- if temp.location=="inv" and temp.item.icon =="deadbody" then
- table.insert(corpses.list,temp.item.id)
- corpses.count= #corpses.list
- raiseEvent("corpse_update")
- end
- end
- function corpses.removeInv()
- temp = gmcp.Char.Items.Remove
- if temp.location=="inv" and table.contains(corpses.list,temp.item.id) then
- for k, item in ipairs(corpses.list) do
- if item==temp.item.id then
- table.remove(corpses.list,k)
- corpses.count = #corpses.list
- raiseEvent("corpse_update")
- if temp.item.icon ~="deadbody" then
- raiseEvent("respawned",temp.item.name)
- end
- return
- end
- end
- end
- end
- function corpses.clear()
- corpses.list = {}
- corpses.count = 0
- raiseEvent("corpse_update")
- end
- registerAnonymousEventHandler("gmcp.Char.Items.List", "corpses.init")
- registerAnonymousEventHandler("sysDisConnectionEvent","corpses.clear")
- registerAnonymousEventHandler("gmcp.Char.Items.Add", "corpses.addInv")
- registerAnonymousEventHandler("gmcp.Char.Items.Remove", "corpses.removeInv")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement