[del]Whenever a player dies, I would like to network their ragdoll to them. Currently, a client does not know which ragdoll is theirs until someone searches the body. I've attempted to send ply.server_ragdoll:EntIndex() as an unsigned 16-bit int, and then get the entity by printing Entity( uint ) on the client in net.Receive(), however it returns a null entity. I've printed the uint to verify the int and then attempted to print `Entity( uint )` outside of the net.Receive() and it printed the ragdoll succesfully. I'm totally out of ideas and checked out how ttt does it, attempted to replicate it, but I'm obviously missing something.
What lead me to it:
[I]cl_search.lua[/I]
[CODE]
local function StoreSearchResult(search)
if search.owner then
-- if existing result was not ours, it was detective's, and should not
-- be overwritten
local ply = search.owner
if (not ply.search_result) or ply.search_result.show then
ply.search_result = search
-- this is useful for targetid
local rag = Entity(search.eidx)
if IsValid(rag) then
rag.search_result = search
end
end
end
end
[/CODE]
[CODE]local rag = Entity(search.eidx)[/CODE]
search.eidx is the ragdolls entity index sent to the client from the server.
In [I]player.lua[/I], ply.server_ragdoll is set to the created ragdoll:
[CODE]
-- Create ragdoll and hook up marking effects
local rag = CORPSE.Create(ply, attacker, dmginfo)
ply.server_ragdoll = rag -- nil if clientside
[/CODE]
Any ideas?[/del]
Solved it.
The issue: By time it was being called, the ragdoll wasn't actually existing client-side. >.>
Sorry, you need to Log In to post a reply to this thread.