Wieso mach ihr das nicht mit dem Ace EventHandler sondern mit ner Hässligen Schleife?
ACE Medic Request bei 15 Minuten Bewusstlosigkeit
-
- Altis Life
-
Kraftwerk -
31. März 2020 um 18:42 -
Erledigt
-
-
Wieso mach ihr das nicht mit dem Ace EventHandler sondern mit ner Hässligen Schleife?
Hast du eine bessere Möglichkeit wie es funktioniert?
-
-
Oder so. Die Schleife läuft ja so oder so mit
-
Oder so. Die Schleife läuft ja so oder so mit
Nur weil die Schleife läuft ist das keine ausrede das dazwischen zu pappen. Und der EventHandler greift dazu auch sofort und nicht erst wenn die Schleife durchlaufen ist
-
Und wie muss ich das da jetzt machen?
-
Und wie muss ich das da jetzt machen?
Also... Wenn du das nicht verstehst... Ähmm.... Uff...
Da wo Code steht kannst dir ja denken was rein soll oder? Dein Code. Ich habe nur gesagt was es triggert. Wie der Code aussehen muss, kann ich aktuell nicht sagen. Eigentlich nur das gleiche nur das es nicht mehr unnötig in ner Schleife läuft
-
in der core/init.sqf oder der normalen?
-
Und jetzt wird es mir irgendwie zu doof (Aber ja geht auch)
-
Was ist denn da passiert? Prüf mal bitte nach, dass sich hier keine komischen Zeichen eingeschlichen haben. Ich habe kein 3/4 eingetragen.
VG
So sieht der Fehler bei mir im Notepad++ aus (Siehe Bildanhang)
Und ich habe es so gemacht wie du geschrieben hast:
Code: fn_survival.sqf
Alles anzeigen#include "..\script_macros.hpp" /* File: fn_survival.sqf Author: Bryan "Tonic" Boardwine Description: All survival? things merged into one thread. */ private ["_fnc_food","_fnc_water","_foodTime","_waterTime","_bp","_walkDis","_lastPos","_curPos"]; _fnc_food = { if (life_hunger < 2) then {player setDamage 1; hint localize "STR_NOTF_EatMSG_Death";} else { life_hunger = life_hunger - 10; [] call life_fnc_hudUpdate; if (life_hunger < 2) then {player setDamage 1; hint localize "STR_NOTF_EatMSG_Death";}; switch (life_hunger) do { case 30: {hint localize "STR_NOTF_EatMSG_1";}; case 20: {hint localize "STR_NOTF_EatMSG_2";}; case 10: { hint localize "STR_NOTF_EatMSG_3"; if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 1;}; }; }; }; }; _fnc_water = { if (life_thirst < 2) then {player setDamage 1; hint localize "STR_NOTF_DrinkMSG_Death";} else { life_thirst = life_thirst - 10; [] call life_fnc_hudUpdate; if (life_thirst < 2) then {player setDamage 1; hint localize "STR_NOTF_DrinkMSG_Death";}; switch (life_thirst) do { case 30: {hint localize "STR_NOTF_DrinkMSG_1";}; case 20: { hint localize "STR_NOTF_DrinkMSG_2"; if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 1;}; }; case 10: { hint localize "STR_NOTF_DrinkMSG_3"; if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 1;}; }; }; }; }; //Setup the time-based variables. _foodTime = time; _waterTime = time; _walkDis = 0; _bp = ""; _lastPos = visiblePosition player; _lastPos = (_lastPos select 0) + (_lastPos select 1); _lastState = vehicle player; private["_isUnconscious", "_unconsciousTime", "_unconsciousQuest"]; _isUnconscious = false; _unconsciousQuest= false; _unconsciousTime = time; for "_i" from 0 to 1 step 0 do { /* Thirst / Hunger adjustment that is time based */ if ((time - _waterTime) > 600) then {[] call _fnc_water; _waterTime = time;}; if ((time - _foodTime) > 850) then {[] call _fnc_food; _foodTime = time;}; /* Adjustment of carrying capacity based on backpack changes */ if (backpack player isEqualTo "") then { life_maxWeight = LIFE_SETTINGS(getNumber,"total_maxWeight"); _bp = backpack player; } else { if (!(backpack player isEqualTo "") && {!(backpack player isEqualTo _bp)}) then { _bp = backpack player; life_maxWeight = LIFE_SETTINGS(getNumber,"total_maxWeight") + round(FETCH_CONFIG2(getNumber,"CfgVehicles",_bp,"maximumload") / 4); }; }; /* Check if the player's state changed? */ if (!(vehicle player isEqualTo _lastState) || {!alive player}) then { [] call life_fnc_updateViewDistance; _lastState = vehicle player; }; /* Check if the weight has changed and the player is carrying to much */ if (life_carryWeight > life_maxWeight && {!isForcedWalk player}) then { player forceWalk true; if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 1;}; hint localize "STR_NOTF_MaxWeight"; } else { if (isForcedWalk player) then { player forceWalk false; }; }; /* Travelling distance to decrease thirst/hunger which is captured every second so the distance is actually greater then 650 */ if (!alive player) then {_walkDis = 0;} else { _curPos = visiblePosition player; _curPos = (_curPos select 0) + (_curPos select 1); if (!(_curPos isEqualTo _lastPos) && {(isNull objectParent player)}) then { _walkDis = _walkDis + 1; if (_walkDis isEqualTo 650) then { _walkDis = 0; life_thirst = life_thirst - 5; life_hunger = life_hunger - 5; [] call life_fnc_hudUpdate; }; }; _lastPos = visiblePosition player; _lastPos = (_lastPos select 0) + (_lastPos select 1); }; uiSleep 1; }; [] spawn { private["_bp","_load","_cfg"]; while{true} do { waitUntil {backpack player != ""}; _bp = backpack player; _cfg = getNumber(configFile >> "CfgVehicles" >> (backpack player) >> "maximumload"); _load = round(_cfg / 8); life_maxWeight = life_maxWeightT + _load; waitUntil {backpack player != _bp}; if(backpack player == "") then { life_maxWeight = life_maxWeightT; }; }; }; [] call life_fnc_playerTags; [player, uniform player] call life_fnc_equipGear; [] execVM "fullScreenNightVision.sqf"; if(player getVariable ["ACE_isUnconscious", false]) then { if(!_isUnconscious) then { _unconsciousTime = time; _isUnconscious = true; _unconsciousQuest = false; }; if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; _isUnconscious = false; } else { [1] spawn max_callsmanage_fnc_deathMessage; _isUnconscious = false; }; }; } else { _isUnconscious = false; _unconsciousQuest = false; }; uiSleep 1;
-
Code
Alles anzeigenif(player getVariable ["ACE_isUnconscious", false]) then { if[!_isUnconscious] then { _unconsciousTime = time; _isUnconscious = true; _unconsciousQuest = false; }; if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; _isUnconscious = false; } else { [1] spawn max_callsmanage_fnc_deathMessage; _isUnconscious = false; }; }; } else { _isUnconscious = false; _unconsciousQuest = false; };
Probier mal so
-
If mit eckigen klammern? Huch
-
In der Log datei kommt nun kein Fehler mehr davon, jedoch aber auch nicht die anzeige ingame
-
Code
Alles anzeigenif(player getVariable ["ACE_isUnconscious", false]) then { if ([_isUnconscious] isEqualTo false) then { _unconsciousTime = time; _isUnconscious = true; _unconsciousQuest = false; }; if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; _isUnconscious = false; } else { [1] spawn max_callsmanage_fnc_deathMessage; _isUnconscious = false; }; }; } else { _isUnconscious = false; _unconsciousQuest = false; };
Probiere mal das
-
Code
Alles anzeigenif(player getVariable ["ACE_isUnconscious", false]) then { if ([_isUnconscious] isEqualTo false) then { _unconsciousTime = time; _isUnconscious = true; _unconsciousQuest = false; }; if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; _isUnconscious = false; } else { [1] spawn max_callsmanage_fnc_deathMessage; _isUnconscious = false; }; }; } else { _isUnconscious = false; _unconsciousQuest = false; };
Probiere mal
Leider immernoch nicht
-
Function Erstellen Namens "ace_callMedic". Wo und in welchen Ordner ist mir komplette Latte
Code: In die core/init.sqf["ace_unconscious", life_fnc_ace_callMedic ] call CBA_fnc_addEventHandler;
Code: die Datei fn_ace_callMedic
Alles anzeigenprivate _unconsciousTime = time; private _unconsciousQuest = false; while {player getVariable ["ACE_isUnconscious", false]} do { if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; } else { ["Ich benötige einen Mediziner (Dringend!)","**********",2,(mapGridPosition player)] remoteExec ["max_phone_fnc_clientMessage",-2]; hint format [(["STR_SEND_TO_MEDS","Max_Settings_Phone","Phone_Localization"] call theprogrammer_core_fnc_localize),"Ich benötige einen Mediziner"]; if ((getNumber (missionConfigFile >> "Max_Settings_Phone" >> "calls_management_script_enable")) isEqualTo 1) then { maxence_waiting_med_calls pushBack [(name player),(position player),"Ich benötige einen Mediziner (Dringend!)",servertime,"",player,0]; publicVariable "maxence_waiting_med_calls"; }; }; }; };
Sonst noch fragen? Kann ich dir sonst noch etwas vorkauen?
-
Klappt leider immernoch nicht.
Function Erstellen Namens "ace_callMedic". Wo und in welchen Ordner ist mir komplette Latte
Code: In die core/init.sqf["ace_unconscious", life_fnc_ace_callMedic ] call CBA_fnc_addEventHandler;
Code: die Datei fn_ace_callMedic
Alles anzeigenprivate _unconsciousTime = time; private _unconsciousQuest = false; while {player getVariable ["ACE_isUnconscious", false]} do { if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; } else { ["Ich benötige einen Mediziner (Dringend!)","**********",2,(mapGridPosition player)] remoteExec ["max_phone_fnc_clientMessage",-2]; hint format [(["STR_SEND_TO_MEDS","Max_Settings_Phone","Phone_Localization"] call theprogrammer_core_fnc_localize),"Ich benötige einen Mediziner"]; if ((getNumber (missionConfigFile >> "Max_Settings_Phone" >> "calls_management_script_enable")) isEqualTo 1) then { maxence_waiting_med_calls pushBack [(name player),(position player),"Ich benötige einen Mediziner (Dringend!)",servertime,"",player,0]; publicVariable "maxence_waiting_med_calls"; }; }; }; };
Sonst noch fragen? Kann ich dir sonst noch etwas vorkauen?
-
Dann machst du etwas falsch. Es funktioniert bei mir wunderbar auf dem neustem stable Release
-
Was soll ich denn da Falsch machen wenn ich das genauso mache wie du schreibst:
core\init.sqf:
Code
Alles anzeigen#include "..\script_macros.hpp" /* File: init.sqf Author: Bryan "Tonic" Boardwine Description: Master client initialization file */ private ["_handle","_timeStamp","_extDB_notLoaded"]; life_firstSpawn = true; life_session_completed = false; 0 cutText[localize "STR_Init_ClientSetup","BLACK FADED"]; 0 cutFadeOut 9999999; _timeStamp = diag_tickTime; _extDB_notLoaded = ""; diag_log "----------------------------------------------------------------------------------------------------"; diag_log "--------------------------------- Starting Altis Life Client Init ----------------------------------"; diag_log "------------------------------------------ Version 5.0.0 -------------------------------------------"; diag_log "----------------------------------------------------------------------------------------------------"; waitUntil {!isNull player && player == player}; //Wait till the player is ready [] call compile preprocessFileLineNumbers "core\clientValidator.sqf"; enableSentences false; //Setup initial client core functions diag_log "::Life Client:: Initialization Variables"; [] call compile preprocessFileLineNumbers "core\configuration.sqf"; diag_log "::Life Client:: Variables initialized"; diag_log "::Life Client:: Setting up Eventhandlers"; [] call life_fnc_setupEVH; diag_log "::Life Client:: Eventhandlers completed"; diag_log "::Life Client:: Setting up user actions"; [] call life_fnc_setupActions; diag_log "::Life Client:: User actions completed"; diag_log "::Life Client:: Waiting for server functions to transfer.."; waitUntil {(!isNil "TON_fnc_clientGangLeader")}; diag_log "::Life Client:: Received server functions."; 0 cutText [localize "STR_Init_ServerReady","BLACK FADED"]; 0 cutFadeOut 99999999; diag_log "::Life Client:: Waiting for the server to be ready.."; waitUntil {!isNil "life_server_isReady"}; waitUntil {!isNil "life_HC_isActive" && {!isNil "life_server_extDB_notLoaded"}}; if (life_server_extDB_notLoaded) exitWith { 999999 cutText [localize "STR_Init_ExtdbFail","BLACK FADED"]; 999999 cutFadeOut 99999999; }; waitUntil {life_server_isReady}; [] call SOCK_fnc_dataQuery; waitUntil {life_session_completed}; 0 cutText[localize "STR_Init_ClientFinish","BLACK FADED"]; 0 cutFadeOut 9999999; //diag_log "::Life Client:: Group Base Execution"; [] spawn life_fnc_escInterupt; //Set bank amount for new players switch (playerSide) do { case west: { life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_cop"); }; case civilian: { life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_civ"); }; case independent: { life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_med"); }; case east: { life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_kwac"); }; }; if (call life_donorlevel < 1) then { { deleteMarkerLocal _x; } forEach ["vip_shop"]; }; if (call life_adminlevel < 1) then { { deleteMarkerLocal _x; } forEach ["admin_event_npc"]; }; switch (playerSide) do { case west: { _handle = [] spawn life_fnc_initCop; waitUntil {scriptDone _handle}; }; case civilian: { //Initialize Civilian Settings _handle = [] spawn life_fnc_initCiv; waitUntil {scriptDone _handle}; }; case independent: { //Initialize Medics and blah _handle = [] spawn life_fnc_initMedic; waitUntil {scriptDone _handle}; }; case east: { //Initialize KWAC _handle = [] spawn life_fnc_initKwac; waitUntil {scriptDone _handle}; }; }; if(playerSide == civilian) then { { deleteMarkerLocal _x; } forEach ["police_boat_1","police_car_3","police_heli_4","police_car_4","atm_marker_2_10","atm_marker_2_11","atm_marker_1_1","atm_marker_19","police_car_5","police_heli_5","atm_marker_2_12"]; }; if(playerSide == civilian && !license_civ_mafia) then { { deleteMarkerLocal _x; } forEach ["Rebelop_3","civ_gar_1_8","atm_marker_24","marker_250"]; }; if(playerSide == west) then { { deleteMarkerLocal _x; } forEach ["Rebelop_2","Rebelop_1","Rebelop_3","Dealer_1_3","Dealer_1_4","rifle processing","frosch_process","Weed_p_1","chop_shop_2","cocaine processing","gang_area_2","gang_area_1","gold_bar_dealer"]; }; if(playerSide == independent) then { { deleteMarkerLocal _x; } forEach ["police_boat_1","police_car_3","police_heli_4","police_car_4","police_car_5","police_heli_5"]; }; player setVariable ["restrained",false,true]; player setVariable ["Escorting",false,true]; player setVariable ["transporting",false,true]; player setVariable ["playerSurrender",false,true]; diag_log "Past Settings Init"; [] execFSM "core\fsm\client.fsm"; diag_log "Executing client.fsm"; waitUntil {!(isNull (findDisplay 46))}; diag_log "Display 46 Found"; (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call life_fnc_keyHandler"]; player addRating 99999999; [player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_manageSC",RSERV]; 0 cutText ["","BLACK IN"]; [] call life_fnc_hudSetup; /* Set up frame-by-frame handlers */ LIFE_ID_PlayerTags = ["LIFE_PlayerTags","onEachFrame","life_fnc_playerTags"] call BIS_fnc_addStackedEventHandler; LIFE_ID_RevealObjects = ["LIFE_RevealObjects","onEachFrame","life_fnc_revealObjects"] call BIS_fnc_addStackedEventHandler; player setVariable ["steam64ID",getPlayerUID player]; player setVariable ["realname",profileName,true]; life_fnc_moveIn = compileFinal " life_disable_getIn = false; player moveInCargo (_this select 0); life_disable_getOut = true; "; life_fnc_RequestClientId = player; publicVariableServer "life_fnc_RequestClientId"; //Variable OwnerID for HeadlessClient [] spawn life_fnc_survival; [] spawn { for "_i" from 0 to 1 step 0 do { waitUntil {(!isNull (findDisplay 49)) && {(!isNull (findDisplay 602))}}; // Check if Inventory and ESC dialogs are open (findDisplay 49) closeDisplay 2; // Close ESC dialog (findDisplay 602) closeDisplay 2; // Close Inventory dialog }; }; CONSTVAR(life_paycheck); //Make the paycheck static. if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 0) then {player enableFatigue false;}; if (LIFE_SETTINGS(getNumber,"pump_service") isEqualTo 1) then { [] execVM "core\fn_setupStationService.sqf"; }; /* https://feedback.bistudio.com/T117205 - disableChannels settings cease to work when leaving/rejoining mission Universal workaround for usage in a preInit function. - AgentRev Remove if Bohemia actually fixes the issue. */ { _x params [["_chan",-1,[0]], ["_noText","false",[""]], ["_noVoice","false",[""]]]; _noText = [false,true] select ((["false","true"] find toLower _noText) max 0); _noVoice = [false,true] select ((["false","true"] find toLower _noVoice) max 0); _chan enableChannel [!_noText, !_noVoice]; } forEach getArray (missionConfigFile >> "disableChannels"); if (life_HC_isActive) then { [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["HC_fnc_wantedProfUpdate",HC_Life]; } else { [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["life_fnc_wantedProfUpdate",RSERV]; }; life_hideoutBuildings = []; { private _building = nearestBuilding getMarkerPos _x; life_hideoutBuildings pushBack _building; false } count ["gang_area_1","gang_area_2"]; DYNAMICMARKET_boughtItems = []; ["ace_unconscious", life_fnc_ace_callMedic ] call CBA_fnc_addEventHandler; [player] remoteExec ["TON_fnc_playerLogged",RSERV]; diag_log "----------------------------------------------------------------------------------------------------"; diag_log format [" End of Altis Life Client Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp]; diag_log "----------------------------------------------------------------------------------------------------"; [] spawn theprogrammer_core_fnc_clientInit;
core/functions/fn_ace_callMedic.sqf:
Code
Alles anzeigenprivate _unconsciousTime = time; private _unconsciousQuest = false; while {player getVariable ["ACE_isUnconscious", false]} do { if (((time - _unconsciousTime) > (15*60)) && !_unconsciousQuest) then { _unconsciousQuest = true; private _action = [ "Du warst nun 15 Minuten Bewusstlos, möchtest du dein Leben beenden?", "Der Himmel", "Ja", "Nein" ] call BIS_fnc_guiMessage; if(_action) then { player setdamage 1; } else { ["Ich benötige einen Mediziner (Dringend!)","**********",2,(mapGridPosition player)] remoteExec ["max_phone_fnc_clientMessage",-2]; hint format [(["STR_SEND_TO_MEDS","Max_Settings_Phone","Phone_Localization"] call theprogrammer_core_fnc_localize),"Ich benötige einen Mediziner"]; if ((getNumber (missionConfigFile >> "Max_Settings_Phone" >> "calls_management_script_enable")) isEqualTo 1) then { maxence_waiting_med_calls pushBack [(name player),(position player),"Ich benötige einen Mediziner (Dringend!)",servertime,"",player,0]; publicVariable "maxence_waiting_med_calls"; }; }; }; };
-
Auch als Function eingetragen?
-