Suicide Script Confirmation

Discussion in 'Scripting Discussions' started by xProlithium, Sep 3, 2013.

  1. xProlithium

    xProlithium New Member

    Joined:
    Dec 31, 2012
    Messages:
    6
    Likes Received:
    1
    The current suicide script is perfect for doing exactly what it is intended for. Is there a possible way to add a confirmation to that? Perhaps another scroll wheel option saying "Confirm" and "Back out"?
     
  2. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    The easiest way to do this would to have the original fn_selfActions point to a menu that says Confirm - this would then point to the suicide script, or exit. Would be easy to set up
     
  3. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    have the fn_selfActions point to suicide_exec.sqf :
    Code:
    systemChat ('Are you sure you wish to kill yourself?');
    cutText ["                \nUse your scroll wheel to confirm or deny!","PLAIN"];
    execVM "suicide\suicide_confirm.sqf";
    then in the suicide folder (you can change filepaths of course, just make sure you do it in the menu itself also) place suicide_confirm.sqf :
    Code:
    pathtosuicide = "suicide\";
    EXECscript1 = 'player execVM "'+pathtosuicide+'%1"';
     
    Suicideconfirm =
    [
        ["",false],
            ["Confirm suicide?", [2], "", -5, [["expression", format[EXECscript1,"suicide.sqf"]]], "1", "1"],
            ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
       
    ];};
     
    showCommandingMenu "#USER:Suicideconfirm";
    of course suicide.sqf would be whatever yours is named, and make sure to change the pathtosuicide as according as well.

    EDIT: fixed missing brackets...sorry guys
     
    xProlithium likes this.
  4. xProlithium

    xProlithium New Member

    Joined:
    Dec 31, 2012
    Messages:
    6
    Likes Received:
    1
    Thanks :)
     
    Matt L likes this.
  5. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    goodluck
     
  6. sukkaed

    sukkaed Well-Known Member

    Joined:
    May 1, 2013
    Messages:
    173
    Likes Received:
    14
    I tried something similar but I didn't get it to work. Can you report back how this goes.
     
  7. Cerberus814

    Cerberus814 Member

    Joined:
    Aug 9, 2013
    Messages:
    35
    Likes Received:
    0
    Hey nice idea!!, :)
    This is my selfactions suicide script:
    Code:
    // ---------------------------------------SUICIDE START------------------------------------
     
    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)) then {
        hasSecondary = true;
    } else {
        hasSecondary = false;
    };
    if((speed player <= 1) && hasSecondary && _canDo) then {
        if (s_player_suicide < 0) then {
            s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"suicide.sqf",_handGun,0,false,true,"", ""];
        };
    } else {
        player removeAction s_player_suicide;
        s_player_suicide = -1;
    };
     
    // ---------------------------------------SUICIDE END------------------------------------
    Where to put the code you give?... and the second code is a separated script right?

    thanks
     
  8. Cerberus814

    Cerberus814 Member

    Joined:
    Aug 9, 2013
    Messages:
    35
    Likes Received:
    0
    @Matt L can you help me with this?.
     
  9. Essix

    Essix Member

    Joined:
    May 8, 2013
    Messages:
    68
    Likes Received:
    3
    ya nothing comes up for confirmation on the scroll wheel. it does initiate the suicide_exec though but everytime i hit commit suicide again it just repeats asking am i sure i want to kill myself
     
  10. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    do you have the actual menu pointing to the script itself? Sounds like you have the menu pointing back to suicide_exec
     
  11. Essix

    Essix Member

    Joined:
    May 8, 2013
    Messages:
    68
    Likes Received:
    3
    i have fn_selfactions pointing to suicide_exec.sqf then i have suicide_exec.sqf pointing to suiccide_confirm.sqf, then suicide_confirm.sqf is pointing to the actual suicide.sqf

    fn_selfactions executes the suicide_exec.sgf because it actually shows the text ingame but just no confirmation selection
    Code:
    systemChat ('Are you sure you wish to kill yourself?');
    cutText ["                \nUse your scroll wheel to confirm or deny!","PLAIN"];
    execVM "suicide\suicide_confirm.sqf";
     
  12. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    add me on skype mattlampley96 and send me the files one by one, i'll double check it all
     
  13. mr mischief

    mr mischief Member

    Joined:
    May 25, 2013
    Messages:
    54
    Likes Received:
    2
    i seem to have the same problem if you guys sort it can i have a copy of your files plz :)
     
  14. Peter Brennan

    Peter Brennan Member

    Joined:
    Jul 14, 2013
    Messages:
    48
    Likes Received:
    0
    this defs isnt working
     
  15. Peter Brennan

    Peter Brennan Member

    Joined:
    Jul 14, 2013
    Messages:
    48
    Likes Received:
    0
    this is my error log

    Code:
    showCommandingMenu "#USER:Suicideco>
      Error position: <;};
     
    showCommandingMenu "#USER:Suicideco>
      Error Missing ]
    File mpmissions\__CUR_MP.chernarus\addons\suicide\suicide_confirm.sqf, line 11
    Error in expression <, -3, [["expression", ""]], "1", "1"]
     
    ];};
     
  16. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    I made a noob error, I believe.
    Code:
    ["Confirm suicide?", [2], "", -5, [["expression", format[EXECscript1,"suicide.sqf"]], "1", "1"],
    the part that executes the script has 3 opening brackets and 2 closing, needs an extra one. I coded this hastily, i'm sorry. Will fix my original post
     
  17. Peter Brennan

    Peter Brennan Member

    Joined:
    Jul 14, 2013
    Messages:
    48
    Likes Received:
    0
    Hate to be the bearer of bad news matty but still no good!? here are my edit files just incase ive messed it up

    fn_selfActions.sqf
    Code:
    // ---------------------------------------SUICIDE START------------------------------------
     
    private ["_handGun"];
    _handGun = currentWeapon player;
    if ((_handGun in ["revolver_gold_EP1","glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0)) then {
        hasSecondary = true;
    } else {
        hasSecondary = false;
    };
    if (player ammo _handGun == 1) then {
        lastRound = true;
    } else {
        lastRound = false;
    };
    if((speed player <= 1) && hasSecondary && lastRound && _canDo) then {
        if (s_player_suicide < 0) then {
            s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"addons\suicide\suicide_init.sqf",_handGun,0,false,true,"", ""];
        };
    } else {
        player removeAction s_player_suicide;
        s_player_suicide = -1;
    };
     
    // ---------------------------------------SUICIDE END------------------------------------
    suicide_init.sqf

    Code:
    systemChat ('Are you sure you wish to kill yourself?');
    cutText ["                \nUse your scroll wheel to confirm or deny!","PLAIN"];
    execVM "addons\suicide\suicide_confirm.sqf";
    suicide_confirm.sqf

    Code:
    pathtosuicide = "addons\suicide\";
    EXECscript1 = 'player execVM "'+pathtosuicide+'%1"';
     
    Suicideconfirm =
    [
        ["",false],
            ["Confirm suicide?", [2], "", -5, [["expression", format[EXECscript1,"suicide.sqf"]]], "1", "1"],
            ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
     
    ];};
     
    showCommandingMenu "#USER:Suicideconfirm";
    made that change.. removed the extra addons/suicide/
     
  18. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    Code:
    pathtosuicide = "addons\suicide\";
    EXECscript1 = 'player execVM "'+pathtosuicide+'%1"';
     
    Suicideconfirm =
    [
        ["",false],
            ["Confirm suicide?", [2], "", -5, [["expression", format[EXECscript1,"addons\suicide\suicide.sqf"]]], "1", "1"],
            ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
     
    ];};
     
    showCommandingMenu "#USER:Suicideconfirm";

    Code:
    pathtosuicide = "addons\suicide\";
    Code:
    [["expression", format[EXECscript1,"addons\suicide\suicide.sqf"]]]
    After EXECscript1 it should just be suicide.sqf, otherwise it's looking for it in a folder called addons\suicide\addons\suicide\suicide.sqf
     
  19. Peter Brennan

    Peter Brennan Member

    Joined:
    Jul 14, 2013
    Messages:
    48
    Likes Received:
    0
    i made that chasnge but still no good. im not getting the option to confirm or exit... sorry to be a pain matty, i wish i knew more about this to help with it
     
  20. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    OH DO YOU HAVE AN ANTIHACK
     

Share This Page