engine
This namespace provides methods that allow you to interact with the iw3 engine through Anvil.
Last updated
This namespace provides methods that allow you to interact with the iw3 engine through Anvil.
Last updated
engine.addEventListener(name, callable)
event
- The type of event you want to listen for
callable
- A defined function or a lambda
This method registers a eventlistener for the specified event, that is a function that will be executed every time the event occurs.
Example:
This will print whats up
every time a new frame is rendered.
render
- Emitted when a new frame is being rendered
onBeforeEndScene
- Emitted right before a new frame is being rendered
onAfterEndScene
- Emitted after a new frame has been rendered
onBeforeCL_WritePacket
- Emitted right before the game sends a packet to the server
onAfterCL_CreateNewCommands
- Emitted after a new user command has been created
onLoad
- Emitted when you load your position
onSave
- Emitted when you save your position
onBounce
- Emitted when you bounce
engine.removeEventListener(name)
event
- The name of the event you dont want to listen/react to anymore
Removes a previously attachted event listener by the name of the event.
Example:
engine.removeAllEventListeners()
Removes all attached event listeners for the current script.
Example:
engine.getServerName()
Returns the name of the server you're currently connected to.
Example:
engine.getPlayerState()
Example:
engine.getRefDef()
Example:
engine.getCG()
Example:
engine.getUserCmd()
Example:
engine.getPreviousUserCmd()
Example:
engine.execCommand(command)
command
- A console command to execute
Executes the given command
Example:
engine.getPlayerList()
Example:
engine.getLocalClientEntity()
Example:
engine.getClosestPlayer()
Example:
engine.isVisible(target)
Returns true if target is visible from your currnent position, false otherwise.
Example:
engine.trace(start, end)
Example:
engine.getForwardVector(viewangles)
Example:
engine.angle2short(angle)
Converts the decimal angle to a 2 byte integer representation.
Example:
engine.short2angle(short)
Converts a 2 byte integer representation of an angle back to a float.
Example:
engine.getWindowSize()
Example:
engine.notify(message)
Displays a notification on the right hand side of the screen with the given message.
Example:
engine.disconnect()
Disconnect from current server.
Example:
engine.setStat(id, value)
Sets a stat id to a given value (Equivalent of GSC player setStat).
id
- The id of the stat
value
- The value you wish to set
Example:
engine.isVisible(target)
Returns true if target is visible from your currnent position, false otherwise.
Example:
engine.getScriptId()
Returns the id of the current script. Use this to uniquely identify your script. Useful for ImGui Window ID's etc.
Example:
Returns the predicted .
Returns the object.
Returns the object.
Returns the latest .
Returns the previous . Use previous user cmd's for silent stuff.
Returns a list of players in the server as a list of 's
Returns the for yourself.
Returns the closest player as a
target
- The position as a to check if it is visible
Performs a ray trace from start to end and returns a object.
Obtain the forward vector as a from the given viewangles as a
Returns the CoD4 window size as a
target
- The position as a to check if it is visible