Jump to content
Sign in to follow this  
creartan

setvehiclevarname is it Global?, if not how?

Recommended Posts

player setVehicleVarName "newvariablez";
newvariablez = player;
//its working, but is it global?;

is this Global?? if not how to make it global? maybe some xample of the init function?

and why its not working when i use:

_varname = vehiclevarname player;
_varname setVehicleVarName "newvariablez";
newvariablez = _varname;
//its not working;

Share this post


Link to post
Share on other sites

The biki says that you have to execute it on every client, so it's local. You probably have to execute it on the server too.

Share this post


Link to post
Share on other sites

i already create two function inside INIT, but it still not working.

init

MP_fnc_changevar =
{
private["_oldvar","_newvar"];
_oldvar = _this select 0;
_newvar = _this select 1;

_oldvar setVehicleVarName _newvar;
}; //this is the change variable;

MP_fnc_changeref =
{
private["_varold","_varnew"];
_varold = _this select 0;
_varnew = _this select 1;

_varnew = _varold;
}; // this is the reference;

inside Script.sqf

[[Player,"coolguy"],"MP_fnc_changevar",nil,true] call BIS_fnc_MP;
[[Player,coolguy],"MP_fnc_changeref",nil,true] call BIS_fnc_MP;

please help, the simple one please.

where i did wrong there??

Share this post


Link to post
Share on other sites

Can't you just go:

vehicle setVehicleVarName "myVehicle"; publicVariable "myVehicle";

or

mycar = createVehicle [cartype,carpos,[],0,"NONE"];
mycar setVehicleVarName "myCarName";
publicVariable "mycar";

?

Share this post


Link to post
Share on other sites

In your BIS_fnc_MP lines, you have the broadcasting parameter set to nil, and your persistence parameter set to true, try setting the broadcast to true and persistence to false.

Share this post


Link to post
Share on other sites

Why don't you simply use

myVehicle = vehicle; publicVariable "myVehicle";

?

Share this post


Link to post
Share on other sites

I'm wondering why worry about setting the player's var name, just use player.

Share this post


Link to post
Share on other sites
Why don't you simply use
myVehicle = vehicle; publicVariable "myVehicle";

?

As Tajin put it, this works.

A working example from one of my scripts:

west_base = createVehicle [_vehtype, _posMrk, [], 0, "CAN_COLLIDE"];
west_base setPos [_posMrk select 0, _posMrk select 1,0];

west_base setVehicleVarName "west_base";
publicVariable "west_base";

My concern is that you're trying to make it hold a players name, then make that public on your mission's network.

Could we get any more info on what you're trying to do? (Perhaps make an addaction available to all players?)

Share this post


Link to post
Share on other sites
http://forums.bistudio.com/showthread.php?142594-publicVariable-JIP

"Also remember that it doesn't register on the client that publics it."

i found it on the thread.

is that right?

How about the wiki page on publicVariable, instead of a thread almost 800 days old (and from A2 for that matter).

creating some mission

Really? This doesn't help us, which in turn doesn't allow you to get the information needed to make whatever it is work properly.

Share this post


Link to post
Share on other sites
"Also remember that it doesn't register on the client that publics it."

Well it doesn't...but you need to store that information in the variable anyway to publicVariable it...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×