blob: 717e1b5042be5e9d0293227d31417f9e812d96f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
local meta = FindMetaTable("Player")
if (SERVER) then
util.AddNetworkString("DropItemReq")
function meta:DropItem(item,bAccount)
if ((!bAccount and !self:HasItem(item)) or (bAccount and !self:HasAccountItem(item))) then return end
if (bAccount) then self:RemoveAccountItem(item,1) return
else self:RemoveItem(item,1) end
SpawnWSItem(item,self:GetShootPos()+self:GetAimVector()*20)
end
net.Receive("DropItemReq",function(seq,pl) pl:DropItem(net.ReadString(),util.tobool(net.ReadBit())) end)
else
function RequestDropItem(item,bAccount)
net.Start("DropItemReq")
net.WriteString(item)
net.WriteBit(bAccount)
net.SendToServer()
end
end
|