Jump to content

Weapon and Bullets


yMassai

Recommended Posts

        elseif(weapon_name == "weapon_m4") then 
            if(player_money >= price_m4) then 
            takePlayerMoney(source, price_m4) 
            setAccountData(player_account, "m4data", true) 
                if(not getAccountData(player_account, "m4data")) then 
                return              end 
                    if(player_money >= bullet_m4) then 
                        giveWeapon(source, 31, 50) 
                        takePlayerMoney(source, bullet_m4) 
                    outputChatBox("Você comprou uma M4.", source, 0, 255, 0) 
                else 
                    outputChatBox("Você não tem dinheiro para comprar uma M4.", source, 255, 0, 0) 
                end 
            end 
        end 

I am having trouble in this little snippet.

My goal is to provide the player to purchase a gun and its bullets.

but when i start only the gun is purchased when the button is pressed.

I want to buy the weapon ​​and when the player presses the button again buy the bullets.

Link to comment

sorry, but this kinda confuses me, I know what you want but since the whole script isn't there, I don't get what some of these variables means.

I know the player_money is the players money, I don't know the source of this,

I don't know what is bullet_m4, and price_m4.

in order for me to correct this, I need the whole script.

Link to comment

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