Error Undefined variable in expression: is_confirmation

herculys

Member
i installed this script
http://epochmod.com/forum/index.php?/topic/10209-dramatic-suicide-script/

the script is working fine, but i got spam with this error:
Code:
if ((is_confirmation == 0) && (s_player_suici>
  Error position: <is_confirmation == 0) && (s_player_suici>
  Error Undefined variable in expression: is_confirmation
File mpmissions\__CUR_MP.Chernarus\custom\fn_selfActions.sqf, line 968

any tip?


this is the fn_selfactions.sqf block:
Code:
//suicide
private ["_handGun"];
_handGun = currentWeapon player;
if ((_handGun in ["glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0) && canStand player && (speed player <= 1) && _canDo) then {
    if ((is_confirmation == 0) && (s_player_suicide < 0)) then {
        name_on_menu = "<t color=""#d00020"">Se Suicidar!</t>";
        s_player_suicide = player addaction[(name_on_menu),"custom\suicide.sqf",_handGun,0,false,true,"", ""];
    };
    if ((is_confirmation == 1) && (s_player_suicide_confirm < 0)) then {
        name_on_menu = "<t color=""#d00020"">Confirmar Suicidio!</t>";
        s_player_suicide_confirm = player addaction[(name_on_menu),"custom\suicide.sqf",_handGun,0,false,true,"", ""];
    };
} else {
    if (is_confirmation == 0) then {
        player removeAction s_player_suicide;
    };
    if (is_confirmation == 1) then {
        player removeAction s_player_suicide_confirm;
    };
    s_player_suicide = -1;
    s_player_suicide_confirm = -1;
    is_confirmation = 0;
};
 
Did I not reply to this already? I was sure I did ..
The reason its undefined is because the script tests for is_confirmation == 1 and is_confirmation ==0 before its ever assigned any value. is_confirmation is only assigned a value if you want to commit suicide and then either say yes or no. Until then it has no value.
The solution is to open up your variables.sqf file which should have already been imported into your mission folder and add a line anywhere, at the top is convenient.
is_confirmation = 0;
Of if that does not work because for some reason of the way the script is written you would assign it to be equal to -1.
 
Back
Top