Doppelganger
Well-Known Member
Hello,
so the self blood script has a way to interrupt if you need to by moving. I currently have a suicide script on my server and would like to add the interrupt ability to it, but im not sure i can figure it out.
anyone mind giving it a shot?
Interrupt Code
Suicide Code
Code for selfaction
so the self blood script has a way to interrupt if you need to by moving. I currently have a suicide script on my server and would like to add the interrupt ability to it, but im not sure i can figure it out.
anyone mind giving it a shot?
Interrupt Code
Code:
////////////////////////////////////////////////
// Fancy cancel if interrupted addition start //
////////////////////////////////////////////////
r_interrupt = false; // public interuppt variable
_animState = animationState player; // get the animation state of the player
r_doLoop = true; // while true sets whether to continue self bloodbagging
_started = false; // this starts as false as a check
_finished = false; // this starts as false and when true later sets players blood
while {r_doLoop} do {
_animState = animationState player; // keep checking to make sure player is in correct animation
_isMedic = ["medic",_animState] call fnc_inString; // checking to make sure the animstate is the medic animation still
if (_isMedic) then {
_started = true; // this is a check to make sure everything is still ok
};
if(!_isMedic && !r_interrupt && (time - _bloodbagUsageTime) < _bloodbagUseTime) then {
player playActionNow "Medic"; //play bloodbag animation
_isMedic = true;
};
if (_started && !_isMedic && (time - _bloodbagUsageTime) > _bloodbagUseTime) then {
r_doLoop = false; // turns off the loop
_finished = true; // set finished to true to finish the self bloodbag and give player health/humanity
lastBloodbag = time; // the last self bloodbag time
};
if (r_interrupt) then {
r_doLoop = false; // if interuppted turns loop off early so _finished is never true
};
sleep 0.1;
};
r_doLoop = false; // make sure loop is off on successful self bloodbag
///////////////////////////////////////////////
// Fancy cancel if interrupted addition end //
//////////////////////////////////////////////
Suicide Code
Code:
//designed by WTF-Kaysio
//www.WTF-Gaming.co.uk
private ["_Secondary"];
canAbort = true;
_Secondary = currentWeapon player;
player addEventHandler ["fired", {if (alive player) then { player SetDamage 1.1;};}];
cutText [format["You think about your family... 10 Seconds"], "PLAIN DOWN"];
sleep 4;
cutText [format["Your little daughter, and what happened to her... 6 Seconds"], "PLAIN DOWN"];
sleep 4;
cutText [format["You cant take this shit any longer... 2 Seconds"], "PLAIN DOWN"];
sleep 2;
cutText [format["Goodbye cruel world!"], "PLAIN DOWN"];
canAbort = false;
player playmove "ActsPercMstpSnonWpstDnon_suicide1B";
sleep 8.4;
player fire _Secondary;
Code for selfaction
Code:
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 like a boss") +"</t>"),"custom\suicide.sqf",_handGun,0,false,true,"", ""];
};
} else {
player removeAction s_player_suicide;
s_player_suicide = -1;
};