Advertisement
Clotic

DeleteObjectNearby

Jul 7th, 2020 (edited)
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.67 KB | None | 0 0
  1. -- obd deletes object and you get info
  2. -- obc check info will not delete the item
  3. local MSG_OBD = "#obd" -- What Message in chat box
  4. local MSG_OBC = "#obc" -- What Message in chat box
  5.  
  6. local RANGE = 10 -- What range you want the delete to detect in.
  7.  
  8. -------------------------------------------------------------------------
  9. local function DeleteObjectNearby(event, player, msg, _, lang)
  10.     local gmRank = player:GetGMRank()
  11.     if (gmRank >= 3) then -- change number (0-3) 0 - to all  1,2,3 GM with rank
  12.  
  13.         if (msg:find(MSG_OBD)) or (msg:find(MSG_OBC)) then
  14.             if not player:GetNearestGameObject(RANGE) then
  15.                 player:SendBroadcastMessage("There is nothing except the void.")
  16.                 return false
  17.             end
  18.             local a = player:GetNearestGameObject(RANGE)
  19.             local b = a:GetEntry()
  20.             local c = a:GetDisplayId()
  21.             local d = a:GetName()
  22.            
  23.             if (msg:find(MSG_OBD)) then
  24.                
  25.                 a:RemoveFromWorld(true)
  26.                
  27.                 player:SendBroadcastMessage(
  28.                     "|cFFffffff Name: |r " ..
  29.                     d .. " |cFFffffff Entry Deleted: |r  " .. b .. " |cFFffffff Display ID: |r " .. c .. ""
  30.                 )
  31.                 return false
  32.             elseif (msg:find(MSG_OBC)) then
  33.                 player:SendBroadcastMessage(
  34.                     "|cFFffffff Name: |r " ..
  35.                     d .. " |cFFffffff Entry:|r  " .. b .. " |cFFffffff Display ID: |r " .. c .. ""
  36.                 )
  37.                 return false
  38.             end
  39.         end
  40.    
  41.     end
  42. end
  43.  
  44.  
  45. RegisterPlayerEvent(18, DeleteObjectNearby)
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement