yMassai Posted May 21, 2012 Posted May 21, 2012 Hello I am producing a script that will soon to download. I am creating a table that sells weapons. At first only a few buttons have some pictures and nothing else. I ask for help, what would it be? Should I use the arguments and getAccountData setAccountData but i do not understand how to use, I do not know about it then you could help me? I want a license for the players buy this weapons. If you do not understand, I will repitir with detail. I want players to have to buy a license to buy the weapons, if not have the license will not buy the weapons. The button labeled "buttonLicense" what will effect the purchase of the license. Ie i want to save in the account that the player has already bought the license. By purchasing the license will save on the purchase and your account will be charged a value of "$$55.000". WindowTest = guiCreateWindow(350,250,450,320,"Exemplo",false) guiCreateStaticImage(30,80,60,60,"imagens/3.png", false,WindowTest ) guiCreateLabel(35,35,250,60,"Você deve obter uma licença : $55.000",false,WindowTest) buttonLicense = guiCreateButton(270,33,135,20,"Licença para Armas",false,WindowTest) guiCreateButton(29,140,60,15,"2,500",false,WindowTest) guiCreateButton(109,140,60,15,"2,500",false,WindowTest) guiCreateButton(189,140,60,15,"2,500",false,WindowTest) guiCreateButton(269,140,60,15,"2,500",false,WindowTest) guiCreateButton(349,140,60,15,"2,500",false,WindowTest) guiCreateButton(29,220,60,15,"2,500",false,WindowTest) guiCreateButton(109,220,60,15,"2,500",false,WindowTest) guiCreateButton(189,220,60,15,"2,500",false,WindowTest) guiCreateButton(269,220,60,15,"2,500",false,WindowTest) guiCreateButton(349,220,60,15,"2,500",false,WindowTest) guiCreateButton(29,295,60,15,"2,500",false,WindowTest) guiCreateButton(109,295,60,15,"2,500",false,WindowTest) guiCreateButton(189,295,60,15,"2,500",false,WindowTest) guiCreateButton(269,295,60,15,"2,500",false,WindowTest) guiCreateButton(349,295,60,15,"2,500",false,WindowTest) guiCreateMemo(25,60,405,15," ",false,WindowTest) guiCreateStaticImage(110,80,60,60,"imagens/31.png", false,WindowTest ) guiCreateStaticImage(190,80,60,60,"imagens/30.png", false,WindowTest ) guiCreateStaticImage(270,80,60,60,"imagens/32.png", false,WindowTest ) guiCreateStaticImage(350,80,60,60,"imagens/33.png", false,WindowTest ) guiCreateStaticImage(30,160,60,60,"imagens/1.png", false,WindowTest ) guiCreateStaticImage(110,160,60,60,"imagens/20.png", false,WindowTest ) guiCreateStaticImage(270,160,60,60,"imagens/27.png", false,WindowTest ) guiCreateStaticImage(350,160,60,60,"imagens/28.png", false,WindowTest ) guiCreateStaticImage(190,160,60,60,"imagens/29.png", false,WindowTest ) guiCreateStaticImage(30,240,60,60,"imagens/2.png", false,WindowTest ) guiCreateStaticImage(110,240,60,60,"imagens/26.png", false,WindowTest ) guiCreateStaticImage(190,240,60,60,"imagens/25.png", false,WindowTest ) guiCreateStaticImage(270,240,60,60,"imagens/4.png", false,WindowTest ) guiCreateStaticImage(350,240,60,60,"imagens/5.png", false,WindowTest ) guiWindowSetSizable(WindowTest,false) guiSetVisible(WindowTest,false) function infoShow30 ( ) guiSetVisible ( WindowTest, not guiGetVisible ( WindowTest ) ) showCursor ( not isCursorShowing( ) ) end bindKey ( "F5","down", infoShow30 ) Community Profile MTA:SA = Click Here
Wei Posted May 21, 2012 Posted May 21, 2012 Like that; addEvent("buyTheSample", true) function buyTheSample( ) local money = getPlayerMoney(source) local acc = getPlayerAccount(source) if (money >= 1200) then if (getAccountData( acc, "GunLicence" ) == true) then giveWeapon( source, 31, 120 ) takePlayerMoney( source, 1200 ) outputChatBox("You have purchased 120 ammo of gunName", source, 255, 255, 0) else outputChatBox("You don't have licence", source, 0, 255, 255) end else outputChatBox("You can not afford this weapon", source , 0, 255, 0) end end addEventHandler("buyTheSample", getRootElement(), buyTheSample) You need to trigger the event. but when player buy licence you need to make like that setAccountData(getPlayerAccount(source), "GunLicence", true) I hope I helped Diet with russian vodka, lose 3 days in one week !
mjr Posted May 21, 2012 Posted May 21, 2012 Should I use the arguments and getAccountData setAccountData but i do not understand how to use, I do not know about it yes, to save "licenceGot" state till the end of game session. On game guit it should be written in database. The algorithm is: 1) You press key to buy licence 2) If your cash is > cost of licence 3) Cash -= cost of licence 4) Write in playerData string 5) On quit checks the string in playerData, if true, write value in database i must learn not to be an asshole
Stanley Sathler Posted May 22, 2012 Posted May 22, 2012 Solved! Guys, I'm working with Ninguem[ATZ] now and the server-side was created. Thank you for all replies. One love, Stanley Sathler. Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Wei Posted May 22, 2012 Posted May 22, 2012 Solved! Guys, I'm working with Ninguem[ATZ] now and the server-side was created. Thank you for all replies.One love, Stanley Sathler. Wasn't this script allready released ? Diet with russian vodka, lose 3 days in one week !
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