dachevs 1 Posted March 11, 2008 I'm creating a mod for Arma---an RPG. Like Sahrani Life-----My Problem----when you buy a car, it takes the money from you and spawns the car near you---BUT if you dont have any money it still spawns the car near you-FOR FREE! :/ What can I do about this? ALSO: How can I make hte script remove money from different Civs, I tried to put the "Buy" action on the building for all civs--i.e. CarShop addaction ["Buy", "BLah.sqf"]; carShop addaction ["Buy", "Blah1.sqf"]---but when I previewed there were two buy actions., and if i selected the bottom one it removed the 2nd Civs money. Can anyone help??? Share this post Link to post Share on other sites
InqWiper 0 Posted March 11, 2008 You only need to add the action to the building once and then all players can use that action and launch the same script. if (!(player == _this select 1)) exitWith {}; if (money<_cost) exitWith {player groupchat "I dont have enough money to buy that item"}; money=money-_cost; ...script goes on creating car or whatever... _cost is local in the script and money is local to the player. Share this post Link to post Share on other sites
dachevs 1 Posted March 22, 2008 HMMM>>>Wasnt quite clear enough really. What I need is a script that removes the object, because it is an object in your inventory. --So I need it to remove a certain amount of the object from your inventory, and check if that that amount of hte object is actually in your inventory. If you don't have enough of the object I need a hint or message to say something "You dont have enough to buy this car." ----Also I have an arrest script but how do I make it to where the police have the action to arrest the civ but the civ does not? Share this post Link to post Share on other sites
lebson506th 0 Posted March 22, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0; _maxRemove = _this select 1; _i = 0 #removeLoop _unit removeMagazine "className" _i = _i + 1 ?_i < _maxRemove : goto "removeLoop" #Exit Exit <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[playerName, numToRemove] exec "remove.sqs" where the "className" is the className for your money or whatever you want to remove. Share this post Link to post Share on other sites
dachevs 1 Posted March 22, 2008 Thanks. MUCH APPRECIATED. THis is perfect! *EDIT* Get error message remove.sqs Quote[/b] ]_unit = _this select 0; _maxRemove = _this select 1; _i = 0 #removeLoop _unit removeMagazine "RPO_obj3" _i = _i + 1 ?_i < _maxRemove : goto "removeLoop" #Exit Exit [s1, 5] exec "remove.sqs" I probably did alot wrong. Share this post Link to post Share on other sites
lebson506th 0 Posted March 23, 2008 Try this. (I don't know why that error is happening) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unit = _this select 0; _maxRemove = _this select 1; _i = 1 #removeLoop _unit removeMagazine "RPO_obj3" _i = _i + 1 ?_i == _maxRemove : goto "Exit"; goto "removeLoop" #Exit Exit If that doesn't work, i'll try something else =/ Share this post Link to post Share on other sites
dachevs 1 Posted March 23, 2008 Ok thanks for your help, I'll check it out. Share this post Link to post Share on other sites
dwringer 45 Posted March 23, 2008 when you're calling the script, were you putting maxremove in quotes by mistake? That would turn it into a string (object) instead of a number, like it says in the screenshot. I might be way off, though, just a thought Share this post Link to post Share on other sites
lebson506th 0 Posted March 23, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unit, 5] exec ... Instead of <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unit, "5"] exec ... Share this post Link to post Share on other sites
dachevs 1 Posted March 24, 2008 still don't works, same error. Don't have it in quotes. Share this post Link to post Share on other sites