SetEntProp Function

Sets an integer value in an entity's property.

This function is considered safer and more robust over SetEntData, because it performs strict offset checking and typing rules.

void SetEntProp(int entity, PropType type, const char[] prop, any value, int size, int element)

Parameters

int entity

Entity/edict index.

PropType type

Property type.

const char[] prop

Property name.

any value

Value to set.

int size

Number of bytes to write (valid values are 1, 2, or 4). This value is auto-detected, and the size parameter is only used as a fallback in case detection fails.

int element

Element # (starting from 0) if property is an array.

Errors

Invalid entity or offset out of reasonable bounds.