VERGELua API

Entity

In-game entity: players, weapons, buildings, props.

ent:IsValid():boolean

Whether the entity is valid.

ent:IsNull():boolean

Whether the wrapped pointer is null.

ent:GetIndex():number

Entity index.

ent:GetClassId():number

Network class ID.

ent:GetClassName():string

Network class name string.

ent:GetTeam():number

Team number.

ent:GetTeamNumber():number

Team number; alias of GetTeam.

ent:GetAbsOrigin():Vector3

World position of the entity.

ent:GetAbsAngles():Vector3

World angles of the entity.

ent:GetCenter():Vector3

Center of the entity's bounds.

ent:GetEyePosition():Vector3

Eye position for players.

ent:GetShootPos():Vector3

Muzzle or eye position used to fire.

ent:IsDormant():boolean

Whether the entity is dormant.

ent:IsPlayer():boolean

Whether the entity is a player.

ent:IsBuilding():boolean

Whether the entity is a building.

ent:IsProjectile():boolean

Whether the entity is a projectile.

ent:IsNPC():boolean

Whether the entity is an NPC.

ent:IsWeapon():boolean

Whether the entity is a weapon.

ent:IsAlive():boolean

Whether the entity is alive.

ent:GetHealth():number

Current health.

ent:GetMaxHealth():number

Maximum health.

ent:GetClass():string

Client class string, for example CTFPlayer.

ent:GetVelocity():Vector3

Current velocity.

ent:GetEyeAngles():Vector3

Eye angles for players.

ent:InCond(cond:number):boolean

Whether the player has a condition flag set.

ent:IsInvisible():boolean

Whether the player is invisible.

ent:IsUbered():boolean

Whether the player is ubercharged.

ent:IsCritBoosted():boolean

Whether the player is crit boosted.

ent:IsMiniCritBoosted():boolean

Whether the player is minicrit boosted.

ent:IsTaunting():boolean

Whether the player is taunting.

ent:GetCritMult():number

Current crit multiplier.

ent:GetPropInt(name:string, table?:string):number

Read an int netvar by name; nil when absent.

ent:GetPropFloat(name:string, table?:string):number

Read a float netvar by name; nil when absent.

ent:GetPropBool(name:string, table?:string):boolean

Read a bool netvar by name; nil when absent.

ent:GetPropVector(name:string, table?:string):Vector3

Read a vector netvar by name; nil when absent.

ent:GetPropString(name:string, table?:string):string

Read a string netvar by name; nil when absent.

ent:GetPropEntity(name:string):Entity

Read an entity netvar by name.

ent:GetPropDataTableInt(name:string):number

Alias of GetPropInt.

ent:GetPropDataTableFloat(name:string):number

Alias of GetPropFloat.

ent:GetPropDataTableBool(name:string):boolean

Alias of GetPropBool.

ent:GetPropDataTableVector(name:string):Vector3

Alias of GetPropVector.

ent:GetPropDataTableString(name:string):string

Alias of GetPropString.

ent:SetPropInt(name:string, value:number):boolean

Write an int netvar; false when not found.

ent:SetPropFloat(name:string, value:number):boolean

Write a float netvar; false when not found.

ent:SetPropBool(name:string, value:boolean):boolean

Write a bool netvar; false when not found.

ent:SetPropVector(name:string, value:Vector3):boolean

Write a vector netvar; false when not found.

ent:GetName():string

Player name string.

ent:GetMins():Vector3

Minimum of the entity's bounding box.

ent:GetMaxs():Vector3

Maximum of the entity's bounding box.

ent:GetMoveType():number

Move type constant.

ent:EstimateAbsVelocity():Vector3

Estimated absolute velocity.

ent:SetAbsOrigin(pos:Vector3)

Teleport the entity to a position.

ent:SetAbsAngles(ang:Vector3)

Set the entity's world angles.

ent:GetModel():Model

The entity's model.

ent:SetModel(path:string):boolean

Swap the entity's model; false when the model index is unknown.

ent:GetVAngles():Vector3

View angles of the entity.

ent:SetVAngles(ang:Vector3)

Set the entity's view angles.

ent:AddCond(cond:number)

Add a condition flag.

ent:RemoveCond(cond:number)

Remove a condition flag.

ent:IsInFreezecam():boolean

Whether the player is in freezecam.

ent:GetCarryingRuneType():number

Rune type the player is carrying.

ent:GetMaxBuffedHealth():number

Maximum health including overheal.

ent:GetInvisibility():number

Invisibility scaled to 0..255 (m_flInvisibility * 255).

ent:SetPropEntity(name:string, value:Entity)

Write an entity netvar.

ent:SetupBones(mask?:number, time?:number):table

Bone matrix for the entity at a time.

ent:GetHitboxes(time?:number):table

Hitbox list for the entity.

ent:IsMeleeWeapon():boolean

Whether the weapon is melee.

ent:IsMedigun():boolean

Whether the weapon is a medigun.

ent:IsShootingWeapon():boolean

Whether the weapon fires projectiles or bullets.

ent:CanRandomCrit():boolean

Whether the weapon can randomly crit.

ent:GetLoadoutSlot():number

Loadout slot of the weapon.

ent:GetWeaponID():number

TF weapon ID.

ent:IsViewModelFlipped():boolean

Whether the viewmodel is flipped.

ent:GetWeaponProjectileType():number

Projectile type the weapon fires.

ent:GetProjectileSpeed():number

Muzzle velocity of the projectile.

ent:GetProjectileGravity():number

Gravity scale applied to the projectile.

ent:GetWeaponSpread():number

Weapon spread value.

ent:GetWeaponBaseDamage():number

Base damage of the weapon.

ent:GetSwingRange():number

Melee swing range.

ent:GetCritTokenBucket():number

Crit token bucket value.

ent:GetCritCheckCount():number

Crit check counter.

ent:GetCritSeedRequestCount():number

Crit seed request counter.

ent:GetCurrentCritSeed():number

Current crit seed.

ent:GetRapidFireCritTime():number

Rapid fire crit time.

ent:GetLastRapidFireCritCheckTime():number

Last rapid fire crit check time.

ent:GetCritChance():number

Current crit chance.

ent:IsAttackCritical():boolean

Whether the next attack is a crit.

ent:GetWeaponData():table

Weapon data table, or nil when unavailable.

Examples

Read your weapon ammo

Press HOME to print your active weapon and its current clip.

callbacks.Register("CreateMove", function()
    if not input.IsButtonPressed(KEY_HOME) then return end

    local me = client.GetLocalPlayer()
    if not me:IsValid() then return end

    local wep = me:GetPropEntity("m_hActiveWeapon")
    if wep and wep:IsValid() then
        print(string.format("weapon: %s, clip %d/%d",
            wep:GetName(), wep:GetPropInt("m_iClip1"), wep:GetPropInt("m_iClip2")))
    end
end)