Freamee

Create variables at server start for every vehicle

Recommended Posts

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((vehicleid=> {
    vid = vehicle.id;
    vehicle.setVariable("Material"0);
    console.log(`Kocsi ideiglenes csomagtartok lekrealva ${vid}`);
  });
}
 
mp.events.addCommand("kocsi", (player=> {
 
  let id = KozeliKocsi(player5);
  if(id == nullreturn 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();

Share this post


Link to post
Share on other sites

Yea just do

 

vehicle.data.variable_name = 'test';

if(vehicle.data.variable_name === 'test') {
}

// I personally use these under the entityCreated event

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.