Jump to content

brocky

Members
  • Posts

    49
  • Joined

  • Last visited

Everything posted by brocky

  1. It doesn't works, it only displays the result of line 33. The player doesn't logs in Bad argument at logIn [expected account, got string]
  2. My login button doesn't works. local window1 = guiCreateWindow(455, 178, 710, 532, "", false) guiWindowSetSizable(window1, false) local editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1) local editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1) btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1) btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1) guiSetVisible(window1, true) showCursor(true) function closeGui() if btnClose == source then guiSetVisible(window1, false) showCursor(false) end end addEventHandler("onClientGUIClick", btnClose, closeGui, false) function logToServer() account = guiGetText(editUsername) password = guiGetText(editPassword) local name = getPlayerName(getLocalPlayer()) triggerServerEvent("test", localPlayer, account, password, name) end addEventHandler("onClientGUIClick", btnLogin, logToServer, false) server side function myMoney(account, password, name) logIn (source, account, password) end addEvent("test", true) addEventHandler("test", getRootElement(), myMoney)
  3. Hey, I don't know whats wrong in this guy. any ideas? GUIEditor = { button = {}, window = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(563, 204, 519, 491, "Rules and Regulation", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.memo[1] = guiCreateMemo(9, 29, 500, 418, "", false, GUIEditor.window[1]) button1 = guiCreateButton(18, 449, 491, 32, "I agree", false, GUIEditor.window[1]) end ) function closeButton() if button1 == source then outputChatBox("Hey") end end addEventHandler("onClientGUIClick",button1,closeButton,false)
  4. Oh, thanks! I din't paid
  5. I have a problem with a code, Its a simple calculator to substract numbers, but the problem is that it doesn't give the required/correct answer. editbox1 = guiCreateEdit(22, 41, 135, 24, "", false, window1) editbox2 = guiCreateEdit(21, 80, 136, 24, "", false, window1) buttonSub = guiCreateButton(148, 250, 110, 26, "Subtraction", false, window1) function substraction() if buttonSub == source then num1 = guiGetText ( editbox1 ) num2 = guiGetText ( editbox1 ) local subtheAnswer = num1 - num2 outputChatBox("Subtraction answer: "..subtheAnswer) end end addEventHandler("onClientGUIClick", buttonSub, substraction, false) Hope you understood
  6. Thanks, you all helped, I read the wiki about "triggerServerEvent" and I had to add the 3rd optionals argument to send the "textPrice" element to server so that it will recognize it but Thanks to everybody.
  7. Ok, lemme try something new on it, If it didn't work then I will "EDIT" this post.
  8. First of all ! takePlayerMoney is server sided! You can't use it on client side script! 2nd is that I made an Edit to input the amount of money that you want and I call it "textPrice" and it is in Client side. Now if a player clicks buyApart then the script will take the amount of money used in "textPrice" edit. but "the server side" doesn't recognize "textPrice" because it is in Client side and thats why "takePlayerMoney" doesn't recognize "textPrice" because I defined it in client side and server side doesn't know what is it. Understood? Thats my problem and here is the debugscript 3 decision. WARNING: [script]Test\server.lua:2: Bad argument @ 'takePlayerMoney' [Expected number at argument 2, got nil]
  9. I know that, but what I am trying to say is that I want "that" number value and take it to the server side and excecute it but server side doesn't recognize it.
  10. It says "textPrice" is a string in the server-side. Can you even explain it with comments a bit?
  11. I have a problem with my code, and its like I made an edit window which is set to variable "intPrice" and now I converted using "guiGetText" to "textPrice". The problem is that I want to take the exact amount of money that the player entered in "textPrice" and the problem is that "takePlayerMoney" is server sided.How is it possible to call the "textPrice" in server side so I CAN TAKE THE MONEY. This is how I did it and it doesn't works. buttonBuy = guiCreateButton(9, 297, 130, 26, "Buy House", false, window2) intPrice = guiCreateEdit(114, 294, 178, 22, "", false, window1) textPrice = guiGetText ( intPrice ) local theMoney = tonumber ( textPrice ) function buyApart() if buttonBuy == source then playerMoney = getPlayerMoney(localPlayer) if playerMoney >= theMoney then guiSetEnabled(buttonSell, true) outputChatBox("House Bought", 24, 247, 7, true) triggerServerEvent("takingMoney", localPlayer) else outputChatBox("Insufficient cash.", 249, 10, 4 ) end end end addEventHandler("onClientGUIClick", buttonBuy, buyApart, false) Server side :- function takeMoney() takePlayerMoney(source, textPrice) end addEvent("takingMoney", true) addEventHandler("takingMoney", getRootElement(), takeMoney) Hope you understood my problem.
  12. I have problem with my code "It doesn't let you to go to the specified interior and x, y, z position. I have made a GUI with edits and for interior it is called "IntEdit" and for X it is intx , for Y it is inty, for Z it is intz. This code doesn't works. intEdit = guiCreateEdit(111, 147, 166, 22, "", false, window1) intx = guiCreateEdit(110, 170, 167, 22, "", false, window1) inty = guiCreateEdit(111, 193, 170, 21, "", false, window1) intz = guiCreateEdit(109, 214, 178, 19, "", false, window1) function buttonDo() if buttonEnter == source then setElementInterior(localPlayer, intEdit, intx, inty, intz ) end end addEventHandler("onClientGUIClick", buttonEnter, buttonDo, false)
  13. brocky

    [HELP]Gridlist

    I know that I have made many mistakes and they are epic, but I am bad in making gridlist and I need your help. addEventHandler("onClientResourceStart", resourceRoot, function() window1 = guiCreateWindow(245, 209, 309, 271, "", false) guiWindowSetSizable(window1, false) gridlist1 = guiCreateGridList(9, 21, 290, 176, false, window1) guiGridListAddColumn(gridlist1, "Weapons", 0.9) guiGridListAddRow(gridlist1) text = guiGridListSetItemText(gridlist1, 0, 1, "m4", false, false) button1 = guiCreateButton(9, 205, 290, 56, "OK", false, window1) function getWeapon() if button1 == source then if guiGridListGetSelectedItem(v[1]) then triggerServerEvent("giveMe", localPlayer) end end end addEventHandler("onClientGUIClick", button1, getWeapon, false) end )
  14. Hi, Can anyone help me in creating a small functional Gridlist. I have tried a lot but it never works out for me. Can you give me a small code of Gridlist. for example. 2 weapons in gridlist and when you click the weapon and click "ok", you will get that weapon. I need the code with some comments in detail if you can. Hope you understood. Thanks.
  15. Well, I wanted to check the luac.mtasa plus some people like to decompile things and that's not a probelm for me and I was too lazy to remove the server.lua from meta and zip file. I will be working on more advanced version soon. Thanks for the feedback
  16. Hi, I am pretty new in scripting and I made one of my resource that lets you create a ped on your position. Its all based on GUI. Version 2 of the resource will be coming soon with tasks, rotations, animations and jobs for the peds to do. Thanks. Here. https://community.multitheftauto.com/index.php?p=resources&s=details&id=12285
  17. Hi, I need some help with something like, A memo that lets you change your skin. I don't know how people set a memo to work with an event like "Please Input the skin Id : "The Skin Id(Memo)"" and then you click ok and you get the skin of id you just wrote in the memo. I need an understable code with some comments because I am pretty newbie. If you are confused in what I said please reply below.
  18. brocky

    Need CODE

    Since the script is client sided you can easily use "outputChatBox()" in "onWaste" function and type anything that you want.
  19. brocky

    Need CODE

    if you meant every team should have their own spawn then use this! use getTeamFromName(). here is the example. function binds() -- Made a bind event bindKey(s, "down", onWaste) -- You made a bind end addEventHandler("onClientResourceStarts", getResourceRootElement(getThisResource()), binds) function onWaste() -- Now this is the main function. team1 = getTeamFromName("tdm1") -- Remember! If you want to specify a team in those parenthesis then the team "should" actually exist else it won't recognize it . team2 = getTeamFromName("tdm2") -- Team2 won't be necessary but I am going to tell you a bit in beginner style. if team1 then setElementPosition(localPlayer, x, y, z ) else setElementPosition(localPlayer, l, m, n ) end end addEventEventHandler("onClientPlayerWasted", getRootElement(), onWaste) I am not too good in Lua, sorry if I made many mistakes.
  20. The problem with this script is that when you click the button called "ButtonExtract" then a progress bar will appear and start progressing till the width is reached to 532 and the problem is that, When you click the button, the progress bar fills half and then again you will have to click to complete the progress bar, All I want is that the progress Bar should start when you click the buton and ends smoothly. function loading() if buttonExtract == source then local now = getTickCount() with = interpolateBetween(0,0,0,532,0,0, (now - start) / (( start + 10000 ) - start ) , "Linear" ) dxDrawRectangle(142, 222, with, 41, tocolor(23, 23, 231, 255), false) if with < 532 then triggerServerEvent("payMoney", localPlayer) else removeEventHandler("onClientRender", getRootElement(), loading) end end end addEventHandler("onClientRender", getRootElement(), loading) addEventHandler("onClientGUIClick", buttonExtract, loading, false)
  21. go to manage acl and click on "Admin Group" and click on "Add Object" and add this "resource.(Exact name of the resource)"
  22. Yes, This is the code how I did it. and I am sorry about my code layout, I am just used to it start = getTickCount() function loading() local now = getTickCount() with = interpolateBetween(0,0,0,532,0,0, (now - start) / (( start + 10000 ) - start ) , "Linear" ) dxDrawRectangle(142, 222, with, 41, tocolor(23, 23, 231, 255), false) if with < 532 then -- if the width is less then 532 then triggerServerEvent("payMoney", localPlayer) -- Keep giving the money to the play else -- Else if the width was bigger then 532 "Which simply means when it becomes full". removeEventHandler("onClientRender", getRootElement(), loading) -- Then stop the process and close the bar end end addEventHandler("onClientRender", getRootElement(), loading) Thanks anyway.
  23. OH! I didn't knew I was that noob, Anyway it worked with "removeEventHandler" after I made my own function to fill up the 3rd argument of "removeEventHandler". Thanks.
  24. I tried every possible way that you described to me like using removeEventHandler, guiSetVisible(true, false) and I used the createElement function too and it didn't worked, Here is the code how I used it . start = getTickCount() addEventHandler("onClientRender", getRootElement(), function() local now = getTickCount() with = interpolateBetween(0,0,0,532,0,0, (now - start) / (( start + 10000 ) - start ) , "Linear" ) theElement = createElement(dxDrawRectangle(142, 222, with, 41, tocolor(23, 23, 231, 255), false)) if with < 532 then triggerServerEvent("payMoney", localPlayer) else guiSetVisbile(theElement, false) end end ) Please re-post the code again with the mistakes I did and post it back, so I would understand better.
×
×
  • Create New...