Home   Help Search Login Register  

Author Topic: An easy money problem.. i think :)  (Read 1823 times)

0 Members and 2 Guests are viewing this topic.

Offline RolsRois

  • Members
  • *
  • I'm not sure of who i am anymore
    • Rambm Workshop
An easy money problem.. i think :)
« on: 01 Aug 2008, 02:00:49 »
ok so i've got the init whice exec in the start:
Cash = 190

really thats it.
now i've made a script of buying a trabant:

_cash = cash
if (_cash <180) then (goto "exit") else goto "ok";

#ok
"Trabant" createvehicle getpos GL1;
cash = _cash - 180
exit


#exit
Dude sidechat "You dont have enough money!"
exit

-------Dude is the player, GL1 is the game logic whice the trabant shows up in------

it just makes the trabant appear, and tells me That i dont have enough money, and the money doesnt go down.
so eventually i get lots of free trabants, whice is good, just not what i want  :P
so, anybody?
Rambm Workshop, A New way of playing OFP
http://www.freewebs.com/rambm/
yes its on freewebs! Got a problem?

Offline six6six

  • Members
  • *
Re: An easy money problem.. i think :)
« Reply #1 on: 01 Aug 2008, 09:24:47 »
Code: [Select]
[sub]
_cash = cash
if (_cash <180) then (goto "exit") else goto "ok";

#ok
"Trabant" createvehicle getpos GL1;
_cash = _cash - 180
_cash = cash
exit


#exit
Dude sidechat "You dont have enough money!"
exit[/sub]
I think thats should work.

Offline Gcfungus

  • Members
  • *
Re: An easy money problem.. i think :)
« Reply #2 on: 01 Aug 2008, 10:13:12 »
First of all, your first value (Cash) is not the same as (cash), make sure it's the same.
Also, I've edited your script a bit:
Code: [Select]
_cash = cash
?(_cash < 180):goto "cantafford"
"Trabant" createvehicle getpos GL1;
cash = _cash - 180
exit

#cantafford
Dude sidechat "You dont have enough money!"
exit

Have a try with it,
-=GC=-Fungus1999
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline RolsRois

  • Members
  • *
  • I'm not sure of who i am anymore
    • Rambm Workshop
Re: An easy money problem.. i think :)
« Reply #3 on: 01 Aug 2008, 19:44:55 »
Right, i tried GcFungus's solution, and it worked.
tnx for helping guys  :clap:
Rambm Workshop, A New way of playing OFP
http://www.freewebs.com/rambm/
yes its on freewebs! Got a problem?

Offline Yasirotta

  • Members
  • *
Re: An easy money problem.. i think :)
« Reply #4 on: 04 Aug 2008, 23:59:14 »
I diddnt want to start new topic, so i put it here.
Has anyone complete money script ? Just scrip for you have money, you can use it and get more. I tried to search old replys but some links has gone old. I believe i can mix up all other things myself, but basic money script is now what i would need.

PS. Why everyone else get "welcome to ofpec" but i diddnt ?  :D

Offline Gcfungus

  • Members
  • *
Re: An easy money problem.. i think :)
« Reply #5 on: 05 Aug 2008, 10:22:26 »
I don't think there's such a thing as a simple money script, because every one would be different. If you want help with a script, then you could post what you need and someone could write it for you.
And also :welcome: :welcome:
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline Blacknite

  • Members
  • *
  • Chiefs runs the navy!
Re: An easy money problem.. i think :)
« Reply #6 on: 14 Sep 2009, 04:49:20 »
Now how do you get this working in multiplayer?  How do you make it apply to one person and not just all?  And vice versa?

Offline Rellikki

  • Members
  • *
  • Die-hard OFP player
Re: An easy money problem.. i think :)
« Reply #7 on: 14 Sep 2009, 21:53:59 »
You'd need to change all the variables for every single player. For example, from _cash=x to _cash_player1=x. As I said, it has to be done for every player, so you'd eventually have multiple scripts like that running, with all the players specified in the variables.

I believe there's more practical way for that too, but it does work like that too as I described. Can't really come up with a better way myself.