Jack Hammersmith 0 Posted December 12, 2006 Im looking for some "easy" ways to implement onplayerconnected into some old crbf codes. How can i save and call the current publicvariables which the player is needing to get money, startpos ect.. interesting would be an example for a small set and get command. Share this post Link to post Share on other sites
sickboy 13 Posted December 12, 2006 The easiest quickfix i'm using in scripts that require variables from the server is running a loop where the server is doing publicvariables every 20 seconds of the important values Of coarse this is not optimal nor beauty I am actually waiting for the Network Services by the Chain of Command, as I hope they will port it over and make it JIP compatible. If such base is there, it's up to us to just hook in and use the framework for our needs. How onPlayerConnected and Disconnect works... I would like to know too though So much to test and figure out, great Share this post Link to post Share on other sites
-UMPC-Hunter 0 Posted December 13, 2006 In many tests we've found out how onplayerconnected works fine. onplayerconnected is called by the host if a player joined the game. Therefor you can use PublicVariable commands in this script to broadcast some imortant variables to all players. Im using following code succesfully: in init.sqs: - executing a playerconnect script for host only!: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (local host) : onplayerconnected "[] exec ""PlayerConnected.sqs"" "; in PlayerConnected.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Publicvariable "A"; ... Publicvariable "Z"; exit; For some action use global triggers if someone is joining. For example: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Publicvariable "WestHasFlag"; trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WestHasFlag==true => hint "West has taken the flag"; set flag color... So all new players know who is the owner of your objects :-) regards [uMPC]Hunter Share this post Link to post Share on other sites
sickboy 13 Posted December 13, 2006 Hunter @ Dec. 13 2006,01:28)]... Thanks for the sharing! I will be using this a lot soon! Just a question.... you do a ?(local host) ... did you make a gamelogic named host, or is "host" now a standard object created and only local to the server? Share this post Link to post Share on other sites
-UMPC-Hunter 0 Posted December 13, 2006 np yes im using an logic like Host Hunter Share this post Link to post Share on other sites
sickboy 13 Posted December 14, 2006 Hunter @ Dec. 14 2006,00:35)]npyes im using an logic like Host Hunter Roger I was checking the original missions and figured that they do a: ?local Al but I can't find any object/gamelogic/whatever that's named Al in the mission. I haven't checked further yet, but preliminary it would seem that Al is a logic that is always present... Share this post Link to post Share on other sites
-UMPC-Hunter 0 Posted December 14, 2006 I've placed a gamelogic with the arma mission editor and give them the name "Host". If you do this you can use following construct to set e.g. a variable only for the host: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (local host) : Example = 1 try this: - ?(local Host) : command => command runs only on a dedicated server machine - ?(!local Host) : command => command is running on a client if you started the mission on a dedicated server machine => command is running on your pc if you started a MP mission on your pc Hunter PS: I've seen not usedd AI logics too. Share this post Link to post Share on other sites
sickboy 13 Posted December 14, 2006 Hunter @ Dec. 14 2006,18:57)]... I know m8, but thanks for sharing, I was just sharing that Al (not AI but AL) is a persistent gamelogic (if I look at the original mission), gonna test it now, will update in a sec (almost ) update: Well, never mind There is no default object "Al" so too bad, we still gotto make our own "server" ("host") objects Share this post Link to post Share on other sites