If I want to disable using the toolgun on props other than the owner,
is this all that i need?
function CPP.CanTool( ply, tr, tool )
if ( tr.Entity():GetOwner()==ply:Nick() ) then
return true
elseif (ply:IsAdmin() and GetConVar( "CPP_AdminCanDoAll" ):GetInt() == 1) then
return true
else
return false
end
end
http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.GetOwner)** doesn’t return the prop protection owner like you assume here. Other than that, the code would fail if the player used a tool on the ground because tr.Entity will be nil in that case. Also, with your code it would still be impossible for admins to use tools on other people’s props, because you still check if the admin is the owner.
I recommend Overv’s method, because what happens if a player string escapes their name? Or if they just simply change it? Networked entities is the most reliable method.