Jump to content
Sign in to follow this  
eagledude4

Error on line 5

Recommended Posts

I call the below .sqf with this:

action43 = player addaction ["Rob the Bank","bankrob.sqf",["Rob"],1,false,true,"","player distance mainbank <= 3"];

The error shows as "Generic error in expression":

_Type = _this select 0;
_stolenamount = 0;
_stolenamount = 100000 * (ceil (random 5));

if (_Type == "Reset") then {
robenable = true;
local_useBankPossible = true;
};

if (_Type == "Rob") then {
_PBGuns = ["cal68_angel_dye", "cal68_angel_rasta", "cal68_angel_kitty", "cal68_invert_mini_dye", "cal68_egosl", "cal68_brass_n", "cal68_pumpe"]
if (!([] call INV_isArmed) || ((currentWeapon player) in _PBGuns)) exitWith {
player groupchat "You need a gun to rob the station!";
};
if (!robenable) exitwith {
player groupchat "You are already robbing the bank.";
};
robbing = true;
robenable = false;
player groupChat format[localize "STRS_bank_rob_success"];
Bank say "BankAlarm_Bank";
PDBase say "BankAlarm_PD";

titleText [localize "STRS_bank_rob_titlemsg", "plain"];
};

if (_Type == "Steal") then {
deleteVehicle cashpile;
['geld', _stolenamount] call INV_AddInvItem;
robbing = false;
};

I don't see what's wrong with: if (_Type == "Reset") then {

Edited by Max Power

Share this post


Link to post
Share on other sites

add a hint to make sure _Type is correct, also add hints to see if where in the script you are before it crashes.

other than that I don't know, looks ok to me.

Share this post


Link to post
Share on other sites

try removing semicolon after closing If statement , I don't think this end of line is required in this situation

Share this post


Link to post
Share on other sites

Check the addAction wiki reference.

  • target: Object - the object which the action is assigned to
  • caller: Object - the unit that activated the action
  • ID: Integer - ID of the activated action
  • arguments: Anything - arguments given to the script if you are using the extended syntax

Arguments = _this select 3. And in your case you are using an array as parameter so _type = _this select 3 will give you an array with one string.

Xeno

Share this post


Link to post
Share on other sites

Nevermind, fixed it :P _Type was defined incorrectly. Thanks to all for replies non the less.

Share this post


Link to post
Share on other sites

Deleting your problem is unhelpful. You should feel bad about yourself and dedicate your life to making my World of Tanks download finish in the next 12 minutes as we just discussed. :(

Share this post


Link to post
Share on other sites

Best to leave your problem up so others can benefit from the solution. People helping people, not just people helping you :P

Share this post


Link to post
Share on other sites

eagledude4 for future references, do not delete your first post. People that may have the same problem will now be unable to figure it out due to your first post being missing. If anything just put fixed under the first post or something to that nature.

Thanks

Share this post


Link to post
Share on other sites

This.

Everyone makes mistakes, and some people make the same mistake even if it's a typo. There's no need to delete your post... in fact, it may be helpful to someone.

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  

×