yMassai Posted July 5, 2012 Share Posted July 5, 2012 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
Jaysds1 Posted July 5, 2012 Share Posted July 5, 2012 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
yMassai Posted July 5, 2012 Author Share Posted July 5, 2012 bullet_m4 and price_m4 is variables, are the price of the gun and bullets. local price_m4 = 18000 -- price weapon local bullet_m4 = 300 -- price bullets Link to comment
Smart. Posted July 5, 2012 Share Posted July 5, 2012 Where do you define "player_money" ? Link to comment
yMassai Posted July 5, 2012 Author Share Posted July 5, 2012 player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now