• 0
Ton_41

How to antisuicide in server

Question

13 answers to this question

  • 0

I've overwritten and use ExileClientPlayerIsBambi in the ExileClient_gui_escape_suicide.sqf as a quantifier whether the player can suicide or not. Here's an if-statement with an exitWith to get you started:

if (ExileClientPlayerIsBambi) exitWith {

titleText ["You are too young to die", "PLAIN",1];

};

 

Edited by Tobias Solem
  • Like 2

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Tobias Solem said:

I've overwritten and use ExileClientPlayerIsBambi in the ExileClient_gui_escape_suicide.sqf as a quantifier whether the player can suicide or not. Here's an if-statement with an exitWith to get you started:


if (ExileClientPlayerIsBambi) exitWith {

titleText ["You are too young to die", "PLAIN",1];

};

 

Could this be worked in the same way but with a time alive restriction or X amount of suicides in Y amount of time restriction? I find on my server, players suicide over and over to farm cars around spawn areas and I've not found a suitable way to stop them.

Share this post


Link to post
Share on other sites
Advertisement
  • 0
11 hours ago, kuplion said:

Could this be worked in the same way but with a time alive restriction or X amount of suicides in Y amount of time restriction? I find on my server, players suicide over and over to farm cars around spawn areas and I've not found a suitable way to stop them.

Certainly. 

I'm not a coder, or skilled at coding but you could try doing a global variable somewhere and add to it when the player committed suicide, like _suicideTimes++ and then have a check for it in the suicide-overwrite, like  if (_suicideTimes > 5) exitwith {  - where 5 would be the max amount of times they could suicide during a server restart.

Edited by Tobias Solem
Well, "would have to" sounds like I know shit xD
  • Like 2

Share this post


Link to post
Share on other sites
  • 0
6 minutes ago, Tobias Solem said:

Certainly. 

I'm not a coder, or skilled at coding but you would have to do a global variable somewhere and add to it when the player committed suicide, like _suicideTimes++ and then have a check for it in the suicide-overwrite, like  if (_suicideTimes > 5) exitwith {  - where 5 would be the max amount of times they could suicide during a server restart.

Wouldn't that be neglected the moment they log out and back in?

Share this post


Link to post
Share on other sites
  • 0
10 minutes ago, InsertCoins said:

Wouldn't that be neglected the moment they log out and back in?

Good question. Someone who actually is proficient with this will surely answer this :)

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Tobias Solem said:

Certainly. 

I'm not a coder, or skilled at coding but you could try doing a global variable somewhere and add to it when the player committed suicide, like _suicideTimes++ and then have a check for it in the suicide-overwrite, like  if (_suicideTimes > 5) exitwith {  - where 5 would be the max amount of times they could suicide during a server restart.

Thank you, dude. I'll have a play on my test server and see what I can come up with.

Share this post


Link to post
Share on other sites
  • 0

If you simply wish to disable the option all together, use this:

Spoiler

ExileClient_gui_escape_suicide.sqf


/**
 * ExileClient_gui_escape_suicide
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */

_sorry = format ["Sorry %1, the suicide option is disabled.", name player];
["whoops", [_sorry]] call ExileClient_gui_notification_event_addNotification;
true

 

To prevent bambis from having the option use this:

Spoiler

ExileClient_gui_escape_suicide.sqf


/**
 * ExileClient_gui_escape_suicide
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */

