juandayz Posted August 12, 2016 Report Share Posted August 12, 2016 hey, i need use waituntil and display a scroll menu option in server side using random cases. i had to wait if thers almost 1 player near of my custom crate to execute the random scroll menu option. this works by client side.. but not in server side: Spoiler waitUntil {(player distance _crate1) < _distance}; selectDelay = 25; _timer = selectDelay; //////////////START RAND CASES TO CUT WIRES THIS FINISH IN BOMB EXPLODE OR NOT#######################// _rand = floor(random 100); //####################################1st rand:#################/// if (_rand <= 30) then { bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; }; *I was trying to replace by it to make its work by server side.. the First waitUntil now works... but no the scroll menu option. Spoiler waitUntil{{isPlayer _x && _x distance _crate1 < 5 } count playableunits > 0}; [nil,nil,rTitleText,"TEST TEXT", "PLAIN",10] call RE; _rand = floor(random 100); //####################################1st rand#########// if (_rand <= 30) then { bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; }; ////the others rand cases bellow.... any idea? Link to comment Share on other sites More sharing options...
0 BigEgg Posted August 12, 2016 Report Share Posted August 12, 2016 Try this: waitUntil{ (({isPlayer _x && _x distance _crate1 < _distance} count playableUnits > 0)); }; juandayz 1 Link to comment Share on other sites More sharing options...
0 juandayz Posted August 12, 2016 Author Report Share Posted August 12, 2016 yes BiggEgg tnks! the waitUntil works now with it waitUntil{{isPlayer _x && _x distance _crate1 < 5 } count playableunits > 0}; i need fix the part bellow,, but dont know if is _rand = floor(random 100) works on server side or just: wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; }; i think is showComandigMenu who dsnt works Link to comment Share on other sites More sharing options...
0 BigEgg Posted August 12, 2016 Report Share Posted August 12, 2016 I am sorry, but I don't understand the problem. What are you trying to do with _rand = floor(random 100) juandayz 1 Link to comment Share on other sites More sharing options...
0 juandayz Posted August 13, 2016 Author Report Share Posted August 13, 2016 53 minutes ago, BigEgg said: I am sorry, but I don't understand the problem. What are you trying to do with _rand = floor(random 100) see: Spoiler waitUntil{{isPlayer _x && _x distance _crate1 < 5 } count playableunits > 0}; [nil,nil,rTitleText,"CUT A WIRE", "PLAIN",10] call RE; //SCRIPT STOP TO WORK JUST RIGHT HERE selectDelay = 25; _timer = selectDelay; _rand = floor(random 100); //############################################################################################################// //####################################1st rand: if floor random is a less or equal number of 30 start a menu to cut wires ...#################/// //#############then i define Brown Wire as good. bomb=1 is the good value. The others make explode the bomb#########// if (_rand <= 30) then { bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; }; //############################################EXIT FROM 1st rand############################################################// //####################################2nd rand same as above but here Red Wire is the good Wire#############################/// if (_rand <= 65 && _rand > 31) then { bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; }; //############################################EXIT FROM 2st rand############################################################// //####################################3nd rand same as above but here Black Wire is the good Wire#############################/// if (_rand <= 100 && _rand > 66) then { bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; }; //############################################EXIT FROM 2st rand############################################################// //####################END OF RANDOMS CASES##################################################################################// ok, once script recognize almost 1 nearest player must execute the wirecut menu. (_rand cases are fine..) i think Wirecut menu dsnt workss.... but works if i execute by client side. if i remove _rand cases then : Spoiler waitUntil{{isPlayer _x && _x distance _crate1 < 5 } count playableunits > 0}; [nil,nil,rTitleText,"CUT A WIRE", "PLAIN",10] call RE; //SCRIPT STOP TO WORK JUST RIGHT HERE selectDelay = 25; _timer = selectDelay; bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; showCommandingMenu "#USER:wirecut"; WaitUntil{commandingMenu == ""}; so its means i guess... wirecut menu is the one wh dsnt works Link to comment Share on other sites More sharing options...
0 juandayz Posted August 13, 2016 Author Report Share Posted August 13, 2016 here you have a vid to see the problem unfilled crate is fine... crate fills onces you cut the wire.. but thers no option to cut wires if i execute it by server side. Link to comment Share on other sites More sharing options...
0 BigEgg Posted August 13, 2016 Report Share Posted August 13, 2016 Okay I see. Try this: wirecutmenu = {showcommandingMenu "#USER:wirecut";}; [] spawn wirecutmenu; So it would look like this: if (_rand <= 65 && _rand > 31) then { bomb = 0; wirecut = [ ["",true], ["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Red Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"], ["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["Brown Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"] ]; wirecutmenu = {showcommandingMenu "#USER:wirecut";}; [] spawn wirecutmenu; WaitUntil{commandingMenu == ""}; }; juandayz 1 Link to comment Share on other sites More sharing options...
0 juandayz Posted August 13, 2016 Author Report Share Posted August 13, 2016 ok like a function.. gonna try.. many tnks! works.. but like a bypass. Script jump this part and proceed like if u cut the wrong cut. any way tnks BiggEgg Link to comment Share on other sites More sharing options...
0 juandayz Posted August 14, 2016 Author Report Share Posted August 14, 2016 well i think the problem is about player. i need set up the player near as local player. something like.. _callerid = _this _caller = _newValue select 0; if (_caller == player) then { .... the wirecut menu here. }; if anyone knows Link to comment Share on other sites More sharing options...
0 seelenapparat Posted August 14, 2016 Report Share Posted August 14, 2016 I would recommend using a public variable to the receiving player and execute all the player code on the client itself. this would be the better way to do this. Link to comment Share on other sites More sharing options...
0 juandayz Posted August 14, 2016 Author Report Share Posted August 14, 2016 yep @seelenapparat tnks!!! i read about it. but dont know how its work. do you have any kind of example? i need to send a time counter before bomb explode to an specific client. (if can do it so i guess i can send the weire cut menu too) heres the part of the code: Spoiler proceed = 0; waitUntil{{isPlayer _x && _x distance _bombcrate < 3 } count playableunits > 0}; [nil,nil,rTitleText,"THERS SURVIVORS TRYING TO DEFUSE THE BOMB!", "PLAIN",10] call RE; //#############################CREATE BOMB FUNCTION TO EXPLODE############################// bombexp = { _bomb = ["HelicopterExploSmall","HelicopterExploBig","Bo_GBU12_LGB"] call BIS_fnc_selectRandom; _dabomb = objNull; if (true) then { _this = createVehicle [_bomb,_positionobj, [], 2, "CAN_COLLIDE"]; _dabomb = _this; }; }; //############################EXIT FROM HERE#################################################// proceed = 1; if (proceed !=0) then { sleep 1; ////////////////////////////////////////////////////SCRIPT////////////////////////// [nil,nil,rTitleText,"CRATEBOMB IS ACTIVE NOW", "PLAIN",10] call RE; // Add loot { _bombcrate addWeaponCargoGlobal [_x,1]; } forEach (_loot select 0); { _bombcrate addMagazineCargoGlobal [_x,1]; } forEach (_loot select 1); { _bombcrate addWeaponCargoGlobal [_x,1]; } forEach (_loot2 select 0); { _bombcrate addMagazineCargoGlobal [_x,1]; } forEach (_loot2 select 1); //end loot sleep 1; _mark = "RoadFlare" createVehicle getPosATL _bombcrate; _mark attachTo [_bombcrate, [0,0,-1]]; _positionobj = getPosATL _bombcrate; ///HERE THIS PART MUST BE ONLY FOR THE PLAYER NEAR BOMBCRATE /////BOMB TIMER FOR ONLY ONE PLAYER////////////// _countTime = true; _maxtime = selectDelay; _secondstimer = 0; while {true} do { if(_coutTime) then { systemChat format["COUNTDOWN: %1",_maxtime - _secondstimer]; //countdown }; ////EXIT FROM LOOP AREA//// if (_secondstimer >= _maxtime) exitWith { call bombexp; }; ///////////////////// _nul = [objNull, player, rSAY, "bombtimer",50] call RE; _secondstimer = _secondstimer + 1; sleep 1; }; _bombcrate setDamage 1; deleteVehicle _mark; deleteVehicle _bombcrate; also i try put this tiimer code into another sqf and call it //////////////////////////////////// selectDelay = 15; _timer = selectDelay; _mark = "RoadFlare" createVehicle getPosATL _bombcrate; _mark attachTo [_bombcrate, [0,0,-1]]; _positionobj = getPosATL _bombcrate; //ExecVM "\z\addons\dayz_server\modules\timer.sqf"; or//call compile preprocessFileLineNumbers "\z\addons\dayz_server\modules\timer.sqf"; sleep _timer; call bombexp; /////////////////////////////////////// but dsnt works Link to comment Share on other sites More sharing options...
Question
juandayz
hey, i need use waituntil and display a scroll menu option in server side using random cases.
i had to wait if thers almost 1 player near of my custom crate to execute the random scroll menu option.
this works by client side.. but not in server side:
waitUntil {(player distance _crate1) < _distance};
selectDelay = 25;
_timer = selectDelay;
//////////////START RAND CASES TO CUT WIRES THIS FINISH IN BOMB EXPLODE OR NOT#######################//
_rand = floor(random 100);
//####################################1st rand:#################///
if (_rand <= 30) then {
bomb = 0;
wirecut =
[
["",true],
["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"],
["", [-1], "", -5, [["expression", ""]], "1", "0"],
["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"],
["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"],
["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"],
["", [-1], "", -5, [["expression", ""]], "1", "0"]
];
showCommandingMenu "#USER:wirecut";
WaitUntil{commandingMenu == ""};
};
*I was trying to replace by it to make its work by server side.. the First waitUntil now works... but no the scroll menu option.
waitUntil{{isPlayer _x && _x distance _crate1 < 5 } count playableunits > 0};
[nil,nil,rTitleText,"TEST TEXT", "PLAIN",10] call RE;
_rand = floor(random 100);
//####################################1st rand#########//
if (_rand <= 30) then {
bomb = 0;
wirecut =
[
["",true],
["wirecut", [-1], "", -5, [["expression", ""]], "1", "0"],
["", [-1], "", -5, [["expression", ""]], "1", "0"],
["Red Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"],
["Black Wire", [], "", -5, [["expression", "bomb=0;"]], "1", "1"],
["Brown Wire", [], "", -5, [["expression", "bomb=1;"]], "1", "1"],
["", [-1], "", -5, [["expression", ""]], "1", "0"]
];
showCommandingMenu "#USER:wirecut";
WaitUntil{commandingMenu == ""};
};
////the others rand cases bellow....
any idea?
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now