gc8 977 Posted January 22, 2020 Hi Using initPlayerServer.sqf is not best option for my mission and the wiki says "initPlayerServer.sqf should be avoided.". So my question is , is there any other way to achieve same result as with the initPlayerServer.sqf? (Maybe some kind of EH) thx! 1 Share this post Link to post Share on other sites
Mr H. 402 Posted January 22, 2020 You kind of answered your own question : https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerConnected 😉 1 Share this post Link to post Share on other sites
gc8 977 Posted January 22, 2020 16 minutes ago, Mr H. said: You kind of answered your own question : https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerConnected 😉 Hmm, looking at the wiki there does not seem to be player object passed to the EH. I need that 1 Share this post Link to post Share on other sites
Mr H. 402 Posted January 22, 2020 You've got the uid so you can retrieve it with https://community.bistudio.com/wiki/BIS_fnc_getUnitByUid 1 Share this post Link to post Share on other sites
Vandeanson 1677 Posted January 22, 2020 Thanks guys, this helps me for a project:) 1 Share this post Link to post Share on other sites
gc8 977 Posted January 23, 2020 11 hours ago, Mr H. said: You've got the uid so you can retrieve it with https://community.bistudio.com/wiki/BIS_fnc_getUnitByUid Thats good, thx! But my concern is, is the player object properly initialized at the time the connect EH is fired? The player object not being passed to the EH implies it's not. But hope I'm wrong. Just want to be sure about this :) Share this post Link to post Share on other sites
Dedmen 2714 Posted January 23, 2020 2 hours ago, gc8 said: But my concern is, is the player object properly initialized at the time the connect EH is fired? No. You could maybe use the EntityRespawned handler, that might fire on server when a unit spawns. Unless they don't spawn via respawn, but instead occupy a existing AI unit, in that case the EH will probably not work. 2 Share this post Link to post Share on other sites
pierremgi 4892 Posted January 23, 2020 Why not with: this addEventHandler ["Local", { params ["_entity", "_isLocal"]; }]; That runs (also) on server. 1 Share this post Link to post Share on other sites
gc8 977 Posted January 24, 2020 17 hours ago, pierremgi said: Why not with: this addEventHandler ["Local", { params ["_entity", "_isLocal"]; }]; That runs (also) on server. If that works good but what if for example one player leaves the server and another takes his unit, will it still work? It should fire on server each time player joins Share this post Link to post Share on other sites
pierremgi 4892 Posted January 24, 2020 As far as another player can take a slot, that means this slot is available on server. So, I guess yes. You'll have a double EH fire: client1 & server for disconnection and client2 & server for new JIP. Share this post Link to post Share on other sites
gc8 977 Posted January 24, 2020 2 hours ago, pierremgi said: As far as another player can take a slot, that means this slot is available on server. So, I guess yes. You'll have a double EH fire: client1 & server for disconnection and client2 & server for new JIP. sounds so complicated that I'll probably stick with initPlayerServer.sqf Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 24, 2020 26 minutes ago, gc8 said: sounds so complicated that I'll probably stick with initPlayerServer.sqf Why not use initPlayerLocal.sqf? Cheers Share this post Link to post Share on other sites
gc8 977 Posted January 24, 2020 8 minutes ago, Grumpy Old Man said: Why not use initPlayerLocal.sqf? Cheers Isn't that for client? Share this post Link to post Share on other sites
pierremgi 4892 Posted January 24, 2020 42 minutes ago, gc8 said: Isn't that for client? Yes, but you never spoke about what you intend to do. Just some considerations about "achieving same result as with the initPlayerServer.sqf" . If you don't want the useful EH "local", you can have an endless loop on your initServer.sqf , name you playable units toto, gugus,... and waitUntil they are not local (so passed to a player's PC. Not sure it's smarter than the EH. Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 24, 2020 57 minutes ago, gc8 said: Isn't that for client? Sure, local to each client and passes player object, as you stated in your second post. If you need to pass player object to the server you can always use initPlayerLocal.sqf with remoteExec. Be more specific about what you want to achieve, maybe initPlayerServer will work better, the notion that "initPlayerServer.sqf should be avoided" which you quoted is not a general statement and related to a specific use case of CfgRemoteExec. Cheers Share this post Link to post Share on other sites
gc8 977 Posted January 25, 2020 I should have been more clear on what I want, sorry. The reason I referred to initPlayerServer.sqf is because I need to init the player on server and the timing is crucial Share this post Link to post Share on other sites