Skip to content
This repository was archived by the owner on Aug 9, 2025. It is now read-only.

Create vehicle

tbeck edited this page Sep 18, 2023 · 1 revision

Snippet that spawns a vehicle on player death


CreateVehicle

Creating a vehicle is as easy as that

event.On.PlayerDeath(func(p *alt.Player, killer *alt.Entity, weapon uint32) {
    // Respawn the dead player
    p.Spawn(alt.Vector3{0,0,72}, 0)
    pos := p.Position()
    pos.Y += 1.5

    // Create an adder next to the player
    veh, err := alt.CreateVehicle(alt.Hash("adder"), pos, p.Rotation())
    if err != nil {
        fmt.Println("vehicle model does not exist: ", err)
        return
    }
})

This script will spawn an adder after a player dies, right next to him.

Clone this wiki locally