Jump to content
Sign in to follow this  
Naiss

_this select problem? help

Recommended Posts

okey so im making a jail system but when i try to get the jail time from a edit box it's not working... here is the code and the error i get:

Error:

http://i.gyazo.com/2976468c7b372cbb4556c48f914bf517.png

Code:

Jail_TimerSec = 0;
Jail_Timermin = 0;
Jail_Timerhour = 0;

ARPG_Jail_set = {
[] spawn {
	private ["_s","_m","_h"];
	_s = ctrlText 1400;
	_m = ctrlText 1401;
	_h = ctrlText 1402;

	if ((parseNumber _s) < 1) exitwith {hint "You Can't Arrest someone for less then 1 Second";};

	if (!Alive player) exitWith {
		hint "Error";
	};

	[[player, _s,_m,_h], "ARPG_Jail_go", player] spawn BIS_FNC_MP;
};
};

ARPG_Jail_go = {
	hint format ["%1 Arrest you!", name player];

	_s = _this select 1;
	_m = _this select 2;
	_h = _This select 3;

	if (_s != "") then {
		Jail_TimerSec = Jail_TimerSec + _s;
	};

	if (_m != "") then {
		Jail_Timermin = Jail_Timermin + _m;
	};

	if (_h != "") then {
		Jail_Timerhour = Jail_Timerhour + _h;
	};


	_msg = format ["%1 was arrest by: %2 for: %3:%4:%5", name player, name player, Jail_Timerhour, Jail_Timermin, Jail_TimerSec];
	[[player,_msg], "ARPG_Jail_msg", true] call BIS_FNC_MP;
};

+ that this wont even work

if (Jail_Timermin == 0) then {
Jail_Timerhour = Jail_Timerhour - 1;
};

Share this post


Link to post
Share on other sites

"_s" is a string, while Jail_TimerSec is an integer, same for all your other "jailTime + somethings".

The reason, ctrlText command returns a string.

Try:

Jail_TimerSec = str(Jail_TimerSec) + _s;

Share this post


Link to post
Share on other sites

wops i did something wrong and here is how i fixed it:

_s = round(parseNumber(ctrlText 1400));

_m = round(parseNumber(ctrlText 1401));

_h = round(parseNumber(ctrlText 1402));

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×