Skip to content

Players

Player objects are owned by the runtime. Receive them from events or look them up through vimp.players; never construct them yourself.

ts
vimp.on('playerConnected', (player) => {
  player.name = player.name.trim().slice(0, 24)
  player.health = 100
  player.armour = 50
  player.model = vimp.hash('mp_m_freemode_01')
  player.teleport(90.79, -1951.33, 20.74, 307.23)
})

position can be null before the player's ped has spawned. The disconnect event receives a final wrapper whose name is cached, but gameplay operations can no longer be assumed to succeed.

Weapons and vehicles

Use server methods for authoritative inventory and seating. Check boolean results when the operation can fail.

ts
const pistol = vimp.hash('WEAPON_PISTOL')
player.giveWeapon(pistol, 120)
player.setWeaponAmmo(pistol, 60)

if (vehicle && !player.putIntoVehicle(vehicle.id, -1)) {
  console.warn('Could not seat player', player.id)
}

Identity and trust

id identifies the current connection. name is mutable presentation data; socialClub is the stable platform identifier exposed by VIMP. Apply bans, roles, and ownership decisions on the server and do not trust values echoed by client events.

Use player.emit for private client messages and player.kick(reason) for an intentional disconnect.

VIMP developer documentation