yMassai Posted July 5, 2012 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. Community Profile MTA:SA = Click Here
Jaysds1 Posted July 5, 2012 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. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
yMassai Posted July 5, 2012 Author 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 Community Profile MTA:SA = Click Here
yMassai Posted July 5, 2012 Author Posted July 5, 2012 player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) Community Profile MTA:SA = Click Here
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