Jump to content

Recommended Posts

Posted (edited)

Hi guys,

I haven't found any function that shares data between server and client.

I moved from GT-MP where I had had setEntitySyncedData. 

Edited by linnik
Posted (edited)
3 часа назад, Xabi сказал:
Цитата

mp.players.local.vehicle.getEntitySharedData("name")

getEntitySharedData is not a function.

 

Server:

Цитата

Vehicle.setEntitySharedData("name", "123");

 

Edited by linnik
Posted
7 minutes ago, linnik said:

getEntitySharedData is not a function.

 

Server:

 

Because what he linked you is C# seeing as you said you moved from GT-MP. SetVariable/getVariable is what you want if you’re using Javascript

https://wiki.rage.mp/index.php?title=Entity::setVariable

https://wiki.rage.mp/index.php?title=Entity::getVariable

just so you know setVariable is serverside only, getVariable is both client and serverside

  • Like 1
  • 1 year later...
Posted

How can i create variables for all vehicles at the server start?

global.KocsiCsomagtartok = function()
{
  mp.vehicles.forEach((vehicleid=> {
    vid = vehicle.id;
    vehicle.setVariable("Material"0);
    //vid.setVariable("Marihuana", 15);
    //vid.setVariable('Material', 5);
    console.log(`Kocsi ideiglenes csomagtartok lekrealva ${vehicle} ${vid}`);
  });
}

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.
×
×
  • Create New...