Jump to content

jamiesage123

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Everything posted by jamiesage123

  1. Hello, I'm slowly getting the grasp of multiplayer scripting. However, I've come across another issue which i can't seem to get my head around, again. Basically, i have a dialog with a combobox with a list of each player online in the server. Once the player presses the button i want to be able to get the selected player and perform actions with it (such as AddWeapon). This is how i attempt to get the other player: _otherplayer = "Players Name"; // This would be gathered from the combobox via lbText closeDialog 0; { scopeName "PLoop"; if(name _x == _otherplayer) then // If _x's name matches the one in the combobox. { _otherplayer = _x; // _otherplayer is now the other player. breakOut "PLoop"; // Break out of the loop }; } forEach allUnits; That part of the code seems to work. However, when it gets to using globalChat or AddWeapon (etc) the other player doesn't receive the message and/or the item. // Such as these _otherplayer globalChat format['%1 selected you in the dialog!', name player]; _otherplayer addWeapon "G36C"; I did notice that the message would send to the player who executed the dialog (which leads me to think that globalChat is local and only works for the player who executed it). If so, how would i be able to use functions on another player in this type of situation?
  2. Hello, I'm basically going to try and create a login/register system for each new user that joins the server, but i'm having some difficulties in getting my head around the multiplayer aspect. (I will be using mysql for this system; unfortunately, i haven't got any code to show yet). I understand that player is each individual computer and therefore can be referenced to control that player. However, I'm having some trouble getting the basic setup. 1. init.sqf - Is this called every time a player joins the server (/mission)? Would this be an appropriate place to check if the player has an account and then show a dialog with the necessary information? 2. Adding actions (addAction) - Where would this be placed? Again, would it be appropriate to place it in the init.sqf? I've been glued to my computer reading tutorials all over the internet but i haven't really found any information which will help me (or if it did, i didn't understand :x). Any help will be really appreciated. Thanks, Jamie. Edit: From a few days of messing around, i found out that init.sqf is called every time a player is joined and therefore can be used for functions such as addAction etc. Not sure if its meant to be used in this way, but it works for me.
×