How to do this code when before the player actually disconnects

How would i do this code before the player actually disconnects.

[lua]
if ply.copcar and ValidEntity( ply.copcar ) then ply.copcar:Remove() end
[/lua]

With kind regards,
Wesley

[lua]
hook.Add( “PlayerDisconnected”, “RemoveCopCar”, function( ply )

if ply.copcar and ValidEntity( ply.copcar ) then ply.copcar:Remove() end

end )
[/lua]

(Sorry I didn’t answer on Steam by the way)

Ahh it works now thankyou.
Lol don’t worry your dont have to respond XD i ask it.