# GM:PostPlayerDraw

- **Ortam:** İstemci
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/GM:PostPlayerDraw
- **Çeviri tarihi:** 2025-10-15

```lua
GM:PostPlayerDraw( Player ply, number flags )
```

## Açıklama

[PVS (Potansiyel Görünürlük Seti)](https://developer.valvesoftware.com/wiki/PVS) alanınızdaki bir oyuncu çizildikten sonra çağrılır.

> **NOT:** Bu, 3D renderlama ortamı sağlayan bir renderlama hook'udur.

## Argümanlar

1. [Player](https://gmod.tr/wiki/Player) **ply**: Çizilen oyuncu.
2. [number](https://gmod.tr/wiki/number) **flags**: Bu renderlama işlemi için kullanılan [STUDIO_](https://gmod.tr/wiki/Enums/STUDIO) bayrakları.

### Örnek

Her oyuncunun adını modelinin üzerinde gösterir.

```lua
local vectorpos = Vector( 0, 0, 85 ) -- kodu optimize etmek için önbelleğe alıyoruz
local function DrawName( ply )
	if ( !IsValid( ply ) ) then return end
	if ( ply == LocalPlayer() ) then return end -- Oyuncu sizseniz isim çizmeyin
	if ( !ply:Alive() ) then return end -- Oyuncunun hayatta olup olmadığını kontrol edin

	local Distance = LocalPlayer():GetPos():Distance( ply:GetPos() ) --Siz ve oyuncu arasındaki mesafeyi alın

	if ( Distance < 1000 ) then --Eğer mesafe 1000 birimden azsa, ismi çizecektir

		local offset = vectorpos
		local ang = LocalPlayer():EyeAngles()
		local pos = ply:GetPos() + offset + ang:Up()

		ang:RotateAroundAxis( ang:Forward(), 90 )
		ang:RotateAroundAxis( ang:Right(), 90 )

		cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )
			draw.DrawText( ply:GetName(), "HudSelectionText", 2, 2, team.GetColor(ply:Team()), TEXT_ALIGN_CENTER )
		cam.End3D2D()
	end
end
hook.Add( "PostPlayerDraw", "DrawName", DrawName )
```

### Örnek

Tüm oyunculara bir headcrab şapkası çizer.

```lua
local model = ClientsideModel( "models/headcrabclassic.mdl" )
model:SetNoDraw( true )

hook.Add( "PostPlayerDraw" , "manual_model_draw_example" , function( ply )
	if not IsValid(ply) or not ply:Alive() then return end

	local attach_id = ply:LookupAttachment('eyes')
	if not attach_id then return end

	local attach = ply:GetAttachment(attach_id)

	if not attach then return end

	local pos = attach.Pos
	local ang = attach.Ang

	model:SetModelScale(1.1, 0)
	pos = pos + (ang:Forward() * 2.5)
	ang:RotateAroundAxis(ang:Right(), 20)

	model:SetPos(pos)
	model:SetAngles(ang)

	model:SetRenderOrigin(pos)
	model:SetRenderAngles(ang)
	model:SetupBones()
	model:DrawModel()
	model:SetRenderOrigin()
	model:SetRenderAngles()

end )
```

**Çıktı:**

![4000_screenshots_20200509142006_1.jpg](https://gmod.tr/api/uploads/wiki/1ea6d1e5bfe1e438052c.jpg)

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/GM:PostPlayerDraw
