Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1.  
  2. properties.Add( 'remove', {
  3. MenuLabel = '#remove',
  4. Order = 1000,
  5. MenuIcon = 'icon16/delete.png',
  6.  
  7. Filter = function( self, ent, ply )
  8.  
  9. if ( !gamemode.Call( 'CanProperty', ply, 'remover', ent ) ) then return false end
  10. if ( !IsValid( ent ) ) then return false end
  11. if ( ent:IsPlayer() ) then return false end
  12.  
  13. return true
  14.  
  15. end,
  16.  
  17. Action = function( self, ent )
  18.  
  19. self:MsgStart()
  20. net.WriteEntity( ent )
  21. self:MsgEnd()
  22.  
  23. end,
  24.  
  25. Receive = function( self, length, player )
  26.  
  27. local ent = net.ReadEntity()
  28. local touch = FPP.plyCanTouchEnt(player, ent, 4)
  29.  
  30. if ( !IsValid( ent ) ) then return false end
  31. if ( !IsValid( player ) ) then return false end
  32. if ( ent:IsPlayer() ) then return false end
  33. if ( !self:Filter( ent, player ) ) then return false end
  34. if ( !touch ) then
  35. RunConsoleCommand('ulx','asay', player:Nick() .. ' ' .. player:SteamID() .. ' tried to remove an entity they don\'t own via properties.')
  36. return false
  37. end
  38.  
  39. -- Remove all constraints (this stops ropes from hanging around)
  40. constraint.RemoveAll( ent )
  41.  
  42. -- Remove it properly in 1 second
  43. timer.Simple( 1, function() if ( IsValid( ent ) ) then ent:Remove() end end )
  44.  
  45. -- Make it non solid
  46. ent:SetNotSolid( true )
  47. ent:SetMoveType( MOVETYPE_NONE )
  48. ent:SetNoDraw( true )
  49.  
  50. -- Send Effect
  51. local ed = EffectData()
  52. ed:SetEntity( ent )
  53. util.Effect( 'entity_remove', ed, true, true )
  54.  
  55. player:SendLua( 'achievements.Remover()' )
  56.  
  57. end
  58.  
  59. } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement