Jump to content

Get player slot and weapon


GhostXoP

Recommended Posts

I made a little example for you

here you go :

function Weapon_example() 
    local weapon = getPedWeapon(localPlayer) -- gets your current weapon in hands 
    local ammo = getPedTotalAmmo(localPlayer) -- gets the current weapon ammo 
    local ammoInClip = getPedAmmoInClip(localPlayer) -- gets the current weapon ammo in clip 
    if(weapon~=0)then -- if the weapon isn't [fist] then 
        outputChatBox("You're carrying "..getWeaponNameFromID(weapon).." and the ammo is "..ammo.."-"..ammoInClip) -- outputs your weapon info 
    end 
end 
addCommandHandler("myWeapon",Weapon_example) -- adds 'myWeapon' as a command that you can type in the console[f8] 

switch to some weapon and just type in the console myWeapon.

Link to comment
  • 5 years later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...