[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
#2

Good work, I like it
Reply
#3

nice one good job
Reply
#4

pretty neat!
you should make one too for information pickups : )
Reply
#5

Nice Hiddos, although I don't see what you can add to it unless a sell option.
Reply
#6

Quote:
Originally Posted by knackworst
View Post
pretty neat!
you should make one too for information pickups : )
I don't really see how that's needed, you could easily do so yourself by creating a pickup and a textdraw

Anyways, I just discovered a bug in the hooking which was a fault on my end, anyone who already downloaded it, please re-download it.
Reply
#7

Hmmmmmm , Very Good,Good Job....
Reply
#8

Quote:
Originally Posted by Hiddos
View Post
Oh dear, another include nobody uses.
DERP?!!?!?!!11!!11?!!11?!?!!/1!/1!/!//!/



I would use it, but I don't have any DM GM's that it would be used in
Reply
#9

Looks cool, i may use this in my DM server.
Reply
#10

<insert classical joke here>

I mean, awesome work!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)