Kijan

remove Player

Apr 30th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. function onLoad(save_state)
  2.   self.createButton({
  3.     click_function = "removePlayer",
  4.     function_owner = self,
  5.     label          = "",
  6.     position       = {0,0.05,0},
  7.     color          = {0, 0, 0, 0},
  8.     width          = 2400,
  9.     height         = 600
  10.   })
  11. end
  12.  
  13. function removePlayer()
  14.   local posSelf = self.getPosition()
  15.   local pos = {x = posSelf.x, y = posSelf.y - 0.05, z = posSelf.z - 8.17}
  16.   local bagPos = {pos.x + 0.62, pos.y + 1, pos.z - 33}
  17.   local hittedBag = false
  18.   local zone
  19.   if pos.x < -20 then
  20.     zone = "49a4e0"
  21.   elseif pos.x < 0 then
  22.     zone = "dac936"
  23.   elseif pos.x < 20 then
  24.     zone = "62cd94"
  25.   else
  26.     zone = "963318"
  27.   end
  28.  
  29.   for i,j in pairs(getObjectFromGUID(zone).getObjects()) do
  30.     if j.tag == "Bag" then
  31.       j.setPosition({pos.x, pos.y + 1, -28})
  32.       hittedBag = j
  33.     end
  34.   end
  35.  
  36.   for u,v in pairs(getObjectFromGUID(zone).getObjects()) do
  37.     if hittedBag then
  38.       if v.getGUID() ~= "dff000" and v.getGUID() ~= "42d2b6" and v ~= self then
  39.         hittedBag.putObject(v)
  40.       end
  41.     else
  42.       if v.getName():find("Player Mat") then
  43.         v.destruct()
  44.       end
  45.     end
  46.   end
  47.   self.setState(1)
  48. end
Add Comment
Please, Sign In to add comment