Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
sci4me

atm

Recommended Posts

sci4me

How could i make an "atm" ingame??? using cleo/main.scm obviously. I want to be able to "store my money in "account" and "withdraw" money from my "account".

Share this post


Link to post
Share on other sites
Deji

Well... This is how I'd do it.

 

 

  1. Create a file for CLEO File operations to perform on. Your funds can be stored safely in here.
  2. Make a loop checking whether the player is in radius of wherever you are placing your ATM.
  3. When he is, create the ATM at your desired position.
  4. Make another loop checking whether the player is very close to the ATM and whether he's pressed the Answer Phone key.
  5. When he has, use binary file reading to get the variables containing the funds (0 at first) in the bank.
  6. Give options on a panel to store money in the account (reducing the players cash).
  7. Give options on a panel to withdraw money from the acount (increasing player cash).
  8. Write all changes to the file.

Now the very fact that you asked probably means you aren't very familiar with coding yet. So my suggestion would be to either post this as a request in the pinned topic (I might take this one on) or get used to some more coding and then try wink.gif You'll find it much easier to do anything you want when you've learnt more.

 

About file operations, let's say "[email protected]" is the amount of cash in bank.

 

 

:Threadwait 0// Open the fileif0A9A: [email protected] = openfile "bank.dat" mode 0x6272  // IF and SETelse_jump @Thread0A9C: [email protected] = file [email protected] sizeif04B5:   [email protected] >= 4then0A9D: readfile [email protected] size 4 to [email protected]	// We've got the data from the file to [email protected]// The file is empty. Write "0" to it to indicate we have no money in the bank, yet.0006: [email protected] = 0 // $0 USD0A9E: writefile [email protected] size 4 from [email protected]// Now we can go back and read the 0 to [email protected] again.jump @Threadend[...]

 

 

There contains all the ingredients. Just learn how to cook them wink.gif

 

 

Gawd, don't ya love metaphors?

Share this post


Link to post
Share on other sites
sci4me

ok, thanks. ill try to start on that. i do know some but not much. so thanks. ill tell if i need more help.

Share this post


Link to post
Share on other sites
sci4me

How i make the player lose money into account? i can onlo add money. how?????????

Share this post


Link to post
Share on other sites
Deji

I assume you also wanna make sure the player has some money to loose.

 

 

if010A:   player $PLAYER_CHAR money > 0then0109: player $PLAYER_CHAR money += -1end

 

 

If we add a negative... It's the same as subtracting a positive. Above we are adding -1, which is just like taking away 1.

 

This takes off $1 if the player has $1 or more.

 

 

 

Now let me type random gibberish while I wait for 60 seconds to pass since I last helped someone... Dumm, dee, dumm. Hehe. I'm waiting just to help people. I'm so kind... Except from when I steal candy off babies. Yeah. Real kind, though... Oh yay! Post time smile.gif

Share this post


Link to post
Share on other sites
james227uk
Now let me type random gibberish while I wait for 60 seconds to pass since I last helped someone... Dumm, dee, dumm. Hehe. I'm waiting just to help people. I'm so kind... Except from when I steal candy off babies. Yeah. Real kind, though... Oh yay! Post time smile.gif

Cut the chatter n' stay frosty

Share this post


Link to post
Share on other sites
gtafan113

I saw your other topic and decided to take a look at a few things to see if maybe I would be capable of trying to create this for you.

 

However, it would be difficult because you can't subtract a variable, only a set number. It might also not be hard if you could only deposit and withdraw set amounts such as $1,000, $100, $100,000, etc.

 

I would also need to figure out how to save how much is in there between loads and such and at the moment I have no idea how to do that.

 

EDIT: I read Deji's post and I sort of understand that part, maybe I will attempt this over the weekend.

Edited by gtafan113

Share this post


Link to post
Share on other sites
Deji

I'm pretty damn sure you can subtract a variable tounge.gif

 

 

0109: player $PLAYER_CHAR money += [email protected]

 

 

If you find it complicated because there's no "money -= [email protected]" - Just make sure you add a negative number. Turn the variable into a negative like this:

 

 

0012: [email protected] *= -1

 

 

 

They use the same system for betting.

Share this post


Link to post
Share on other sites
sci4me

I think i'll have 2 make a menu that says, "withdraw" "Deposit" "your current balance" "Exit" How could i do this? oh and if i pressed "deposit" or "withdraw" it would show diffrent ammounts of money. and my current ballance. How??? Thanks! Also, how would i put the money i lose into a variable to write that to a file?

Edited by sci4me

Share this post


Link to post
Share on other sites
gtafan113

Sci4me, I said I would try making it for you. If you would still like to try making it yourself you can although I already started on it.

 

If your good at modeling, you could create a stand up ATM machine so that I could use that instead of a newspaper machine.

Share this post


Link to post
Share on other sites
sci4me

ok, ill try to start on that. if i made a atm machine, would i just replace some textures for the newspaper machine? and would i have to use 3d's max and KAMS script? I can easily make some textures but not a whole thing. if u kno wat i mean. bye

Share this post


Link to post
Share on other sites
gtafan113

 

ok, ill try to start on that. if i made a atm machine, would i just replace some textures for the newspaper machine? and would i have to use 3d's max and KAMS script? I can easily make some textures but not a whole thing. if u kno wat i mean. bye

I have no idea. I know nothing about modeling and texturing lol.

 

I'm like halfway done with the script though. smile.gif

 

The whole writing to file thing is messing me up though. I can write the script with everything besides writing and reading from the file and displaying the balance amount. :|

Edited by gtafan113

Share this post


Link to post
Share on other sites
sci4me

