Python1320

Untitled

Sep 25th, 2010
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. if SERVER1 then
  2.     hook.Add("Tick", "UpdateGhosts", function()
  3.         for key, ply in pairs(player.GetAll()) do
  4.            
  5.             -- Send an ip to the second server
  6.             csrvmsg.Start("<ip to server2>")
  7.                
  8.                 -- Let them know this is about ghosts. Maybe this could be defined in Start..
  9.                 csrvmsg.String("Ghosts")
  10.                
  11.                 csrvmsg.String(ply:UniqueID())
  12.                 csrvmsg.Vector(ply:GetPos())
  13.                 csrvmsg.Angle(ply:EyeAngles())
  14.                
  15.             csrvmsg.End()
  16.         end
  17.     end)
  18. elseif SERVER2 then
  19.    
  20.     local ghosts = {}
  21.    
  22.     hook.Add("ReceiveCrossServerMessage", "UpdateGhosts", function(umr)
  23.                
  24.         -- If it's not about ghosts, ignore the message
  25.         if not umr:ReadString() == "Ghosts" then return end
  26.        
  27.         local id = umr:ReadString()
  28.         local pos = umr:ReadVector()
  29.         local ang = umr:ReadAngle()
  30.        
  31.         ghosts[id] = {pos = pos, ang = ang}
  32.        
  33.     end)
  34.    
  35. end
Advertisement
Add Comment
Please, Sign In to add comment