# DNumberWang:OnValueChanged

- **Ortam:** İstemci, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/DNumberWang:OnValueChanged
- **Çeviri tarihi:** 2025-09-08

```lua
DNumberWang:OnValueChanged( number val )
```

## Açıklama

Sayı seçicinin değeri değiştirildiğinde çağrılır.

## Argümanlar

1. [number](https://gmod.tr/wiki/number) **val**: Sayı seçicinin yeni değeri.

### Örnek

Her bir sayı seçicinin yeni değerine göre bir erkek soru ses baytı ve bir kadın cevap ses baytı çalan, iki sayı seçicili bir panel oluşturur.

```lua
-- Arka plan paneli
BGPanel = vgui.Create("DPanel")
BGPanel:SetPos(20, 20)
BGPanel:SetSize(100, 55)

-- İfade etiketi
local lbl1 = vgui.Create("DLabel", BGPanel)
lbl1:SetPos(5, 5)
lbl1:SetSize(100, 20)
lbl1:SetText("Statement: ")
lbl1:SetColor(Color(64, 64, 255))

-- Yanıt etiketi
local lbl2 = vgui.Create("DLabel", BGPanel)
lbl2:SetPos(5, 30)
lbl2:SetSize(100, 20)
lbl2:SetText("Response: ")
lbl2:SetColor(Color(255, 0, 255))

-- "Sorular" için sayı seçici
local question = vgui.Create("DNumberWang", BGPanel)
question:SetPos(65, 5)
question:SetSize(30, 20)
question:SetMinMax(1, 30)

-- Cevaplar için sayı seçici
local answer = vgui.Create("DNumberWang", BGPanel)
answer:SetPos(65, 30)
answer:SetSize(30, 20)
answer:SetMinMax(1, 40)

-- Bu, üst üste binen konuşmaları önlemek için kullanılır
local null = Sound("common/null.wav")

-- Soyutlama = daha temiz kod
function TalkSound(snd)
	EmitSound(snd, LocalPlayer():GetPos(), LocalPlayer():EntIndex(), CHAN_VOICE, 1, 80, 0, 100)
end

-- Yeni sayıya göre bir ifade oynat
function question:OnValueChanged(val)
	TalkSound(null)
	TalkSound(Sound("vo/npc/male01/question"..string.format("%02d", val)..".wav"))
end

-- Yeni sayıya göre bir cevap oynat
function answer:OnValueChanged(val)
	TalkSound(null)
	TalkSound(Sound("vo/npc/female01/answer"..string.format("%02d", val)..".wav"))
end
```

- [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/DNumberWang:OnValueChanged