ok, would you mind posting what u have so far, scriptwise. also, thanks for making this for me. BYE! smile.gif

Share this post


Link to post
Share on other sites
gtafan113

I'll release it as a mod when it is finished.

 

I will give you credit for the idea and for the machine if you could make it. smile.gif

 

I will also give Deji credit for helping as much as he already has.

Share this post


Link to post
Share on other sites
sci4me

ok, on gtagtaage.com if so when???

Share this post


Link to post
Share on other sites
gtafan113

I'm not sure. I need to finish it and figure out how to input the reading of the file in there.

Share this post


Link to post
Share on other sites
sci4me

ok, is there ANY way i can help besids the model? otherwise, ill start on that. wait a sec, i just found an atm while looking in map editor. i think we can just use that. right...

Edited by sci4me

Share this post


Link to post
Share on other sites
gtafan113

What's it called? I looked but couldn't find one. I will look again.

Share this post


Link to post
Share on other sites
sci4me

"kmb_atm1.dff" try it. but what about the code? is it even done? not to rush u, i am just excited and would like 2 study from the code. anyway...

Share this post


Link to post
Share on other sites
gtafan113

That ATM will work fine. Thank you for finding it!

 

The code is still about halfway not. Not much I can do without knowing how to load and save to the file. I can create the panels and take away or add amounts to CJ's money accordingly. The only thing I need is more understanding of how to write values to files and then subtract/add to them. Also how to display the value would help.

Share this post


Link to post
Share on other sites
sci4me

ok, i am really an idiot! dont ask.

Share this post


Link to post
Share on other sites
jtr007

we know you are. lol.gif

Share this post


Link to post
Share on other sites
sci4me

Would you mind pm-ing me the code? i'd really appreciate it. just what you have so far, thanks!

Share this post


Link to post
Share on other sites
gtafan113

I am just about done with the code so I won't post it just yet. If I can't figure out this problem then I will though.

 

I have created a blank bank.dat file and put it in the CLEO file. It seems that the script isn't finding it though.

 

Where would I put it? And do I need to write anything manually in the bank.dat file?

 

Also, I have placed the ATM machine with map editor, but it only appears as I am leaving the 24-7 store (yes I put it in a 24-7 store smile.gif). I'm not sure how to fix this either.

Edited by gtafan113

Share this post


Link to post
Share on other sites
Deji

You shouldn't need to write anything to the bank.dat file. Just let CLEO do that (as it will write stuff you can't).

 

Put the bank.dat file in the CLEO folder. The path will be "CLEO\bank.dat".

Share this post


Link to post
Share on other sites
gtafan113

Maybe it's the whole interior thing.

 

I'll put one outside of a 24-7 and test it out. The only thing I need to add is something that tells the account balance, but I don't know how to put a variable in a FXT file.

 

EDIT: The ATM machine now spawns, but it is not registering when I am in the sphere. It probably has something to do with the file reading in the beginning.

 

03A4: name_thread 'ATM' :ATM_110001: wait 0 ms 00D6: if 0A9A: [email protected] = openfile "BANK.DAT" mode 25202 // IF and SET 004D: jump_if_false @ATM_11 0A9C: [email protected] = file [email protected] size 00D6: if 04B5:   [email protected] >= 4 // @ >= any 004D: jump_if_false @ATM_87 0A9D: readfile [email protected] size 4 to [email protected] 0002: jump @ATM_111 :ATM_870006: [email protected] = 0 0A9E: writefile [email protected] size 4 from [email protected] 0002: jump @ATM_11 :ATM_1110001: wait 0 ms 00D6: if 00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2553.912 1971.901 10.8203 radius 3.0 3.0 3.0 004D: jump_if_false @ATM_111 0512: show_permanent_text_box 'ATM01'

 

 

Edited by gtafan113

Share this post


Link to post
Share on other sites
sci4me

does this code even do anything? i tried it but saw no sphere. am i supposed to see the sphere??? sarcasm.gif

Share this post


Link to post
Share on other sites
gtafan113

No there is no visible sphere and that's only a tiny piece of the code.

 

I switched the 10 with an 11, but it's still not working correctly. Here is the code again (I also put the sphere loop before the file one).

 

03A4: name_thread 'ATM' :ATM_110001: wait 0 ms 00D6: if 00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2553.912 1971.901 10.8203 radius 3.0 3.0 3.0 004D: jump_if_false @ATM_11 :ATM_630001: wait 0 ms 00D6: if 0A9A: [email protected] = openfile "BANK.DAT" mode 25202 // IF and SET 004D: jump_if_false @ATM_63 0A9C: [email protected] = file [email protected] size 00D6: if 04B5:   [email protected] >= 4 // @ >= any 004D: jump_if_false @ATM_139 0A9D: readfile [email protected] size 4 to [email protected] 0002: jump @ATM_163 :ATM_1390006: [email protected] = 0 0A9E: writefile [email protected] size 4 from [email protected] 0002: jump @ATM_63 :ATM_1630001: wait 0 ms 0512: show_permanent_text_box 'ATM01' 00D6: if 0AB0:   key_pressed 4 004D: jump_if_false @ATM_200 0002: jump @ATM_272 :ATM_2000001: wait 0 ms 00D6: if 00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -22.2024 -91.7315 1003.547 radius 3.0 3.0 3.0 004D: jump_if_false @ATM_259 0002: jump @ATM_163

 

 

Edited by gtafan113

Share this post


Link to post
Share on other sites
sci4me

ok, i'll look for a problem. wait, how do we even know if it works if we cant see anything? oh right, the fxt file...

Edited by sci4me

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.