Garry's Mod Wiki

Revision Difference

Entity:GetRagdollOwner#527904

<function name="GetRagdollOwner" parent="Entity" type="classfunc"> <description>Returns the entity which the ragdoll came from. The opposite of <page>Player:GetRagdollEntity</page>.</description> <realm>Shared</realm> <rets> <ret name="" type="Entity">The entity who owns the ragdoll.</ret> </rets> </function> <example> <description>Loop through all player ragdolls and print their owners.</description> <description>Loop through all player ragdolls and print their owners (clientside).</description> <code> for e, ent in pairs( ents.GetAll() ) do if( IsValid( ent:GetRagdollOwner() ) ) then for _, ent in ipairs( ents.FindByClass( "class C_HL2MPRagdoll" ) ) do if ( IsValid( ent:GetRagdollOwner() ) ) then print( ent:GetRagdollOwner() ) end end </code> <output> While a player is dead and their ragdoll is spawned this returns: Player [1][PlayerName] </output> ⤶ </example></example>