Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
AAD10 Pete

Change weapon of PlayerX only on server; How broadcast PlayerX to client?

Recommended Posts

Hi

In my new mission it's necessary to change the weaponloadout of a specific player (for example Player1) with a script, that has to be executed only on the server.

Example:

If I execute {Player1 addWeapon "M9";} on the server, the specific client of Player1 doesn't get the new weaponload. (Because Player1 is only changed on the server so far)

BUT:

If I broadcast the Player1 object with {publicVariable "Player1";} or with {publicVariableClient "Player1";} the specific client of Player1 doesn't receive the new weapondatas.

Question:

How can I broadcast changed Player1 datas (on the server) from the server to all/specific client?

Thx for your help.

Share this post


Link to post
Share on other sites

You could use the CBA_fnc_globalExecute and add a check like this:

if (vehicle player == player1) then {bla bla bla};

Share this post


Link to post
Share on other sites
You could use the CBA_fnc_globalExecute and add a check like this:

if (vehicle player == player1) then {bla bla bla};

(vehicle player) will refer to the vehicle of the player if he's inside a car, tank etc.

if (player == player1) then {}

is enough :)

Share this post


Link to post
Share on other sites

But -- if (player == player1) then {} -- has to be executed seperatedly on the client system. I would appreciate a solution that executes only code on the server system.

publicVariable "Player1"; executed on the server doesn't fullfil the job?

Share this post


Link to post
Share on other sites

If you take a look here http://community.bistudio.com/wiki/addWeapon, you'll see the picture with "AL", it has to be executed on the client where the player object is local.

The server cannot add the weapons because the client is not local to the server.

publicVariable "player1" only synchronizes the value of "player1" across the network, nothing else. You could use a publicVariable event handler to handle the event, pass the player name, playerUID or whatever you want.

Edited by cuel

Share this post


Link to post
Share on other sites

ah, ok. thx for the information.

So I have to catch the values and execute addWeapon on the client system.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×