chkang

Getting a Vehicle OwnerUID(Client Side)

7 posts in this topic

Hello guys!

I want to get a vehicle's owner UID at the client side.

here's my code

 

_playerUID = getPlayerUID player;
_nearVehicles = nearestObjects [player, [
"Exile_Car_Van_Box_Black",
"Exile_Car_Van_Box_White",
"Exile_Car_Van_Box_Red"], 50];

{
	_ObjectNetID = netId _x;
	_Vehicle_Delivery_Truck = objectFromNetId (_ObjectNetID);
	_VhiecleUID = _Vehicle_Delivery_Truck select 3;
	if(_VhiecleUID isEqualTo _playerUID) then 
	{
		_Player_Truck_Is_Here = true;
	};
}forEach _nearVehicles;

Above code didn't work. I tried to get a net ID from nearestObjects. but It ddin't work.

So I tried another way.

_playerUID = getPlayerUID player;
_nearVehicles = nearestObjects [player, [
"Exile_Car_Van_Box_Black",
"Exile_Car_Van_Box_White",
"Exile_Car_Van_Box_Red"], 50];

{
	_VhiecleUID = _x getVariable ["ExileOwnerUID", ""];
	if(_VhiecleUID isEqualTo _playerUID) then 
	{
		_Player_Truck_Is_Here = true;
	};
}forEach _nearVehicles;

Above code also didn't work.

 

How can I get a vehicle's ExieOwnerUID? or a account_uid?

 

 

 

Share this post


Link to post
Share on other sites

It first needs to be in database as I believe only pin codes are stored at the moment. Might want to look into manually adding the tables or try using Sanchez

Good luck with your script. I was attempting a similar project but had a hard time adding existing vehicles to owners.

Share this post


Link to post
Share on other sites
Advertisement

to start with you should check your spelling on vehicle

Share this post


Link to post
Share on other sites
1 hour ago, Fivenine said:

to start with you should check your spelling on vehicle

Doesn't matter, variable name can be whatever he wants. Also, how is this helpful at all?

6 hours ago, wernerz said:

It first needs to be in database as I believe only pin codes are stored at the moment. Might want to look into manually adding the tables or try using Sanchez

This is for logging, persistent vehicles have an uid attached no matter what in Exile. 

---

8 hours ago, chkang said:

How can I get a vehicle's ExieOwnerUID? or a account_uid?

Short answer: 
It has to be done on the server and it's only going to work for vehicles that the player has bought. 

Long answer:
ExileOwnerUID is a server side only variable that's attached to the player's object and vehicle object that the player has bought. 

SetVariable is based on locality and only applies to the computer that it's ran on. It does, however, have a third variable that changes that. 

_veh setVariable ["ExileOwnerUID","PLAYERS_UID_HERE",true];

The true basically makes that variable global, meaning any connecting computer/client has the ability to see that variable attached using the getVariable command. 

 

As for how you can get that to work? You can either send a network message over to the server and return the UID, or you can edit ExileServer_system_trading_network_purchaseVehicleRequest  and change the line that sets the playersUID to the vehicle to have the true at the end. 

 

9 hours ago, chkang said:

Above code didn't work. I tried to get a net ID from nearestObjects. but It ddin't work.

Just so you know, nearestObjects returns an Object, so getting the objects netID (which looks like this:  "2:3" ) and then running objectFromNetID is just returning the object again. :) So it won't have helped you anyway. 

2 people like this

Share this post


Link to post
Share on other sites
1 hour ago, WolfkillArcadia said:

Doesn't matter, variable name can be whatever he wants. Also, how is this helpful at all?

This is for logging, persistent vehicles have an uid attached no matter what in Exile. 

---

Short answer: 
It has to be done on the server and it's only going to work for vehicles that the player has bought. 

Long answer:
ExileOwnerUID is a server side only variable that's attached to the player's object and vehicle object that the player has bought. 

SetVariable is based on locality and only applies to the computer that it's ran on. It does, however, have a third variable that changes that. 


_veh setVariable ["ExileOwnerUID","PLAYERS_UID_HERE",true];

The true basically makes that variable global, meaning any connecting computer/client has the ability to see that variable attached using the getVariable command. 

 

As for how you can get that to work? You can either send a network message over to the server and return the UID, or you can edit ExileServer_system_trading_network_purchaseVehicleRequest  and change the line that sets the playersUID to the vehicle to have the true at the end. 

 

Just so you know, nearestObjects returns an Object, so getting the objects netID (which looks like this:  "2:3" ) and then running objectFromNetID is just returning the object again. :) So it won't have helped you anyway. 

Thank you for your help

I'll try it on serverside.

Also I have a one more question

How can I give a return value to the client? 

 

 

 

Share this post


Link to post
Share on other sites
5 minutes ago, chkang said:

Thank you for your help

I'll try it on serverside.

Also I have a one more question

How can I give a return value to the client? 

In Exile, you will want to use Network Messages.

Share this post


Link to post
Share on other sites
6 minutes ago, WolfkillArcadia said:

In Exile, you will want to use Network Messages.

Yeah I found a Network message pages  in exile dev wiki. Thanks!

Share this post


Link to post
Share on other sites
Advertisement

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.