if (ExileClientPlayerIsBambi) exitWith {
	_nahBruh = format ["Start running %1, you're not getting off that easily!", name player];
	["whoops", [_nahBruh]] call ExileClient_gui_notification_event_addNotification;
}; 
private["_result","_display"];
disableSerialization;
_result = ["Do you really want to end your life?", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
waitUntil { !isNil "_result" };
if (_result) then
{
	_display = findDisplay 49;
	if !(isNull _display) then
	{
		_display closeDisplay 2; 
	};
	player allowDamage true;
	player setDamage 1;
};
true

 

 

 

Bare with me on this last one, I am learning as I go here lol. After my ISP gave me a free "upgrade" I have had trouble getting my ports to forward again, so I'm the only one who can get on my test server. I have tested this as working with just me on the server. I am literally brand new to setting/getting variables. What I am not sure of, is if this variable is being shared between all clients, or only the client dying/ trying to commit suicide. But if you care to test it and let me know if it works properly or not, here it is.

Edit: Got my port issues resolved. Tested and working.

 

To set a certain time period in which a player cannot commit suicide after death overwrite these 2 files:

Spoiler

ExileClient_gui_escape_suicide.sqf

 


/**
 * ExileClient_gui_escape_suicide
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
_canSuicide = missionNamespace getVariable "suicideCountDown";
_difference = _canSuicide - time;
if (time < _canSuicide) exitWith {
	_display = findDisplay 49;
	_display closeDisplay 2;
	_nahBruh = format ["Sorry %1, you must wait at least %2 seconds before you can commit suicide!", name player, floor _difference];
	["whoops", [_nahBruh]] call ExileClient_gui_notification_event_addNotification;
};
private["_result","_display"];
disableSerialization;
_result = ["Do you really want to end your life?", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
waitUntil { !isNil "_result" };
if (_result) then
{
	_display = findDisplay 49;
	if !(isNull _display) then
	{
		_display closeDisplay 2; 
	};
	player allowDamage true;
	player setDamage 1;
};
true

 

and

Spoiler

ExileClient_object_player_event_onKilled.sqf


/**
 * ExileClient_object_player_event_onKilled
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
closeDialog 0;
ExileClientLastDiedPlayerObject = player;
ExileClientIsAutoRunning = false;
if !((vehicle player) isEqualTo player) then
{
	unassignVehicle player; 
	player action ["GetOut", vehicle player]; 
	player action ["Eject", vehicle player];
};
setGroupIconsVisible [false, false];
false call ExileClient_gui_hud_toggle;
[] call ExileClient_object_player_event_unhook;
if !(ExileClientLastDeathMarker isEqualTo "") then 
{
	deleteMarkerLocal ExileClientLastDeathMarker;
};
ExileClientLastDeathMarker = createMarkerLocal [format ["Death%1", time], getPos player];
ExileClientLastDeathMarker setMarkerShapeLocal "ICON";
ExileClientLastDeathMarker setMarkerTypeLocal "KIA";
ExileClientLastDeathMarker setMarkerColorLocal "ColorRed";
ExileClientLastDeathMarker setMarkerAlphaLocal 0.5;
if (ExileClientIsInBush) then 
{
	call ExileClient_object_bush_detach;
};
if !(ExileClientBreakFreeActionHandle isEqualTo -1) then 
{
	player removeAction ExileClientBreakFreeActionHandle;
	ExileClientBreakFreeActionHandle = -1;
};
ExileClientIsHandcuffed = false;
ExileClientHostageTaker = objNull;
_hold = 300;															// Time in seconds for player to wait. Default 300 (5min)
canSuicide = time + _hold;         
missionNamespace setVariable ["suicideCountDown", canSuicide];
[] call ExileClient_system_breathing_event_onPlayerDied;
[] call ExileClient_system_snow_event_onPlayerDied;
[] call ExileClient_system_radiation_event_onPlayerDied;

 

You can define how long they have to wait after death in ExileClient_object_player_event_onKilled.sqf  (Default is 5 min)

Updated: Got rid of the sloppy decimals on timer and made it close the esc dialog. (ExileClient_gui_escape_suicide.sqf for timed method)

Hope this helps =D

Edited by oSoDirty
  • Like 3

Share this post


Link to post
Share on other sites
  • 0

@kuplion no problem, I have made a small change to the timed method inside the file ExileClient_gui_escape_suicide.sqf. Gets rid of numbers after decimal and closes the esc dialog.

Original answer updated for those who have not used it already as well.

Change 

if (time < _canSuicide) exitWith {
	_nahBruh = format ["Sorry %1, you must wait at least %2 seconds before you can commit suicide!", name player, _difference];
	["whoops", [_nahBruh]] call ExileClient_gui_notification_event_addNotification;
};

to

if (time < _canSuicide) exitWith {
	_display = findDisplay 49;
	_display closeDisplay 2;
	_nahBruh = format ["Sorry %1, you must wait at least %2 seconds before you can commit suicide!", name player, floor _difference];
	["whoops", [_nahBruh]] call ExileClient_gui_notification_event_addNotification;
};

 

Edited by oSoDirty
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.