[Include] Weapon Pickups - Buy weapons GTA III style!
#1

Oh dear, another include nobody uses. Ah well, I created this since I felt creating something again and so I created it. Like it or not, I don't care.

What is this?
For those of you who played GTA III and finally got to the Ammu-Nation (I couldn't, I kept dying ) you might remember the way of buying guns. That's right, they were on the floor and when you'd walk through 'em you'd immediately purchase 'em. Well, I created a li'l script for it, but then in SA:MP. I'm 99% sure this is done previously but to be honest, I don't give a damn.

Pictures
Just a small picture describing it:


How does it work?
Here are the functions, there are just 5 of 'em so that'd be easy.
pawn Code:
native CreateWeaponPickup(weaponid, ammo, money, Float:x, Float:y, Float:z);
/*
  weaponid - The weapon ID of the for-sale weapon between 0 and 46.
  ammo     - The ammo for the weapon
  money    - The cost for the weapon
  Float:x  - The X-axis value of the object/3d text label
  Float:y  - The Y-axis value of the object/3d text label
  Float:z  - The Z-axis value of the object/3d text label
  returns the ID of the newly created weapon pickup OR -1 if not created
*/


native DeleteWeaponPickup(weappickid);
/*
  weappickid - The ID of the weapon pickup to delete
  returns 1 if successful and 0 if the pickup didn't exist
*/


native SetWeaponPickupWeapon(weappickid, weaponid, ammo)
/*
  weappickid - The ID of the weapon pickup to set the weapon and ammo of
  weaponid   - The weapon ID to sel;
  ammo       - The ammo to sell by the pickup id
  returns 1 if successful and 0 if the pickup didn't exist
*/


native SetWeaponPickupCost(weappickid, money)
/*
  weappickid - The ID of the weapon pickup to set the prize/cost of
  money      - The prize/cost for the weapon to sell it for
  returns 1 if successful and 0 if the pickup didn't exist
*/


native GetWeaponPickupPos(weappickid, &Float:x, &Float:y, &Float:z)
/*
  weappickid - The ID of the weapon pickup to get the position of
  &Float:x    - The variable to retrieve the X value in
  &Float:y    - The variable to retrieve the Y value in
  &Float:z    - The variable to retrieve the Z value in
  returns 1 if successful and 0 if the pickup didn't exist
Should speak for itself. Entering a value of zero (0) in CreateWeaponPickup will make the item a piece of armor (Entering 'ARMOR' works as well) and any unknown weapon IDs will be displayed with a beer bottle. Unfortunately, I didn't limit any code so use other/invalid weapon IDs with caution!

Changelog
v1.2 28/12/10 8.59 PM:
Code:
* Armor now has got an amount of armor that it gives according to the 'ammo' filled in.
* Non-ammo weaponry now hasn't got an ammo thingy at the 3D text label.
* Non-ammo weaponry is buyable only once (If you try buying it but already got it, it'll just deny access)
* Armor is only buyable as long as your current armor is below or equal to 100.
* Small adjust to the height of the 3D text label
v1.1 28/12/10 12.12 PM:
Code:
* Added 4 more functions
* Only buys armor, melee and other non-ammo weapons once.
* Something else I just forgot
v1.0 28/12/10 12.11 AM:
Code:
* Initial release
Downloads
v1.2
SolidFiles
Pastebin.com

v1.1
SolidFiles
Pastebin.com

v1.0
SolidFiles
Pastebin.com

Notes
Once again, I did not test invalid weapon IDs (Anything under 0, above 46 or 19-20-21)
Please report bugs and suggestions, I will make at least one update to this script.

Edit: Credits to Y_Less on the ALS/hooking tutorial
Credits to willsuckformoney & [FU]Vicious for testing.
Reply


Messages In This Thread
[UPDATED]Weapon Pickups - Buy weapons GTA III style! - by Hiddos - 27.12.2010, 22:12
Re: Weapon Pickups - Buy weapons GTA III style! - by Gh0sT_ - 27.12.2010, 22:13
Re: Weapon Pickups - Buy weapons GTA III style! - by vyper - 27.12.2010, 22:22
Re: Weapon Pickups - Buy weapons GTA III style! - by knackworst - 27.12.2010, 22:22
Re: Weapon Pickups - Buy weapons GTA III style! - by willsuckformoney - 27.12.2010, 22:22
Re: Weapon Pickups - Buy weapons GTA III style! - by Hiddos - 27.12.2010, 22:23
Re: Weapon Pickups - Buy weapons GTA III style! - by [Ips]Guh - 27.12.2010, 22:56
Re: Weapon Pickups - Buy weapons GTA III style! - by WillyP - 27.12.2010, 23:02
Re: Weapon Pickups - Buy weapons GTA III style! - by Haydz - 27.12.2010, 23:12
Re: Weapon Pickups - Buy weapons GTA III style! - by [03]Garsino - 27.12.2010, 23:12

Forum Jump:


Users browsing this thread: 1 Guest(s)