Render Target Problems.

I’m trying to do some render targets, It’s not working correctly.
Also, It screws up some 3d2d things.

HELP! JOHN LUA! Give me the solutions!

http://i.imgur.com/eYaektq.jpg[/thumb]
[thumb]http://i.imgur.com/i6GBGcO.jpg[/thumb]
[thumb]http://i.imgur.com/Qpg8rki.jpg

[lua]
local vec = Vector(-1188.096802, 933.399597, 937.080505)
local ang = Angle( 90, 0, 0 )
local rsize = 256
local size = 200
local camdat = {}
local rendertarget = GetRenderTarget( “BlackTea_RTCAM”, 256, 256 )
local w, h = ScrW(), ScrH()
local material = CreateMaterial(“blacktea_rtmat”, “UnlitGeneric”, {
["$ignorez"] = 1,
["$vertexcolor"] = 1,
["$vertexalpha"] = 1,
["$nolod"] = 1,
["$basetexture"] = rendertarget:GetName()
})

local function updatert()
local old_rendertarget = render.GetRenderTarget()

camdat.origin = Vector(-1188.096802, 933.399597, 1237.080505)
camdat.angles = Angle( 0, 0, 90 )
camdat.fov = 50
camdat.w = rsize
camdat.h = rsize
camdat.x = 0
camdat.y = 0
camdat.drawviewmodel = false
camdat.drawhud = false
camdat.drawmonitors = false
camdat.dopostprocess = false
camdat.orth = false
render.SetRenderTarget( rendertarget ) // Change the RenderTarget, so all drawing will be redirected to our new RT
	render.SetViewPort( 0, 0, rsize, rsize )	
	render.Clear(0,0,0,255,true,true)
	--render.RenderView(camdat)
	render.SetViewPort( 0, 0, w, h )
render.SetRenderTarget( old_rendertarget ) // Resets the RenderTarget to our screen
material:SetTexture("$basetexture", rendertarget)

end
hook.Add(“Think”, “likethis?”, updatert )

local function drawrt()
cam.Start3D2D(vec, ang, 0.25)
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawRect( -size/2, -size/2, size, size )
surface.SetMaterial( material )
surface.DrawTexturedRect( -size/2, -size/2, size, size )

	surface.SetDrawColor( 255, 0, 0 )
	surface.DrawLine( -size/2, 0, size/2, 0 )
	surface.DrawLine( 0, -size/2, 0, size/2 )
cam.End3D2D()

end
hook.Add(“PreDrawTranslucentRenderables”, “dodo”, drawrt )
[/lua]