Jump to content
Sign in to follow this  
dr death jm

looking to add count ammo to my script, need help

Recommended Posts

I'm making a new script/server side addon for suicide, as it is , it works awesome

but I need a way to count ammo so when player is at 0 ammo he can get the suicide

action, as it is now it can be done at any time and as fun as it is , players will tend to use the action menu instead of playing mission. :rolleyes:   

lightning_Install = {

  if(!isNil "lightning_INIT") exitWith {};
  lightning_INIT = true;
  
lightning_suicide = {
if (!alive player) exitWith {};

params ["_target","_turntable","_logic"];

_turntable = createVehicle ["Land_PenBlack_F",_this select 0,[],0,"CAN_COLLIDE"];
_turntable hideObjectGlobal true;
_center = createCenter sideLogic;
_group = createGroup _center;
_logic = _group createUnit ["LOGIC",[0,0,0], [], 0, ""];
_logic attachTo [_turntable, [0,0,0.5]];
_logic setPos (getPos _target);
[_logic, nil, true] call BIS_fnc_moduleLightning;

};
lightning_Add_Player_Actions = {

    params ["_player"];

	_player addAction ["<img size='3' color='#33339b' shadow='1' image='\A3\ui_f\data\map\respawn\icon_dead_ca' /><t size='1' shadow='1' color=""#f72032"">" + ("Electrifying Death") + "</t><img size='3' color='#33339b' shadow='1' image='\A3\ui_f\data\map\respawn\icon_dead_ca.paa'/>", {_this spawn lightning_suicide}, [], -9, false, true, "", "(vehicle player) isKindOf 'man'"];

    _player addEventHandler ["Respawn", {
      player setVariable ["lightning_Actions_Loaded",false];
    }];
  };
  
  
  if(!isDedicated) then {
    [] spawn {
      while {true} do {
          if(!isNull player && isPlayer player) then {
		    if !(player getVariable ["lightning_Actions_Loaded",false]) then {
		     [player] call lightning_Add_Player_Actions;
               player setVariable ["lightning_Actions_Loaded",true];
	          };
		    };
	        sleep 5; 
         };
       };
     };
 
  if(isServer) then {
    publicVariable "lightning_Install";
    remoteExecCall ["lightning_Install", -2,true];
  };

};

if(isServer) then {
	[] call lightning_Install;
};

thanks.

credits to duda for showing me all the how to

and giving me time.

Share this post


Link to post
Share on other sites
fixed added 

 

 if !(someAmmo player)

 

credit to ZoneKiller (ZK) for pointing me 

to the right place.

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  

×