player

This namespace provides methods that allow you to interact with your player.

Methods

player.getPosition()

Returns your position as a Vec3

Example:

player.setPosition(position)

position - The position you want to set

Sets your position to the given Vec3

Example:

player.getVelocity()

Returns your velocity as a Vec3.

Example:

player.setVelocity(velocity)

velocity - The velocity you want to set

Sets your velocity to the given Vec3

Example:

player.getView()

Returns your viewangles as a Vec3 in the following format

  1. pitch

  2. yaw

  3. roll

Example:

player.setView(viewAngles)

  • viewAngles - A Vec3 with the angles you wish to set

Set your viewangles to the ones defined by the given Vec3

Adding onto angles indicates leftward motion, subtracting rightward motion

Example:

player.getDeltas()

Returns your delta angles as a Vec3.

Delta angles can be hard to wrap your head around at first. Call of Duty 4 does not update your viewangle in memory if a teleport occurs. Teleports such as loading your position in CodJumper will create a mismatch of your true viewangle and the one that resides in memory.

The difference is called the delta angle.

Example:

If you save your position with a yaw angle of 0 and turn 180 degree around,

then your yaw angle in memory will be 180. If you then load your position

it will still be 180, however the yaw delta angle will be -180.

Together they make up your true angle of yaw 0.

Delta angles go from -180 to +180

Example:

player.getCrosshairWorldPosition()

Returns the position the player currently aims at.

Example:

player.get2DSpeed()

Returns your current 2D speed.

Example:

player.getCurrentWeaponID()

Returns the weapon ID of your currently equipped weapon.

Example:

player.setCurrentWeaponID(id)

  • id The id of the weapon you want to switch to

Switches weapon to the given weapon ID.

Example:

player.getFPS()

Returns your current FPS.

Example:

player.setFPS(fps)

  • fps - The new fps to set

Sets your fps to the given value.

Example:

player.lookAtPosition(position)

  • position - A position as a Vec3 that you want to look at

Sets your viewangles so that you directly look at the given position

Example:

player.moveTo(position)

  • position - A position as a Vec3 that you want to move to.

Will move to the given position.

Example:

player.getName()

Returns your name.

Example:

player.getMainhandWeaponID()

Returns the id of your main weapon.

Example:

player.getRPGWeaponID()

Returns the weapon id of your rpg.

Example:

player.getWeaponDelay()

Returns the delay of your current weapon. The delay indicates how long the weapon is still unusable or in an animation. For example if you shoot the RPG without ADS then it takes time for the RPG to zoom in and eventually fire the rocket. The delay is a number in miliseconds how much of that animation is left.

Example:

player.isConnectedToServer()

Returns true if you're connected to a remote server.

Example:

player.isOnLocalServer()

Returns true if you're on a local server.

Example:

player.isSpectating()

Returns true if you're spectating.

Example:

player.isUsingRPG()

Returns true if you're currently using a RPG.

Example:

player.willLeaveGroundThisFrame()

Returns true if you will be considered in air this frame. This can either be the result of jumping or walking of a platform etc.

Example:

player.willTouchGroundThisFrame()

Returns true if you will land on ground this frame.

Example:

player.willTouchGroundNextFrame()

Returns true if you will land on ground next frame.

Example:

player.wasInAirLastFrame()

Returns true if you were in air last frame.

Example:

player.didTouchGroundLastFrame()

Returns true if you landed on ground last frame.hi

Notice This is not returning if you were on ground last frame. It is returning if you landed on ground last frame and thus will only be true if you were in air 2 frames ago and touched ground last frame.

Example:

player.willBounceThisFrame()

Returns if you will bounce this frame.

Example:

player.willBounceNextFrame()

Returns if you will bounce next frame.

Example:

Last updated