0xNull Posted January 27, 2018 Posted January 27, 2018 Hello, i am writing simple code, with the spawned the car after the player joined to the server. Why he dont work? Code: let spawnPoints = require('./spawn_points.json').SpawnPoints; mp.events.add('playerDeath', (player) => { player.spawn(spawnPoints[Math.floor(Math.random() * spawnPoints.length)]); player.health = 100; }); mp.events.add('playerJoin', (player, _, vehName) =>{ player.spawn(spawnPoints[Math.floor(Math.random() * spawnPoints.length)]); player.outputChatBox(`You joined!`); player.customData = {}; let pos = player.position; pos.x += 2; player.customData.vehicle = mp.vehicles.new(mp.joaat(t20), pos); }); mp.events.add('playerChat', (player, message) => { mp.players.broadcast(`${player.name}[ID ${player.id}]: ${message}`); }); Error: ReferenceError: t20 is not defined player.customData.vehicle = mp.vehicles.new(mp.joaat(t20), pos);
Delta Posted January 27, 2018 Posted January 27, 2018 (edited) if t20 is a variable, you need to create it, if not, use player.customData.vehicle = mp.vehicles.new(mp.joaat('t20'), pos); Edited January 27, 2018 by Delta
0xNull Posted January 27, 2018 Author Posted January 27, 2018 17 минут назад, Delta сказал: if t20 is a variable, you need to create it, if not, use player.customData.vehicle = mp.vehicles.new(mp.joaat('t20'), pos); Thank you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now