Jump to content
  • 0

Need help with my new script.


lmapper

Question

What's wrong, guys ?

Action just dont appear when player got hemp.

 

fn_selfactions.sqf

if ("ItemKiloHemp" in _mags) then { // KiloHempScript by me :D
	if (s_player_hemp < 0) then {
		s_player_hemp = player addaction["Smoke hemp","scripts\hemp.sqf","",2,false,true,"", ""];
	} else {
		player removeAction s_player_hemp;
		s_player_hemp = 		-1;
	};
};
Link to comment
Share on other sites

Recommended Posts

  • 0
_PupleHaze = (magazines player) + (weapons player);  //dont know what slot it goes in to.
if ("ItemKiloHemp" in _PupleHaze) then {
        hasWeed = true;
    } 
   else 
   { 
      hasWeed = false;
   };
    if((speed player <= 1) && hasWeed && _canDo) then { //stand still and can do it
        if (s_player_weedsmokers < 0) then {
            s_player_weedsmokers = player addaction[("<t color=""#66CD00"">" + ("Smoke Weed Erry Day") +"</t>"),"scripts\hemp.sqf","",5,false,true,"", ""];
			sleep 3;
			player removeWeapon "ItemKiloHep"; //removes the weed			
        };
    } else {
        player removeAction s_player_weedsmokers;
       s_player_weedsmokers = -1;
};

Try this, you may need to change it abit to your own liking I guess.

Link to comment
Share on other sites

  • 0
_PupleHaze = (magazines player) + (weapons player);  //dont know what slot it goes in to.
if ("ItemKiloHemp" in _PupleHaze) then {
        hasWeed = true;
    } 
   else 
   { 
      hasWeed = false;
   };
    if((speed player <= 1) && hasWeed && _canDo) then { //stand still and can do it
        if (s_player_weedsmokers < 0) then {
            s_player_weedsmokers = player addaction[("<t color=""#66CD00"">" + ("Smoke Weed Erry Day") +"</t>"),"scripts\hemp.sqf","",5,false,true,"", ""];
			sleep 3;
			player removeWeapon "ItemKiloHep"; //removes the weed			
        };
    } else {
        player removeAction s_player_weedsmokers;
       s_player_weedsmokers = -1;
};

Try this.

 player removeWeapon "ItemKiloHep";

player removeMagazine "ItemKiloHemp";

 

 player removeWeapon "ItemKiloHep";

 

I cant remove it in fn_selfactions.

Weed removed by checking in the script (if the player has no paper cigars - just displays a message and weed should not be removed in this case).

 

((speed player <= 1) && hasWeed && _canDo)

 

I dont need speed check and, _cando cant help me now.

 

 

 

hasWeed = true;

I already try this, but I'll do it again.

 

Thanks for reply.

Link to comment
Share on other sites

  • 0

Thats not the major part though, you still need 

