Hey guys,
For learning purposes i started making a fireextinguisher-script.
It does pretty much what i want it to do today using addAction but i can't for the life of me understand why i cannot remove the action at the end of the script...
If anyone would care to have a look at it and inform me what im doing wrong here ?
Fireextinguisher.sqf
// Simple Fireextinguisher by Tactical Anders (Using a crapload of other scripts and wikis for inspiration)
// Check if landvehicle is within 5 meters
_vehicle = player nearObjects ["LandVehicle", 5];
// Select closest landvehicle and put it in the _veh variable
_veh = _vehicle select 0;
// Check damage on nearest hunter and add to _vehdamage
_vehDamage = getDammage _veh;
// If there is atleast 1 land vehicle nearby - > Allow Extinguisher
IF (count _vehicle >= 1)
// Then set the damage to 1 -> 0 -> 1 to create non burning wreck, play sound handle temporary invul and display message
THEN {_vehDamage = _veh setDamage 1;
_vehDamage = _veh setDamage 0;
_vehDamage = _veh setDamage 1;
player allowDammage false;
player say3D ["Sound1", 100];
hint "You temporarily put the fire out, hurry up!";
sleep 10;
player allowDammage true;
hint "The vehicle is boiling hot, get out of there!";
[color="#FF0000"]// Remove action
player removeAction _extAction;
};
ELSE {
hint "You are too far away from the fire";
};[/color]
(The red lines indicate what i cant get to run)
And im adding the action from init.sqf like this
_extAction = player addAction ["Fire extinguisher","extinguisher\extinguisher.sqf"];
Be aware this is my first script, and im sure there are better ways to do this, but this is what i as a complete noob could make out of a little googling and Biki :)
Cheers!