# SANDBOX:PlayerGiveSWEP

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

```lua
boolean SANDBOX:PlayerGiveSWEP( Player ply, string weapon, table spawninfo )
```

## Açıklama

Bir oyuncu Q menüsünden kendisine bir silah vermeye çalıştığında çağrılır. (Bir ikona sol fare ile tıklandığında)

[SANDBOX:PlayerSpawnSWEP](https://gmod.tr/wiki/SANDBOX:PlayerSpawnSWEP) ile karıştırılmamalıdır; bu fonksiyon, silah bir varlık olarak yerde oluşturulduğunda çağrılır.

## Argümanlar

1. [Player](https://gmod.tr/wiki/Player) **ply**: Kendine silah vermeye çalışan oyuncu.
2. [string](https://gmod.tr/wiki/string) **weapon**: Oyuncunun kendisine vermeye çalıştığı silahın sınıf adı.
3. [table](https://gmod.tr/wiki/table) **spawninfo**: Bu silahın silah listesi tablosu, [CCGiveSWEP](https://github.com/Facepunch/garrysmod/blob/c3801c10e1aacc4c114d81331f301c57bdcf5a52/garrysmod/gamemodes/sandbox/gamemode/commands.lua#L893) ve [weapons.Register](https://github.com/Facepunch/garrysmod/blob/c3801c10e1aacc4c114d81331f301c57bdcf5a52/garrysmod/lua/includes/modules/weapons.lua#L58)'a bakın.

## Döndürülen Değer

1. [boolean](https://gmod.tr/wiki/boolean): SWEP oyuncuya verilebilir mi

### Örnek

Yönetici olmayanların kendilerine silah vermesini engeller.

```lua
hook.Add( "PlayerGiveSWEP", "BlockPlayerSWEPs", function( ply, class, spawninfo )
	if ( not ply:IsAdmin() ) then
		return false
	end
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/SANDBOX:PlayerGiveSWEP
