Hey everyone!
I am trying to make an entity (NPC in this case) popup a panel for the player who uses the entity.
Ex: I press E looking at the NPC (being close to it) and a derma menu should pop up, etc...
[B]Code:[/B]
[I]Entity -> init.lua ::[/I]
[CODE]
function ENT:Use(activator, caller)
net.Start("npc_base")
net.Send(activator) //I have tried using caller instead. Didn't work.
end
[/CODE]
[I]Gamemode -> clientside ::[/I]
[CODE]
net.Receive("npc_base", function(len, caller)
caller:PrintMessage(HUD_PRINTTALK, "npc_base was used!")
print("npc_base was used!")
end)
[/CODE]
1. I have added the network string (util.AddNetworkString)
2. I have tried sending the net message to both the caller and the activator (nothing worked)
Still, no message is sent...
If you need any other pieces of the code, let me know ;)
Any help is appreciated! :D
- Fillipuster
[QUOTE=Fillipuster;47184087]Hey everyone!
I am trying to make an entity (NPC in this case) popup a panel for the player who uses the entity.
Ex: I press E looking at the NPC (being close to it) and a derma menu should pop up, etc...
[B]Code:[/B]
[I]Entity -> init.lua ::[/I]
[CODE]
function ENT:Use(activator, caller)
net.Start("npc_base")
net.Send(activator) //I have tried using caller instead. Didn't work.
end
[/CODE]
[I]Gamemode -> clientside ::[/I]
[CODE]
net.Receive("npc_base", function(len, caller)
caller:PrintMessage(HUD_PRINTTALK, "npc_base was used!")
print("npc_base was used!")
end)
[/CODE]
1. I have added the network string (util.AddNetworkString)
2. I have tried sending the net message to both the caller and the activator (nothing worked)
Still, no message is sent...
If you need any other pieces of the code, let me know ;)
Any help is appreciated! :D
- Fillipuster[/QUOTE]
Did you network it, So do util.AddNetworkedstring("themssagenamehere")
Also for npc's I dont use ENT:Use() I do
[CODE]function ENT:AcceptInput(name, activator, caller)
end[/CODE]
That will be fired when a player or npc uses it, caller being the player
[QUOTE=0V3RR1D3;47184194]Did you network it, So do util.AddNetworkedstring("themssagenamehere")
Also for npc's I dont use ENT:Use() I do
[CODE]function ENT:AcceptInput(name, activator, caller)
end[/CODE]
That will be fired when a player or npc uses it, caller being the player[/QUOTE]
That did the tick. Thanks a lot man :D
Sorry, you need to Log In to post a reply to this thread.