Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

Help with Money Based Weapon Spawner (Spawn weapons at a price)


nekomaster
 Share

Recommended Posts

FOR GTA SAN ANDREAS (Sorry, forgot to include GTA SA in the title)

 

I'm posting here today in hopes to get help making a new weapon spawning script that's easy for a noob to modify and only spawns weapons if you have the money for it

 

Since it would seem that its a tad complicated to add weapons to Ammunation for a noob, until I figure out how to do something like that I'll just have to resort to CLEO Scripts for now.

 

At the moment this is what I use to spawn in weapons where ever I go, but I avoid using it since its rather cheaty as it costs nothing to spawn weapons right next to CJ

//-------------MAIN---------------thread 'WEAP' :WEAP_11wait 0 [email protected] = -229908 if   &0([email protected],4i) == 1464156496 else_jump @WEAP_11 &0([email protected],4i) = 1146440960 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $0[3] with_offset -2.0 0.0 0.0 //FN FAL - ID 18902032B: [email protected] = create_weapon_pickup #FNFAL type 4 ammo 200 at [email protected] [email protected] [email protected] @WEAP_11 end_thread 

Of course I got this from the Weapon Limit Adjuster mod since i didn't like Fastman92's method of spawning weapons (only one place they spawn in the world and still free)

 

Though my issue with this is that its free, no cost, so its cheating, and I can put that in many times to keep getting free ammo.

 

I did try using this line of code : Player.Money($PLAYER_CHAR) += -8000

But that does nothing to check if I have the money and can actually put your money in the red/negative

 

Heres what I'd like in a new spawning script...

 

- Easy to modify like the above code (Basically so I can copy the code and use it for other weapons)

 

- Supports Custom Weapons like the above code (Basically spawns weapons based on their ID so any weapon can be spawned)

 

- IT NEEDS TO COST MONEY TO SPAWN WEAPONS! I would like it if the script could check out how much the player has, and only spawns the weapon if CJ has enough money (otherwise it just wont spawn at all)

 

- Doesn't need a menu unless that can be done easy and simply (I don't understand cleo scripting very well at the moment)

The above code does not need a menu but works by spawning weapons when you type in "WEAP" during gameplay.

Though if a menu can be made simply and easily so that adding new entries can be as simple as adding a few lines of code and txt in a FXT file, that would be nice.

 

I'm not making any demands or anything, but at the least, it might be nice if someone could show me how to add to the above code a money check to prevent spawning a weapon if you don't have the money the script wants to deduct. I'm sure that'll be simple enough even for a noob like me to understand.

 

It might also be nice if we go the simple route by modifying the above code and add a message for when a Weapon is spawned like "FN FAL SPAWNED FOR $8000" and when you dont have enough money "NOT ENOUGH MONEY, FN FAL COSTS $8000"

 

Anyways, any help would be really appreciated, I really need a spawning script that costs money to spawn weapons, other wise theres not much point in having custom weapons in a serious game (currently its only fun for screwing around, like going on a rampage)

Edited by nekomaster
Link to comment
Share on other sites

The FLA 4.0 got released yesterday and you're still using 3.0 ...

While I can't make you a scripy (I don't use the computer at the moment), I'll give you some tips.

 

Use opcode search in the Sunny Builder.

Look for an opcode which checks if player has more money than specified amount, add jf (else jump) after that.

Type monry in the opcode search.

 

In case that there is no opcode to check whether player has more money than specified amount, choose the opcode which would store the money value into variable. Then make a condition with that variable such as

[email protected] > 500, add jf to label after that.

Link to comment
Share on other sites

The FLA 4.0 got released yesterday and you're still using 3.0 ...

While I can't make you a scripy (I don't use the computer at the moment), I'll give you some tips.

 

Use opcode search in the Sunny Builder.

Look for an opcode which checks if player has more money than specified amount, add jf (else jump) after that.

Type monry in the opcode search.

 

In case that there is no opcode to check whether player has more money than specified amount, choose the opcode which would store the money value into variable. Then make a condition with that variable such as

[email protected] > 500, add jf to label after that.

 

It would help if I could access your website to download version 4.0, but all my browsers keep timing out when trying to load your website.

 

Also, at the moment I'm trying to make individual spawner scripts for each weapon, but the code I posted originally wants WEAP to be typed in while in game.

 

I thought that changing thread 'WEAP' to thread 'GIVEFAL' would change the code I need to type in game to GIVEFAL to spawn, but that didnt work (nothing happened when I typed GIVEFAL, but it spawned when i typed in WEAP)

 

EDIT : I did an opcode search for "money" but I don't see anything I can understand to use. Gotta remember that I'm so green with scripting that I don't even know what most of the spawner code does, other then it spawns weapons ingame. I may as well be a script kiddy at the moment.

Edited by nekomaster
Link to comment
Share on other sites

Here's an idea that might get you started. If you create your weapon as pickup type 18, the buy property type, the game will display "ammo" value above the weapon and will deduct that amount of money from CJ's wallet when the "Answer Phone" button is pressed. These pickups don't actually give CJ the weapon though. Your script will need to watch for when the pickups are picked up and then provide CJ will the weapon and ammo. Note that the colors for the prices are generated by the game based on the value - apparently some leftover code from III and VC,

 

