Jump to content
Sign in to follow this  
Macaco

Running script ONLY on specific player

Recommended Posts

I want to run a script ONLY on the player it is relevant to, but I am having a lot of trouble with this. I gave up on that and went on to trying to figure a way that if it's not running on the right person, exitwith {}; but I can't seem to get that figured out either. The script involves addActions so I can't really make it run only on the server.

Share this post


Link to post
Share on other sites

Hey Macaco,

How do you know which player you want to run it on?

If the script is being run from a trigger you could use the "thisList" variable like this:

if (player in thisList) then { ...

You could also detect the event on the server and use remote execution to add the actions on a particular client.

Share this post


Link to post
Share on other sites

Depending on who has gone up and used the item. However I've figured it out using getPlayerUID and a variable called holderUID.

---in another script that is run on the person who spawns with it

sleep 5;

holderUID = getPlayerUID CIA1;

publicVariable "holderUID";

nul = [CIA1,CIA1,"","take"] execVM "scripts\Briefcase.sqf";

---at the beginning of the pick up/drop script

if (isNil "holderUID") then {holderUID = getPlayerUID player; publicVariable "holderUID";};

if ((getPlayerUID player != holderUID) || isDedicated) exitwith {};

now I just have other bugs to fix

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  

×