Jump to content
Sign in to follow this  
VirusLIVED

Player Connect Script Help

Recommended Posts

When a new player connects to the server and joins the game, the script runs for that player, which is exactly what I am trying to do.

The problem I am having is that the script I created is SUPPOSED to figure out which playable unit the newly connected player has selected, and then set a certain position and direction parameter based on the array the player belongs to.

I believe the problem is the use of "isPlayer" in my script. But I am unsure of another command I can use that will check which unit the newly connected player has selected.

Script excerpt:

waitUntil {!isNull player};
sleep 5;

// ------------------------------------
// --- Main Deck Spawn ---
// ------------------------------------

_mainDeckSpawn = [har_pilot, har_pilot_1, har_pilot_2, har_pilot_3, vip_pilot, vip_pilot_1, vip_pilot_2, vip_pilot_3, ven_pilot, ven_pilot_1, ven_pilot_2, ven_pilot_3, ven_pilot_4, ven_pilot_5, sar_pilot, sar_pilot_1, sar_pilot_2, osp_pilot, osp_pilot_1];

{
   if (isPlayer _x) then {
	player setPosASL [position _x select 0, position _x select 1, 16.4];
	player setDir 180;
};
} Foreach _mainDeckSpawn;

Instead of figuring out if the connected player belongs to any playable unit in the array, it checks which playable units are currently being played (from all players in game) which is causing the new player to spawn at other player positions.

Share this post


Link to post
Share on other sites

I am very rusty because it has been a while since I posted or did any editing, but I think you need to use the player command instead of isPlayer.

"isPlayer" checks to see if a unit is a human player. "player" returns the player's object. Change your condition code to this:

if (player == _x) then {

Assuming the elements of _mainDeckSpawn are the names of the units you assigned to them in the editor, this condition should check if the player is the same unit as one of those. If I am mistaken then blame it on no ArmA for over a year! Good luck!

Edited by Loyalguard

Share this post


Link to post
Share on other sites

Yeah, I am actually in the works of testing that out on our dedicated server. You may possibly be right. Works fine so far on a client host. Thanks.

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  

×