There are a few odd glitches though. When CJ walks over the pickup a "Cancel" message is displayed instead of instructions on how to buy the weapon, and the message displayed if CJ doesn't have enough cash refers to property. Also, the pickups can't be collected if CJ is on a mission, and that message refers to property as well. The text can be changed, but you'll need to put it back to normal for the properties when the buy weapons aren't active. You don't want to leave the pickups lying around anyway or they'll get saved, recreated, and saved again and again, cluttering the pool until it won't work anymore.

 

viMW7Ebl.jpg

 

Reference for SA's GXT keys.

Test codes for buy pickups along the side of the Jefferson house (not a complete cleo script).

032B: [email protected] = create_weapon_pickup #COLT45 group 18 ammo 50 at 2101.0 -1265.75 25.5032B: [email protected] = create_weapon_pickup #TEC9 group 18 ammo 500 at 2101.0 -1267.75 25.5032B: [email protected] = create_weapon_pickup #M4 group 18 ammo 5000 at 2101.0 -1269.75 25.5032B: [email protected] = create_weapon_pickup #MINIGUN group 18 ammo 50000 at 2101.0 -1271.75 25.50ADF: add_dynamic_GXT_entry "FESZ_CA" text "Press ~k~~PED_ANSWER_PHONE~ to purchase the weapon."0ADF: add_dynamic_GXT_entry "PROP_1" text "You dont have enough cash for this weapon."0ADF: add_dynamic_GXT_entry "PROP_2" text "You cannot buy weapons whilst on a mission."//$ONMISSION = 1 // for testing{// original GXT keys0ADF: add_dynamic_GXT_entry "FESZ_CA" text "Cancel"0ADF: add_dynamic_GXT_entry "PROP_1" text "You dont have enough cash for this property."0ADF: add_dynamic_GXT_entry "PROP_2" text "You cannot buy property whilst on a mission."}
Link to comment
Share on other sites

 

Here's an idea that might get you started. If you create your weapon as pickup type 18, the buy property type, the game will display "ammo" value above the weapon and will deduct that amount of money from CJ's wallet when the "Answer Phone" button is pressed. These pickups don't actually give CJ the weapon though. Your script will need to watch for when the pickups are picked up and then provide CJ will the weapon and ammo. Note that the colors for the prices are generated by the game based on the value - apparently some leftover code from III and VC,

 

There are a few odd glitches though. When CJ walks over the pickup a "Cancel" message is displayed instead of instructions on how to buy the weapon, and the message displayed if CJ doesn't have enough cash refers to property. Also, the pickups can't be collected if CJ is on a mission, and that message refers to property as well. The text can be changed, but you'll need to put it back to normal for the properties when the buy weapons aren't active. You don't want to leave the pickups lying around anyway or they'll get saved, recreated, and saved again and again, cluttering the pool until it won't work anymore.

 

viMW7Ebl.jpg

 

Reference for SA's GXT keys.

Test codes for buy pickups along the side of the Jefferson house (not a complete cleo script).

032B: [email protected] = create_weapon_pickup #COLT45 group 18 ammo 50 at 2101.0 -1265.75 25.5032B: [email protected] = create_weapon_pickup #TEC9 group 18 ammo 500 at 2101.0 -1267.75 25.5032B: [email protected] = create_weapon_pickup #M4 group 18 ammo 5000 at 2101.0 -1269.75 25.5032B: [email protected] = create_weapon_pickup #MINIGUN group 18 ammo 50000 at 2101.0 -1271.75 25.50ADF: add_dynamic_GXT_entry "FESZ_CA" text "Press ~k~~PED_ANSWER_PHONE~ to purchase the weapon."0ADF: add_dynamic_GXT_entry "PROP_1" text "You dont have enough cash for this weapon."0ADF: add_dynamic_GXT_entry "PROP_2" text "You cannot buy weapons whilst on a mission."//$ONMISSION = 1 // for testing{// original GXT keys0ADF: add_dynamic_GXT_entry "FESZ_CA" text "Cancel"0ADF: add_dynamic_GXT_entry "PROP_1" text "You dont have enough cash for this property."0ADF: add_dynamic_GXT_entry "PROP_2" text "You cannot buy property whilst on a mission."}

 

 

How do get the exact location of stuff? Perhaps I could add some of my added weapons outside of Ammunation. ALso I'm not too worried about changing the text of the property buying messages as Weapons can be considered "property". Also it kinda makes sense if you can't buy stuff while on a mission, some of the added weapons may end up being more powerful then in game weapons. For example, I modified the Country Rifle to be a bolt action hunting rifle so its more powerful then a FAL but its slower with only 5 rounds, the FN FAL I added is faster but less accurate and holds 20 rounds.

 

This idea may just work better then just spawning weapons in if I can figure out how to get the position of spawns to add them around san andreas.

 

EDIT : To be honest though, while I can make the spawns appear, I have no idea how to actually make them give you a weapon and ammo.

 

Like I mentioned before, I have next to no knowledge of scripting.

Edited by nekomaster
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 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.