osu_apoc 10 Posted April 16, 2015 So, I'm working on my own version of the airdrop script that Creampie had shown (on Wasteland forums), and I wanted to move the creation functions server-side (Creampie's version trigged BE filters). I'm in the process of testing and figuring out how to use this BIS function further down the road. So what I've done is add a player action to call a simple vehicle spawn script that spawns an ATV near the player. However, I'm apparently not passing the player object to the server properly, as the server-side function does not receive the player object and returns an error about undefined variable. Player Action Code (part of an addaction array in playeractions.sqf) [format ["<img image='client\icons\playerMenu.paa' color='%1'/> <t color='%1'>[</t>Airdrop Test<t color='%1'>]</t>", "#FF0000"],{[[player],"APOC_srv_spawnVEH",false,false] call BIS_fnc_MP}, [], -100, false] Server Function Code private [_player, _playerPOS, _vehicleChoice, _choiceCost]; _player = _this select 0; //_vehicleChoice = _this select 1; _playerPOS = getPos _player; _spawnPOS = [_playerPOS select 0, _playerPOS select 1 + 5, _playerPOS select 2 + 10]; _veh = "Quadbike_01_base_F" createVehicle _spawnPOS; Server Error Error in expression <ce\APOC_srv_spawnVEH.sqf" private [_player, _playerPOS, _vehicleChoice, _ch> Error position: <_player, _playerPOS, _vehicleChoice, _ch> Error Undefined variable in expression: _player So what am I hosing up here? Share this post Link to post Share on other sites
jshock 513 Posted April 16, 2015 Try: [[(_this select 1)],"APOC_srv_spawnVEH",false,false] call BIS_fnc_MP; Share this post Link to post Share on other sites
osu_apoc 10 Posted April 16, 2015 Eh, still getting the same error in the server log. Share this post Link to post Share on other sites
jshock 513 Posted April 16, 2015 Ok, in that case, let's get the position of the player directly (in the action code), then just pass the position into your function: {_playerPos = getPos player; [[_playerPos],"APOC_srv_spawnVEH",false,false] call BIS_fnc_MP;} private [_player, _playerPOS, _vehicleChoice, _choiceCost]; _playerPOS = _this select 0; //_vehicleChoice = _this select 1; _spawnPOS = [_playerPOS select 0, _playerPOS select 1 + 5, _playerPOS select 2 + 10]; _veh = "Quadbike_01_base_F" createVehicle _spawnPOS; Share this post Link to post Share on other sites
osu_apoc 10 Posted April 16, 2015 We both missed the fact that in my private statement, I did not use quotation marks on the variables... Thus the reason it was in a tizzy... Thanks for the help looking at it. Now the next step is to see why it does not like adjusted _spawnPos. Returns a zero divisor error in the serverlog. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted April 16, 2015 You need to use parantheses in your _spawnPOS array: _spawnPOS = [_playerPOS select 0, (_playerPOS select 1) + 5, (_playerPOS select 2) + 10]; Otherwise it would firstly add up the numbers and then try to select from _playerPOS which of course would fail as you'd try to select outside the array. Share this post Link to post Share on other sites
osu_apoc 10 Posted April 16, 2015 Thanks! I figured that was the issue after I puzzled on it during the drive to the office. That's what I get for trying to bash some test code together without being thorough enough! Thanks again for the help, folks! Share this post Link to post Share on other sites