Freamee Posted October 19, 2019 Share Posted October 19, 2019 Hi. I want to create temporary variables on every vehicle at server start. Id make use of it as temporary trunks or i dont know. But i can not figure out, how to call the variables or even set it. global.KocsiCsomagtartok = function() { mp.vehicles.forEach((vehicle, id) => { vid = vehicle.id; vehicle.setVariable("Material", 0); console.log(`Kocsi ideiglenes csomagtartok lekrealva ${vid}`); }); } mp.events.addCommand("kocsi", (player) => { let id = KozeliKocsi(player, 5); if(id == null) return player.pushChat("Nincs a közeledben!"); player.call("csomagtarto", [id]); let matik = vehicle[id].getVariable('Material'); let marik = vehicle[id].getVariable('Marihuana'); player.pushChat(`Material: ${matik}`); player.pushChat(`Marihuana: ${marik}`); }); KocsiCsomagtartok(); Link to comment Share on other sites More sharing options...
Kar Posted October 24, 2019 Share Posted October 24, 2019 Yea just do vehicle.data.variable_name = 'test'; if(vehicle.data.variable_name === 'test') { } // I personally use these under the entityCreated event Link to comment Share on other sites More sharing options...
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