Concepts/Entities_are_handles

Players, vehicles, objects, pickups, spheres, blips, NPCs and traffic are handle objects. They are tiny references to the real entity; they stay valid as long as the entity exists. You read and write properties with . and call methods with ():

local p = FindPlayer(0);          // handle for player id 0, or null
if (p)
{
    p.Health = 100.0;            // set a property
    local where = p.Pos;         // get a property (a Vector)
    p.SetWeapon(WEP_UZI, 200);   // call a method
}
Categories: Core concepts