OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: Blacknite on 14 Sep 2009, 04:52:19
-
I've been working with some scripts, and here is what I have so far:
My purchase script (purchase.sqf):
_cash = cash
?(_cash < 200):goto "cantafford"
"Tractor" createvehicle getpos GL1;
cash = _cash - 200
hint format["Money: $%1", cash]
exit
#cantafford
_this sidechat "You dont have enough money!"
exit
My money display script (display.sqf):
cash = _this select 0
hint format["Money: $%1",cash]
exit
My money system script (money.sqf):
_player = _this select 0
cash = 500
?(local Server): [cash] exec "display.sqf"
exit
My profit script (Gain.sqf):
_cash = cash
cash = _cash + 200
hint format["Money: $%1", cash]
exit
However, I have to label a character ingame, called "P1" for it to work. How do I make it so that it works for more than one person, and how do I make it specifically for a single person such as purchasing and profits?
-
Your code raises some questions:
- Why do your files have a SQF ending when they contain SQS script?
- What purpose do the "_cash" and "_player" variables serve?
-
SQS and SQF wouldnt matter at this point, they both will work.
The "_cash" defines the money while the "_player" is going to define the player which will have the money. Kinda hoping that it will reflect it to all players if they are in multiplayer. I plan to have this script to be used for multiplayer.
-
The engine doesn't care what you name your script files, only how you call them: exec for SQS and execVM for SQF. However, since you are using SQS syntax, you should probably name your scripts with an SQS extension to avoid confusion.
If you use addAction then:
_object = _this select 0
_caller = _this select 1