if((speed player <= 1) && hasWeed && _canDo) then { //stand still and can do it

Maybe not speed and cando but this is very much needed otherwise the code wont run cuz it doesnt know what to check against.

Tip is to use my code and just remove the remove function and change the variable names, it works. Speed can also be removed if you want people to be able to do the action while on the move.

Link to comment
Share on other sites

  • 0

Thats not the major part though, you still need 

if((speed player <= 1) && hasWeed && _canDo) then { //stand still and can do it

Maybe not speed and cando but this is very much needed otherwise the code wont run cuz it doesnt know what to check against.

Tip is to use my code and just remove the remove function and change the variable names, it works. Speed can also be removed if you want people to be able to do the action while on the move.

Ok. I'ill try it. ty.

Link to comment
Share on other sites

  • 0

I will try this:

if ("ItemKiloHemp" in _mags && (speed player <= 1) && _canDo) then { // KiloHempScript by me :D
	if (s_player_hemp < 0) then {
		s_player_hemp = player addaction["Выкурить косяк","scripts\hemp.sqf","",2,false,true,"", ""];
	} else {
		player removeAction s_player_hemp;
		s_player_hemp = 		-1;
	};
};
Link to comment
Share on other sites

  • 0
_mags = magazines player;
if (("ItemKiloHemp" in _mags) && (speed player <= 1) && _canDo) then {

 

top of fn_selfactions.sqf

v8ywX2z.png

 

 

This my script ins't work too :(

_teleports_locations =
[
[2194.91,12838.1,0.00143433,       "Войти в бункер",              14657.8,14696,1.56864],
[14657.8,14696,1.56864,            "Выйти из бункера",       2194.91,12838.1,0.00143433],
[3915.79,10776.2,0.0,              "Moscow Metro",                  5615.73,10776.2,0.0]
];

{
	if ((player distance [(_x select 0), (_x select 1), (_x select 2)]) < 8) then { // 8 - Teleport checkpoint radius
		if (s_player_onteleport < 0) then { 
				s_player_onteleport = player addAction [format["%1"], (_x select 3)],"scripts\teleporter.sqf",[_x], 6, false, true,"",""];
				} else {
				player removeAction s_player_onteleport;
				s_player_onteleport = 		-1;
				};
			};
} forEach _teleports_locations;
*/
Link to comment
Share on other sites

  • 0

 

Well that looks really weird to me but your previous problem was missing brackets here

if (("ItemKiloHemp" in _mags) && (speed player <= 1) && _canDo) then {

 

Where's extacly ?

 

if (("ItemKiloHemp" in _mags) && (speed player <= 1) && _canDo) then {

Link to comment
Share on other sites

  • 0

Use the line I gave you, that one works.. no need to add arrays and what not in your boolean.

hasWeed is already defined earlier in my script and you can find it if you scroll up, I'm very sure it works. I have the same script on my servers, just with a different variable name.

 if((speed player <= 1) && hasWeed && _canDo) then { 
Link to comment
Share on other sites

  • 0

 

Use the line I gave you, that one works.. no need to add arrays and what not in your boolean.

hasWeed is already defined earlier in my script and you can find it if you scroll up, I'm very sure it works. I have the same script on my servers, just with a different variable name.

 if((speed player <= 1) && hasWeed && _canDo) then { 

 

I have bad English - i haven't hasWeed define at my fn_selfaction,

i need to write it like:

hasWeed = "ItemKiloHemp" in _mags;

? ty for reply.

Link to comment
Share on other sites

  • 0

Still isnt work, wtf ?

_mags = magazines player;
hasWeed = "ItemKiloHemp" in _mags;
_onLadder =		(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
if((speed player <= 1) && hasWeed && _canDo) then {  // KiloHempScript by me :D
	if (s_player_hemp < 0) then {
		s_player_hemp = player addaction["Выкурить косяк","scripts\hemp.sqf","",2,false,true,"", ""];
	} else {
		player removeAction s_player_hemp;
		s_player_hemp = 		-1;
	};
};
Link to comment
Share on other sites

  • 0

I don't see why that wouldn't work. Not sure why your hasWeed is global variable. To make it simple just do it like this.

_hasWeed = "ItemKiloHemp" in magazines player;
if (_hasWeed) then {

If that doesn't work, you have problems somewhere else.

Link to comment
Share on other sites

  • 0

I don't see why that wouldn't work. Not sure why your hasWeed is global variable. To make it simple just do it like this.

_hasWeed = "ItemKiloHemp" in magazines player;
if (_hasWeed) then {

If that doesn't work, you have problems somewhere else.

 

_value, when "_" - means local variable ?

Link to comment
Share on other sites

  • 0

Lol, idk why, but:

 

I'snt work:

if ("ItemKiloHemp" in _mags) then {
	if (s_player_hemp < 0) then {
		s_player_hemp = player addaction["Smoke hemp","scripts\hemp.sqf","",2,false,true,"", ""];
	} else {
		player removeAction s_player_hemp;
		s_player_hemp = 		-1;
	};
};

Working code:

if ("ItemKiloHemp" in _mags) then {
		s_player_hemp = player addaction["Smoke hemp","scripts\hemp.sqf","",2,false,true,"", ""];
};

But then addaction's fill all menu.

Link to comment
Share on other sites

  • 0

I don't see why that wouldn't work. Not sure why your hasWeed is global variable. To make it simple just do it like this.

_hasWeed = "ItemKiloHemp" in magazines player;
if (_hasWeed) then {

If that doesn't work, you have problems somewhere else.

 

isnt work too, now i'll try without   if (s_player_hemp < 0)....

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...