Moony

Members
  • Content Count

    81
  • Joined

  • Last visited

Community Reputation

5 Neutral

About Moony

  • Rank
    Transformer
  • Birthday 27/01/1993

Details

  • Gang
    What's a Gang?
  • Location
    Argentina
  • Occupation
    Musician
  • Interests
    Music

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I've been working on a script that realistically manipulates the wheels. I've gotten to the point I can hide the original wheels, in hopes I can later attach a new set in the same place. I'm aware I might have to use attachElements, and several other functions. For the moment, I'd like to attach a single wheel. I've got this: -- All GUI elements. local vehicle = getPedOccupiedVehicle(localPlayer) local x1, y1, z1 = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local x2, y2, z2 = getVehicleComponentPosition(vehicle, "wheel_rf_dummy") local x3, y3, z3 = getVehicleComponentPosition(vehicle, "wheel_lb_dummy") local x4, y4, z4 = getVehicleComponentPosition(vehicle, "wheel_rb_dummy") local function replace1 () attachElements (1097, vehicle, x1, y2, z1, 0, 0, 0) end addEventHandler ("onClientGUIClick", set1, replace1, false) -- Function runs when button called 'set1' is clicked. -- Everything else. Here's my thought process: First, I get the player's vehicle. Then, I get the position of all four wheels in the player's vehicle, and represent them with x1, y1 and z1. With all wheels hidden by another function, I then attach the wheel model in the same place as the front left wheel. At the moment, I'm only aiming at the position; I'll handle the rotation later. DB 3 can't identify '1097', and thus asks for a valid element. Am I on the right path?
  2. I wanted to revive this little command since I never got it to work. After tens of small changes, I got it to work. I had to use an old format from another script I had. Here's the command majqq made: function myCommand(player, cmd) outputChatBox("player: "..inspect(player).." cmd: "..inspect(cmd), source) end addCommandHandler("testcmd", myCommand) This is what I did: function msgServer () outputChatBox ("player: "..inspect(player).." cmd: "..inspect(cmd)) end addCommandHandler ("sayserver", msgServer) If I leave the function's arguments empty, it sends: "player nil cmd nil". If I put what majqq put (player, cmd), it sends: "player: elem:player[Moony] cmd: "sayserver"" Let's see if I get it right: The inspect function is inspecting the element that triggered the command, which in this case is a player, and that player's name is "Moony". As for the command, it is throwing the simple string that was used to trigger the function. I don't quite get the "..have a different string representation". Do you mean that the string "player" is represented as "elem:player[Moony]"?
  3. I've been working on my own server for a few weeks now. After adding mods for vehicles, weapons and skins rocketed it to aproximatelly 500mb. I've found servers that are filled with skins, great mappings, scripts and more, and they weight around 200mbs. They have more skins, a lot more scripts and complex functions, new textures for buildings; basically, a complete make-over. I've only heard about the word "compiling". I'm confident there are other ways to reduce the weight for the client. Is there such thing as "server-side mods"? These are the heaviest. Maybe moving them server-side reduces the downloaded content significantly.
  4. I didn't know you could assign more than 1 argument when doing a local whatev = getSomething(argument 1, argument 2...) I know now. Thanks! So what you're doing is assigning the function 'getVehicleComponentVisible' to the string 'alreadyVisible'. Additionally, you're also saying that 'alreadyVisible' includes the dummy of the car that the localPlayer is driving. That way, when you say not alreadyVisible, you're inverting the value of the visibility state, correct? Which is the very first command that tells the system the boolean of the visibility? For example: If you constantly multiply a number by 1 and -1, alternating between them, you need to have a first number so you know the ending result. Otherwise, you'll never figure if the ending result is positive or negative x * 1 = x ---> x * -1 = -x ---> x * 1 = x ---> x * -1 = -x But if I tell you that x = 2, you'll know the ending result. Taking this concept to this script, how does the system figure out the initial state of the dummy?
  5. I made this: -- All other functions and GUI creation. -- [...] -- Created button called "fbumper". local function setFBumper() local theVeh7 = getPedOccupiedVehicle(localPlayer) if theVeh7 then setVehicleComponentVisible(theVeh7, "bump_front_dummy", false) end end addEventHandler("onClientGUIClick", fbumper, setFBumper, false) -- Everything else... It works. Then I wanted to have the button switch between true to false when clicked. Something like: local function setFBumper() local theVeh7 = getPedOccupiedVehicle(localPlayer) if theVeh7 then setVehicleComponentVisible(theVeh7, "bump_front_dummy", false) elseif getVehicleComponentVisible(theVeh7) == "false" then setVehicleComponentVisible(theVeh7, "bump_front_dummy", true) end end addEventHandler("onClientGUIClick", fbumper, setFBumper, false) guiSetVisible (vehmod, false) It doesn't work correctly. It sets it invisible, but it doesn't return the state to visible. I also thought about using the setVehicleComponentVisible (not setVehicleComponentVisible) to make it a little bit more compact. I'm using a setEngineState script to help myself, but I don't know how to use it with these arguments. DB 3 throws nothing. What am I doing wrong?
  6. I decided to dive into the complex system of the freeroam GUI MTA brings by default. After making it a standalone resource, I began changing a few things. I noticed a few particularities that I wanted to understand. As the first particularity, I noticed that the bottons do not have a fixed position. They change its position and size depending on the position and size of the other bottons, as well as the length of the text inside. They follow the same order as the text: left to right first, then top to botton. I wanted to add a new button to change the walking style, but I'm having trouble finding the specific part where the buttons are created and told to behave as mentioned above (so I can recreate the same thing myself) Inside the resource, there is a 'data' folder that manages the lists of the elements the player can choose with several .xml files: weapons, vehicles, skins, etc. I could create a similar list, but I don't know how to tell the .Lua to call a list from a different file. I'm not sure how this resource is creating all the elements of the GUI; I'm used to a different style (I use 'guieditor' to create GUIs). I still need to do some research. But in the mean time, what do I need to create a button that remotely calls of a .xml list with walking styles?
  7. I'm aware it should throw some kind of string result about some player. But nothing's happening. DB 3 is not throwing any errors. Out of context: It's funny how some of my replies have quotes of things I supposedly said.
  8. I'm certian my issue is that I'm not understanding what goes inside parentheses in the function header. Sometimes it's empty, other it's filled with arguments. This is what leaves me absolutely clueless and confused. I thought that the parentheses had to have the same arguments as the handler, which in this case is: addCommandHandler ( string commandName, function handlerFunction [, bool restricted = false, bool caseSensitive = true ] ) -- That turns into: addCommandHandler ( "cleana", Warning1 [, bool restricted = false, bool caseSensitive = true ] ) Which would leave us with a header similar to: function Warning1 (string commandName, function handlerFunction [, bool restricted = false, bool caseSensitive = true ] )) -- That turns into: function Warning1 ("cleana", Warning1 [, bool restricted = false, bool caseSensitive = true ] )) And that it serves as the same as stating the values beforehand: command = "cleana" function Warning1 (command) -- The function -- end addCommandHandler (command, Warning1) And finally, supposing that my thought process is correct, why would I need to clarify 'p' if 'p' is already being clarified in local acc = getPlayerAccount (p)? I'm struggling a bit putting these doubts into words. If you don't understand, let me know and I'll try to explain myself better. I've seen DB 3 throw a "got boolean" at the end of the error. I noticed you mentioned "false". Does this mean that everytime DB 3 talks about boolean, it's talking about a false statement? I ask this because I learned that boolean can either be 'true' or 'false'.
  9. I can't believe it was that easy. It works now! How did you detect it between so many things in the script? The knowledge I had seems to be incorrect. I thought that the arguments inside the parentheses next to the function name (header) didn't have an important effect, other than to set the names of the arguments. I had imagined that leaving it blank would be the same as saying "anything can go there". So why was it stopping the script from workingç?
  10. I've got this: I made the timers and the chatbox warnings: function Warning1() outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: #FF0000Todos los vehículos explotados y vacíos serán removidos en 30 segundos.", getRootElement(), 0, 0, 0, true) setTimer(function () outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: #FF0000Todos los vehículos explotados y vacíos serán removidos en 5 segundos.", getRootElement(), 0, 0, 0, true) setTimer(loopVehicles, 5000, 1) end, 25000, 1) end Translation: 1. "All blown and empty vehicles will be removed in 30s". 2. "All blown and empty vehicles will be removed in 5s". The 2nd message waits 25 seconds before appearing, and then it should trigger the 'loopVehicles' function. So I thought that by replacing the <loopVehicles> in the timer above with the entire fuction, I'd get the desired script: In other words, I've got a cleaning function that happens 5 seconds after an output chatbot that happens 25 seconds after the command is entered. I've got: - Bad argument at line 6 ('local acc = getPlayerAccount (p)'). Expected element at argument 1, got nil. - Bad argument at line 7 ('if not isGuestAccount (acc) and [...] then'). Expected element at argument 1, got boolean. - Bad argument at line 7 ('("user."..getAccountName (acc), aclGetGroup ( "Admin" )'). Expected element at argument 1, got boolean. - Line 7: attempted to concatenate a boolean value. Those errors are thrown as soon as the 30 seconds pass (25 + 5 from both warnings). The warnings are visible. I pictured that if the warnings work and the cleaning script works, joining them as such would work. Why am I getting those errors?
  11. I apologize for being a nag. While I understand the pros of function within function, I still can't understand why this scipt isn't working. It shows up, but the sliders are not moving what they should move (left front door). I confused a few words; I had accidently set the slider labelled as "bonnet" to open the door ("capo" = bonnet). I also just set the ID of the element to open ('2' = front left door). Both things are fixed. Here's the last version of the script: The two prefix letters of the '-scroll' represent the door (i.e. fr- = frontleft-). Still, nothing's happening. Do I have to set the movement server-side? This is all happening client-side.
  12. Hello again, The_GTA! Here's the complete code (client-side): function vehModif () vehmod = guiCreateWindow(0.74, 0.22, 0.25, 0.74, "Modificacion de Vehículo", true) guiWindowSetSizable(vehmod, false) openlabel = guiCreateLabel(0.23, 0.03, 0.52, 0.04, "Aberturas", true, vehmod) guiLabelSetColor(openlabel, 51, 194, 203) guiLabelSetHorizontalAlign(openlabel, "center", false) guiLabelSetVerticalAlign(openlabel, "center") capolabel = guiCreateLabel(0.27, 0.08, 0.46, 0.02, "Capot", true, vehmod) guiLabelSetHorizontalAlign(capolabel, "center", false) guiLabelSetVerticalAlign(capolabel, "center") caposcroll = guiCreateScrollBar(0.11, 0.10, 0.79, 0.03, true, true, vehmod) fllabel = guiCreateLabel(0.27, 0.14, 0.46, 0.02, "Puerta delatera izquierda", true, vehmod) guiLabelSetHorizontalAlign(fllabel, "center", false) guiLabelSetVerticalAlign(fllabel, "center") flscroll = guiCreateScrollBar(0.11, 0.16, 0.79, 0.03, true, true, vehmod) frlabel = guiCreateLabel(0.27, 0.21, 0.46, 0.02, "Puerta delatera derecha", true, vehmod) guiLabelSetHorizontalAlign(frlabel, "center", false) guiLabelSetVerticalAlign(frlabel, "center") frscroll = guiCreateScrollBar(0.11, 0.23, 0.79, 0.03, true, true, vehmod) rllabel = guiCreateLabel(0.27, 0.27, 0.46, 0.02, "Puerta trasera izquierda", true, vehmod) guiLabelSetHorizontalAlign(rllabel, "center", false) guiLabelSetVerticalAlign(rllabel, "center") rlscroll = guiCreateScrollBar(0.11, 0.29, 0.79, 0.03, true, true, vehmod) rrlabel = guiCreateLabel(0.27, 0.34, 0.46, 0.02, "Puerta trasera derecha", true, vehmod) guiLabelSetHorizontalAlign(rrlabel, "center", false) guiLabelSetVerticalAlign(rrlabel, "center") rrscroll = guiCreateScrollBar(0.11, 0.36, 0.79, 0.03, true, true, vehmod) baullabel = guiCreateLabel(0.27, 0.41, 0.46, 0.02, "Baúl", true, vehmod) guiLabelSetHorizontalAlign(baullabel, "center", false) guiLabelSetVerticalAlign(baullabel, "center") baulscroll = guiCreateScrollBar(0.11, 0.43, 0.79, 0.03, true, true, vehmod) guiSetVisible (vehmod, false) end addEventHandler ("onClientResourceStart", getRootElement(), vehModif) function openCapo(caposcroll) local theVeh = getPedOccupiedVehicle(localPlayer) local value1 = guiScrollBarGetScrollPosition(caposcroll) if theVeh and value1 then setVehicleDoorOpenRatio(theVeh, value1 / 100) end end addEventHandler("onClientGUIChanged", caposcroll, openCapo) function showVehModif() if (guiGetVisible(vehmod) == false) then guiSetVisible (vehmod, true) showCursor (true) else guiSetVisible (vehmod, false) showCursor (false) end end addCommandHandler("vehmod",showVehModif) bindKey ("F3", "down", showVehModif) I still couldn't completely understand the difference of what you told me in the other post. I'm running some tests to understand (this is one of them). I made sure each part of the script ran with an event handler. Everything works, except for the system applying the change when detecting the scrollbar moving.
  13. Should it look something like this? function openCapo() local theVeh = getPedOccupiedVehicle(localPlayer) local value1 = guiScrollBarGetScrollPosition(caposcroll) if theVeh and value1 then setVehicleDoorOpenRatio(theVeh, value1 / 100) end end addEventHandler("onClientGUIChanged", caposcroll, openCapo) DB 3 says the second argument in 'addEventHandler' is nil. Changed it too 'getRootElement()', but it still doesn't work; DB 3 throws nothing. A similar script I found on MTA's resources plays around with 'triggerServerEvent', and the door ratios are being set server side. It made me wonder how the server.Lua catches the scrollbar ID that moved in order to modify the door number, and if I should too set the movement server-side, having the trigger client-side.
  14. I decided to dive into the world of rotations. I know this might be incomplete and even incorrect: function openCapo() local theVeh = getPedOccupiedVehicle(localPlayer) local value1 = guiScrollBarGetScrollPosition(caposcroll) if theVeh and value1 then setVehicleComponentRotation (theVeh, bonnet_dummy, value1, rY, rZ) end end I've a GUI already created, and the visibility key bound. The first scrollbar (caposcroll) should affect the bonnet_dummy. This was made with absolute basic thinking process: "if I want doors to open, I need to get the position of the scrollbar". However, I know I still need to tell the game what's the math.min, what's the math.max, and, I think, to also give the order to respond only when the scrollbar is moved. I would appreciate a finger to point me in the right direction.
  15. It works now. I have a doubt. I have a very basic script that pops up a help memo (similar to the F9 help menu): function openHelp (key, keystate) if (guiGetVisible(helper) == false) then guiSetVisible (helper, true) showCursor (true) else guiSetVisible (helper, false) showCursor (false) end end bindKey("F9", "down", openHelp) Above it, the elements: helper = guiCreateWindow(0.19, 0.20, 0.63, 0.64, "-- 'El Final de la Bala' --", true) guiWindowSetSizable(helper, false) tabs = guiCreateTabPanel(0.03, 0.05, 0.94, 0.91, true, helper) welcomeTab = guiCreateTab("Bienvenido", tabs) welcomeMemo = guiCreateMemo(0.01, 0.04, 0.98, 0.93, welcome, true, welcomeTab) guiMemoSetReadOnly (welcomeMemo, true) rulesTab = guiCreateTab("Reglas", tabs) rulesMemo = guiCreateMemo(0.01, 0.04, 0.98, 0.93, rules, true, rulesTab) guiMemoSetReadOnly (rulesMemo, true) functionsTab = guiCreateTab("Funciones", tabs) functionsMemo = guiCreateMemo(0.01, 0.04, 0.98, 0.93, functions, true, functionsTab) guiMemoSetReadOnly (functionsMemo, true) locationsTab = guiCreateTab("Locaciones", tabs) locationsMemo = guiCreateMemo(0.01, 0.04, 0.98, 0.93, locations, true, locationsTab) guiMemoSetReadOnly (locationsMemo, true) guiSetVisible(helper, false) These elements are placed as seen: without a 'function' header, nor any kind of event handler. However, this works just fine. The player can click through each tab and open/close the memo. Why is it not the same with the spawn panel? Why does it fail when the 'onClientGUIClick' is outside the creation function? I still don't quite get the difference. I had imagined that the event call would be called regardless of its position.