sina alex 1 Posted March 18, 2020 hello its a mp code runned by addaction on medical tent whe player distance are less 12m Chador addAction ["test", "S\test.sqf",nil,1.5,true,true,"","",12,false] in test on sp mode error say about the sqf file _Player = #_this select 1; i think its about last line i call sqf more time but how fix it? test.sqf _player = _this select 1; _Bim = _this select 0; _f = _this select 2; params ["_Bim","_Player","_Playerg","_Damage","_majruhin","_Newhealth","_playerpos"]; _playerpos = getPos _Player; _Damage = (damage _Player); _majruhin = []; _Playerg = group Player; _Newhealth = _Damage - 1; if ( _Damage > 1 ) exitWith {hint format ["%1 salamatiye shoma kamel ast", name _Player];}; if ( (_Damage < 100) && _Player distance _Bim < 10) then { _med1 = "C_Man_Paramedic_01_F" createvehicle [605.027,5290.74,0]; _med2 = "C_Man_Paramedic_01_F" createvehicle [605.027,5290.74,0]; _medteam = creategroup civilian; _medteam = []; [_med1,_med2] pushBack _medteam; _gp = [_majruhin,_medteam]; { [_x] disableAI "MOVE"; [_x] allowdamage false;} forEach (_medteam); sleep 5; HINT "CRETED AND PB"; SLEEP 1; [_Player] pushBack _majruhin; { _x enableAI "MOVE"; _x doMove (_playerpos);}forEach (_medteam); { _x disableAI "MOVE"; _X playAction "Medic";}forEach (_majruhin); sleep 1; _Player setDamage _Newhealth; hintSilent format [" %1 mizane salamatiye shoma %2 afzayesh yaft ", name _Player, _Newhealth]; sleep 2; { _x enableAI "MOVE"; _X playAction "Medic";}forEach (_majruhin); if ( _Damage > 99 ) then {hintSilent format [ "%1 salamatiye shoma kamel shod", name _Player];}; [_Player] pushBack _Playerg; {_x doMove (getPos _bim);}forEach (_medteam); }; waitUntil {_medteam distance _Bim < 2}; deleteVehicle _med1; deleteVehicle _med2; waitUntil {alive _Player}; execVM "S\test.sqf"; Share this post Link to post Share on other sites
sina alex 1 Posted March 22, 2020 hmmm like no one can commnet and help? Share this post Link to post Share on other sites
7erra 629 Posted March 22, 2020 There is so much wrong with this script. Please read the BIKI more carefully. 1 1 Share this post Link to post Share on other sites
sina alex 1 Posted March 22, 2020 We difine the player who run the script as _Player = _this select 1; And object too _obj = _this select 0; But it definde and synced with add action run Then when it load again in ending script part its not an addaction run and run directly,so defines well not work in next time. Its my problem how i must fix it. Ty Share this post Link to post Share on other sites
opusfmspol 282 Posted March 23, 2020 Review the Commands page on how params command is properly used. You're using it as if it was private command. When you execVM at the end, pass in the same params as addAction does and the params command at the beginning will define them again and make them private. No need for select. But that's not the only problem, as 7erra says the script has several problems. Review each command the script is using and you should start finding them. 2 Share this post Link to post Share on other sites
sina alex 1 Posted March 23, 2020 20 hours ago, 7erra said: There is so much wrong with this script. Please read the BIKI more carefully. you are right , im new in scripting so i dont see most of wiki pages like params or i wasnt know it commands use and with near help of opusfmspol i look and follow page of params and first think i find in last page is it by you,i think its my problem fix [1, 2, [3, 4]] call { params ["_one", "_two", "_this"]; params ["_three", "_four"]; }; but a few question to inserting : [ _this select 0, _this select 1, _this select call { params ["_bim", "_player", "_fa"]; }; do its correct or not? or what i must do about it?! plz show me my coding problems , it help me to improve my codings. ty for you answer+helps. Share this post Link to post Share on other sites
7erra 629 Posted March 23, 2020 _this call { params ["_bim", "_player", "_fa"]; }; _this is (usually) an array, see https://community.bistudio.com/wiki/Category:Data_Types and https://community.bistudio.com/wiki/Magic_Variables#this . The params command is essentially only assigning variables to the elements of that array: private _element1 = _this select 0; // SAME AS: params ["_element1"]; Also, all opening brackets ( "(, [, {" ) must be closed again. Pay attention to the syntax of the commands you use: https://community.bistudio.com/wiki/SQF_syntax. 1 Share this post Link to post Share on other sites
sina alex 1 Posted March 24, 2020 12 hours ago, 7erra said: _this call { params ["_bim", "_player", "_fa"]; }; _this is (usually) an array, see https://community.bistudio.com/wiki/Category:Data_Types and https://community.bistudio.com/wiki/Magic_Variables#this . The params command is essentially only assigning variables to the elements of that array: private _element1 = _this select 0; // SAME AS: params ["_element1"]; Also, all opening brackets ( "(, [, {" ) must be closed again. Pay attention to the syntax of the commands you use: https://community.bistudio.com/wiki/SQF_syntax. Hello First thank you for help me to find new informations. Then i know arrays and params better, i read wiki pages you tell there about params and data types and arrays and varriables i read subjects: append,+,*,-,set varriable,get varriable But for my code i think deep,the only way was near in my mind is create var about _player and _object and _add id And save it on them then get it in next run Its like an view in my mind. What i can do on it? Share this post Link to post Share on other sites
Larrow 2822 Posted March 24, 2020 Does this help as an example? to read through along with the resources the other have pointed you towards for command usage. 1 Share this post Link to post Share on other sites
sina alex 1 Posted March 24, 2020 3 hours ago, Larrow said: Does this help as an example? to read through along with the resources the other have pointed you towards for command usage. thank for your direct replay i read that cod guess writeed directly by you for example first lines say every think is ok but i need time to know it line by line and extract my code from it im keep reading and research. Share this post Link to post Share on other sites
sina alex 1 Posted March 25, 2020 On 3/24/2020 at 3:28 PM, Larrow said: Does this help as an example? to read through along with the resources the other have pointed you towards for command usage. now i read it fully and learned much new codes and tactics im create one for my and test it now Share this post Link to post Share on other sites