Advertisement
Guest User

Untitled

a guest
Jul 7th, 2014
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. ---- Shared corpsey stuff
  2.  
  3. CORPSE = CORPSE or {}
  4.  
  5. -- Manual datatable indexing
  6. CORPSE.dti = {
  7. BOOL_FOUND = 0,
  8.  
  9. ENT_PLAYER = 0,
  10.  
  11. INT_CREDITS = 0
  12. };
  13.  
  14. local dti = CORPSE.dti
  15. --- networked data abstraction
  16. function CORPSE.GetFound(rag, default)
  17. return rag and rag:GetDTBool(dti.BOOL_FOUND) or default
  18. end
  19.  
  20. function CORPSE.GetPlayerNick(rag, default)
  21. if not IsValid(rag) then return default end
  22.  
  23. local ply = rag:GetDTEntity(dti.ENT_PLAYER)
  24. if IsValid(ply) then
  25. return ply:Nick()
  26. else
  27. return rag:GetNWString("nick", default)
  28. end
  29. end
  30.  
  31. function CORPSE.GetPlayerID(rag, default)
  32. if not IsValid(rag) then return default end
  33.  
  34. local ply = rag:GetDTEntity(dti.ENT_PLAYER)
  35. if IsValid(ply) then
  36. return ply:SteamID()
  37. else
  38. return ""
  39. end
  40. end
  41.  
  42. function CORPSE.GetCredits(rag, default)
  43. if not IsValid(rag) then return default end
  44. return rag:GetDTInt(dti.INT_CREDITS)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement