Home   Help Search Login Register  

Author Topic: Show me the money!!  (Read 516 times)

0 Members and 1 Guest are viewing this topic.

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Show me the money!!
« on: 14 Mar 2003, 23:42:34 »
Hey all,murphy here.

Can any one show me how to scipt a money system?
I imagin it would invole a counter type thing for the player witch adds and subtracts numbers when ever you buy somthing or say do a job.
example:
counter type thingy has 1000 in it

trigger is set off cam creates a car and sutracts 500 from counter type thingy

thnx for your help,
                        Murphy

Knowlife

  • Guest
Re:Show me the money!!
« Reply #1 on: 19 Mar 2003, 14:30:28 »
Jep, here is a script for a six player game...
(In to files):


money.sqs
Code: [Select]
;Write this in the init field: [1000] exec "money.sqs"
_money  = _this select 0
_player = name _this

if _player = "civ1" goto "civ1"
if _player = "civ2" goto "civ2"
if _player = "civ3" goto "civ3"
if _player = "civ4" goto "civ4"
if _player = "civ5" goto "civ5"
if _player = "civ6" goto "civ6"

#civ1
player01_money = _money
exit
#civ2
player02_money = _money
exit
#civ3
player03_money = _money
exit
#civ4
player04_money = _money
exit
#civ5
player05_money = _money
exit
#civ6
player06_money = _money
exit


showmoney.sqs
Code: [Select]
;Write this in the init field: this addaction ["Show money","showmoney.sqs"]
_player = name _this

if _player = "civ1" goto "civ1"
if _player = "civ2" goto "civ2"
if _player = "civ3" goto "civ3"
if _player = "civ4" goto "civ4"
if _player = "civ5" goto "civ5"
if _player = "civ6" goto "civ6"

#civ1
_msg = Format ["You have $%1",player01_money]
goto "hint"
#civ2
_msg = Format ["You have $%1",player02_money]
goto "hint"
#civ3
_msg = Format ["You have $%1",player03_money]
goto "hint"
#civ4
_msg = Format ["You have $%1",player04_money]
goto "hint"
#civ5
_msg = Format ["You have $%1",player05_money]
goto "hint"
#civ6
_msg = Format ["You have $%1",player06_money]
#hint
hint _msg
exit
These works just fine... Or... They do the job, but i get an error messeng when i use them.  ???

NOTE: you have to call the players: civ1, civ2, civ3....

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re:Show me the money!!
« Reply #2 on: 19 Mar 2003, 22:56:43 »
Thnx! Now im gonna start making my own civil RPG mission  ;D or summing based along thous lines im still trying to think of summing.

one question,how might a subtract the money from the player? so say he buys somthing useing the action menu it will take away money and create the object/gun/car/tank/ect..?

Knowlife

  • Guest
Re:Show me the money!!
« Reply #3 on: 19 Mar 2003, 23:06:44 »
well, thats easy, if player one buys something. You just substract the prise from the globel variable: "player01_money".

And keep in mind that this script is not a good one of it's kind... Skracht your head a little, and you proberly make something better... If you do, could you mail me at tj_zaczi@hotmail.com please...

Offline benreeper

  • Members
  • *
  • I'm a llama!
Re:Show me the money!!
« Reply #4 on: 25 Mar 2003, 18:25:41 »
You don't even have to define who has what money.  Of you want everyone to have there own account (regardless of the number of players) the name of the money can be the same , ie. playercash.  Since the buying is done locally the vars are different for each player.  

Check out
http://www.ofpec.com/includes/download2.php?id=399