aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/sh_npcmap.lua
blob: 5c6d93cce8196f4555ec7b5aab64450ca34c2a5f (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
27
local pmeta = FindMetaTable("Player")

if SERVER then
    util.AddNetworkString("addmapicon")
end

function pmeta:AddMapIcon(icon,position)
    print("adding map icon")
    net.Start("addmapicon")
    net.WriteString(icon)
    net.WriteVector(position)
    net.Send(self)
end

if CLIENT then
    net.Receive("addmapicon",function()
        print("got recieve for map icon")
        LocalPlayer().MapIcons = LocalPlayer().MapIcons or {}
        local matstr = net.ReadString()
        local matpos = net.ReadVector()
        table.insert(LocalPlayer().MapIcons,{
            ["material"] = Material(matstr),
            ["pos"] = matpos,
        })
    end)
end