Nutty_101 0 Posted February 4, 2007 I am curious if it is possible to execute a script when a player logs into the server? I need this to be server side as i want to pull some data and populate some variables inside the game from a database. Trying to build a minor concept map to test with but I am not having much luck with server side only information. Share this post Link to post Share on other sites
wex-q 0 Posted February 4, 2007 Put a trigger whereever the new player can respawn, wich fires the script? Share this post Link to post Share on other sites
HitmanFF 6 Posted February 4, 2007 As soon as a player joins a game, the OnPlayerConnected statement is fired. You can use that statement to execute your script. Use a game logic called e.g. server to run it server sided only, e.g. to run from init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(local server): onplayerconnected "[_name, _id] exec ""myscript.sqs""";_name will be the player's nick name, passed on to the script, _id is some kind of unique session id. If not needed, you can either remove them from the call or simply ignore them in your script. Share this post Link to post Share on other sites
Nutty_101 0 Posted February 4, 2007 As soon as a player joins a game, the OnPlayerConnected statement is fired. You can use that statement to execute your script. Use a game logic called e.g. server to run it server sided only, e.g. to run from init.sqs:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(local server): onplayerconnected "[_name, _id] exec ""myscript.sqs"""; _name will be the player's nick name, passed on to the script, _id is some kind of unique session id. If not needed, you can either remove them from the call or simply ignore them in your script.Cool. Thanks guys. Share this post Link to post Share on other sites
Nutty_101 0 Posted February 4, 2007 This sucks. Pretty much worthless to have a onplayerconnect script. You cannot get their player id or anything that i can figure out. The name is ok but really no use as you cannot send them messages or anything. Pout. Share this post Link to post Share on other sites
HitmanFF 6 Posted February 4, 2007 This sucks. Pretty much worthless to have a onplayerconnect script. You cannot get their player id or anything that i can figure out. The name is ok but really no use as you cannot send them messages or anything. Pout. You could consider sending messages to all players, and only display them if the name is correct.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">name Player will give you the player's name, you can compare that to the name given in the OnPlayerConnected script. Share this post Link to post Share on other sites
Nutty_101 0 Posted February 4, 2007 How would i cycle thru all the players in the game? Other issue is how do you send text to a specific player. Really all i want to do is get the player ID. Then i can keep track of this player in a database and return total time on the server. Total kills, Deaths, TeamKills (possible ban if over some amount in a specific period), and a rank. Mostly i want to just try and build something to test to see if this thing will work well or not. I can read variables now, read only sucks and i cannot find anything to interact with the players in the game at the moment because most the player information is stored client side (well it is server side but i am having a heck of a time locating it and it's not really my goal to track down server stored information outside of variables that the scripts are using). Share this post Link to post Share on other sites
Espectro (DayZ) 0 Posted February 4, 2007 The id... is that the game ID of the player (As in the profile). If not, is it possible get it? Share this post Link to post Share on other sites
Nutty_101 0 Posted February 4, 2007 The id... is that the game ID of the player (As in the profile). If not, is it possible get it? Yeah, without that it is impossible to track a user between sessions. The one that playerconnect gives is random and useless. Share this post Link to post Share on other sites
Giova_BLH 0 Posted February 20, 2007 The fact that _id is not the id linked to your CDKEY is a good point. Because on LAN game, you can have several players using the same CDKEY,do you understand i? Now a usefull command would be : unit PlayerID that will return the same id as in Onplayer/Connected/Disconnected. So we can compare it. exemple : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">OnPlayerConnected "if((SoldierRyan playerid) == _id) then{ImportantMessage = ""A Hero is born"";PublicVariable ""ImportantMessage""};" I've allready asked this in the wish list I've also asked for a : unit userID command, that will return the ID linked to the CDKEY (why userID, because it sounds like #userlist ) hoping, it'll be hearded by BIS, but if you too wants those commands, say it to show to bis that many people want it Question : It looks like OnPlayerConnected is not working anymore since 1.04 (OnPlayerDisconnected seems to still working, but not OnPlayerConnected), can someone confirm it? Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted February 20, 2007 The fact that _id is not the id linked to your CDKEY is a good point. Because on LAN game, you can have several players using the same CDKEY,do you understand i?Now a usefull command would be : unit PlayerID that will return the same id as in Onplayer/Connected/Disconnected. So we can compare it. exemple : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">OnPlayerConnected "if((SoldierRyan playerid) == _id) then{ImportantMessage = ""A Hero is born"";PublicVariable ""ImportantMessage""};" I've allready asked this in the wish list I've also asked for a : unit userID command, that will return the ID linked to the CDKEY (why userID, because it sounds like #userlist ) hoping, it'll be hearded by BIS, but if you too wants those commands, say it to show to bis that many people want it Question : It looks like OnPlayerConnected is not working anymore since 1.04 (OnPlayerDisconnected seems to still working, but not OnPlayerConnected), can someone confirm it? What about: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">OnPlayerConnected "if((Name SoldierRyan) == _name) then{ImportantMessage = ""A Hero is born"";PublicVariable ""ImportantMessage""};" You can't change your nick anyway (without creating a new user/player), so it's more or less equal to PlayerID, isn't it? I remember having to create a new user once ArmA decided to use my windows username... Share this post Link to post Share on other sites
Nutty_101 0 Posted February 20, 2007 Yeah, but i think you can have more than one user with the same name running around. Have not tested it but i am looking for something to use on a long term basis so when a player comes back after logging off we can identify them. Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted February 20, 2007 You're right man - but I haven't seen many similar nicks around (unless we're talking about "default" nicks), so we can try to make do with 'name' while we wait for the promised land... Share this post Link to post Share on other sites
terox 316 Posted February 20, 2007 the onplayerconnect event is triggered only on the server What is needed is a way to identify the player object so arrays and other variables can be updated etc It would seem on the surface that JIP wasnt looked into too much with regards of mission maker implementation as there would seem to be a fair lack of function with it eg ?(local admin) Players = Players + [JIP Player] Newplayerclient = ID_node Server passing variables to remote call to start a function\script on the new players client and the reverse for playerdisconnect I started this thread on a similar topic http://www.flashpoint1985.com/cgi-bin....t=58216 Share this post Link to post Share on other sites