Player:GetAmmoCount

  number Player:GetAmmoCount( any ammotype )

Açıklama

Oyuncunun sahip olduğu mermi miktarını alır.

Argümanlar

1 any ammotype
Mermi türü. number (sayı) mermi ID'si veya string (metin) mermi adı olabilir.

Döndürülen Değerler

1 number
Oyuncunun yedekte sahip olduğu mermi miktarı.

Örnek

Oyuncunun o anda elinde tuttuğu silahın mermisini döndüren bir fonksiyon.

function GetAmmoForCurrentWeapon( ply ) if ( !IsValid( ply ) ) then return -1 end local wep = ply:GetActiveWeapon() if ( !IsValid( wep ) ) then return -1 end return ply:GetAmmoCount( wep:GetPrimaryAmmoType() ) end
Çıktı: 31

Örnek

Örnek kullanım. "pistol" mermi türünün ID'si 3'tür.

print( Entity( 1 ):GetAmmoCount( 3 ) ) print( Entity( 1 ):GetAmmoCount( "3" ) ) print( Entity( 1 ):GetAmmoCount( "pistol" ) )
Çıktı:
255 0 255

Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord