I need help..
#1

Код:
GetPlayerWeaponData

Read the weapon and ammo in a specific weapon slot of a player.

Parameters:
(playerid, slot, &weapons, &ammo)
playerid	ID of the player
slot	Weapon slot to read (0-12)
&weapons	Variable to store the weapon ID, passed by reference
&ammo	Variable to store the ammo, passed by reference

This function does not return a specific value, it's best to simply ignore it.

//common use: get all weapons and store info in an array containing 13 slots
//first value is weapon id and second is ammo
new weapons[13][2];
for (new i = 0; i < 13; i++)
{
  GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
I read it 3-4 times but i couldn't understand it.. Can someone explain me now can i get player ammo?
Reply
#2

Sorry for double post.. But please guys i need to learn this. Please help me.

-TraNe15-
Reply
#3

[b]GetPlayerWeaponData(playerid, slot, &weapons, &ammo)

playerid ID of the player
slot Weapon slot to read (0-12)
&weapons Variable to store the weapon ID, passed by reference
&ammo Variable to store the ammo, passed by reference[b]


Quote:
Slot 1: Hand
* Fist
* Brass Knuckles

Slot 2: Melee Weapons
* Knife
* Golf Club
* Shovel
* Pool Cue
* Nightstick
* Baseball Bat
* Katana
* Chainsaw
* Skateboard (Unused, Beta)

Slot 3: Handguns
* Pistol
* Silenced 9mm
* Desert Eagle

Slot 4: Shotguns
* Shotgun
* Sawn-off Shotgun
* Combat Shotgun

Slot 5: Sub-Machine Guns
* Tec-9
* Micro SMG
* SMG

Slot 6: Assault Rifles
* AK-47
* M4

Slot 7: Rifles
* Sniper Rifle
* Country Rifle

Slot 8: Heavy Weapons
* Flamethrower
* Rocket Launcher
* Heat-Seeking Rocket Launcher
* Minigun

Slot 9: Explosives
* Tear Gas
* Molotov Cocktail
* Grenade
* Satchel Charges

Slot 10: Handheld Items
* Fire Extinguisher
* Spray Can
* Camera

Slot 11: Gifts
* Flowers
* Cane
* Dildo
* Vibrator

Slot 12: Special Items
* Night Vision Goggles
* Thermal Vision Goggles
* Parachute

Slot 13: Others
* Detonator
Don't get confused here, in Pawn, you will start with slot 0, not 1.


pawn Код:
new weapons[13][2];
for(new i = 0; i < 13; i++)
{
  GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}

So, if you want to check if player has an colt45 in his weapon-data, you would do this:
pawn Код:
if(weapons[2][0] == 22) // because 22 is the id of the colt45 (9mm).
{
  // code.
}

This will check if player's ammo is 500 in slot-3 (pistol, silenced 9mm, desert eagle)
pawn Код:
if(weapons[2][1] == 500)
{
  // code.
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)