1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
function CPPI:GetName()
return "Simple Prop Protection"
end
function CPPI:GetVersion()
return SPropProtection.Version
end
function CPPI:GetInterfaceVersion()
return 1.1
end
function CPPI:GetNameFromUID( uid )
return CPPI_NOTIMPLEMENTED
end
local Player = FindMetaTable( "Player" )
if ( !Player ) then print( "EXTREME ERROR 1" ) return end
function Player:CPPIGetFriends()
if ( SERVER ) then
local Table = {}
for k, v in pairs( player.GetAll() ) do
if ( table.HasValue( SPropProtection[ self:SteamID() ], v:SteamID() ) ) then table.insert( Table, v ) end
end
return Table
else
return CPPI_NOTIMPLEMENTED
end
end
local Entity = FindMetaTable( "Entity" )
if ( !Entity ) then print( "EXTREME ERROR 2" ) return end
function Entity:CPPIGetOwner()
local Player = self:GetNetworkedEntity( "OwnerObj", false )
if ( SERVER ) then Player = SPropProtection[ "Props" ][ self:EntIndex() ][ 3 ] end
if ( !IsValid( Player ) ) then return nil, CPPI_NOTIMPLEMENTED end
local UID = CPPI_NOTIMPLEMENTED
if ( SERVER ) then UID = Player:UniqueID() end
return Player, UID
end
if ( SERVER ) then
function Entity:CPPISetOwner( ply )
if ( !IsValid( ply ) or !ply:IsPlayer() ) then return false end
return SPropProtection.PlayerMakePropOwner( ply, self )
end
function Entity:CPPISetOwnerUID( uid )
if ( !uid ) then return false end
local ply = player.GetByUniqueID( tostring( uid ) )
if ( !ply ) then return false end
return SPropProtection.PlayerMakePropOwner( ply, self )
end
function Entity:CPPICanTool( ply, toolmode )
if ( !IsValid( ply ) or !ply:IsPlayer() or !toolmode ) then return false end
return SPropProtection.PlayerCanTouch( ply, self )
end
function Entity:CPPICanPhysgun( ply )
if ( !IsValid( ply ) or !ply:IsPlayer() ) then return false end
if ( SPropProtection.PhysGravGunPickup( ply, self ) == false ) then return false end
if ( self:GetClass() == "gms_gravestone" ) then return false end
return true
end
function Entity:CPPICanPickup( ply )
if ( !IsValid( ply ) or !ply:IsPlayer() ) then return false end
if ( SPropProtection.PhysGravGunPickup( ply, self ) == false ) then return false end
return true
end
function Entity:CPPICanPunt(ply)
if ( !IsValid( ply ) or !ply:IsPlayer() ) then return false end
if ( SPropProtection.PhysGravGunPickup( ply, self ) == false ) then return false end
return true
end
end
hook.Add( "Initialize", "CPPIInitGM", function()
function GAMEMODE:CPPIAssignOwnership( ply, ent )
end
function GAMEMODE:CPPIFriendsChanged( ply, ent )
end
end )
|