Es getplayerhandle

From EventScripts Community Encyclopedia


Overview

Syntax: es_getplayerhandle <variable> <userid>

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: es_xgetplayerhandle

Description

Returns the hOwner property of userid and puts it in variable.

Parameters

  • variable - the variable which should contain the hOwner property value.
  • userid - the userid of player who's hOwner property is wanted.


Examples

block load
{
   es_xload corelib
   es_xdoblock corelib/noisy_on
}
 
block unload
{
   es_xdoblock corelib/noisy_off
}
 
event bullet_impact
{
   // Modified version of Wonder's RocketGuns script for ES v1.2.
 
   // Create an explosion.
   es_give event_var(userid) env_explosion
   es_fire event_var(userid) env_explosion addoutput "imagnitude 100"
 
   // Set the location to that of the bullet.
   es_xsetinfo coords 0
   es_format coords "origin %1 %2 %3" event_var(x) event_var(y) event_var(z)
   es_fire event_var(userid) env_explosion addoutput server_var(coords)
 
   // Set the owner to the shooter.
   es_xsetinfo owner 0
   es_getplayerhandle owner event_var(userid)
   es_setindexprop server_var(eventscripts_lastgive) CBaseEntity.m_hOwnerEntity server_var(owner)
 
   // Cause the explosion!
   es_fire event_var(userid) env_explosion explode
}


Notes

  • The hOwner property is NOT the same as the entity index or userid!
  • es_getplayerhandle is only in EventScripts v1.2 or higher


See also

blog comments powered by Disqus