# NPC:GetNPCState

- **Ortam:** Sunucu
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/NPC:GetNPCState
- **Çeviri tarihi:** 2025-09-08

```lua
number NPC:GetNPCState()
```

## Açıklama

NPC'nin durumunu döndürür.

## Döndürdükleri

1. [number](https://gmod.tr/wiki/number): NPC'nin mevcut durumu, bakınız [NPC_STATE enum](https://gmod.tr/wiki/Enums/NPC_STATE).

### Örnek

Sunucu konsoluna boşta duran NPC'lerin bir listesini yazdıran fonksiyon.

```lua
function ReportIdleNPCs()
	for i, npc in ipairs( ents.FindByClass( "npc_*" ) ) do
		if IsValid( npc ) and npc:IsNPC() and npc:GetNPCState() == NPC_STATE_IDLE then
			print( "Ent #" .. npc:EntIndex() .. ": " .. npc:GetClass() .. " is idle." )
		end
	end
end
```

**Çıktı:** (Sunucu konsoluna)

Ent #111: npc_citizen is idle.

Ent #120: npc_citizen is idle.

Ent #122: npc_citizen is idle.

Ent #124: npc_citizen is idle.

- [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/NPC:GetNPCState
