Jump to content

NewbProgramming

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by NewbProgramming

  1. Everytime you login? Mmm maybe should have an option to disable it if you wanted.
  2. Running on my test server just for testing purposes. https://forum.multitheftauto.com/viewtopic.php?f=115&t=96929 Thank you, it's nice.
  3. You are replacing the function. Change: function setGameType(playerSource,commandName,setversus) addCommandHandler("setvs",setGameType) to: function cmd_setGameType(playerSource,commandName,setversus) addCommandHandler("setvs",cmd_setGameType) so it doesn't replace the setGameType MTA function.
  4. local index = 0; local line_spacing = 10.0; for i, message in pairs(messages) do dxDrawText(message, 940, (minHeight + (index * line_spacing)), 1230, ((minHeight + (index * line_spacing)) +(msgHeight*15)), tocolor(255, 255, 255, 255), 0.60, "bankgothic", "left", "top", true, true, false, false, false) index = index + 1; end If messages is a table with indexes auto assigned you can: local line_spacing = 10.0; for i, message in ipairs(messages) do dxDrawText(message, 940, (minHeight + ((i - 1) * line_spacing)), 1230, (minHeight + ((i - 1) * line_spacing) +(msgHeight*15)), tocolor(255, 255, 255, 255), 0.60, "bankgothic", "left", "top", true, true, false, false, false) end
  5. Bro. The other thread you made we told you: exports["house-interiors"].getInteriorsList() Is NOT returning a table. and tosfera is right, to call another resource's function you need the colon not period, like so: exports["house-interiors"]:getInteriorsList() Check to make sure getInteriorsList is being exported in the meta.xml of the house-interiors resource. Do not create another thread for the same problem please.
  6. You're not describing specifically what you want so how could we help you? Be more specific on what you want.
  7. Can also make a system like Amazon's. Where you can upload your own mp3 files to the server and play them via. music player.
  8. I am going to sleep, if you still need help when I wake up I'll be happy to quickly script what you want. Private Message me.
  9. I didn't see your code on the previous post until just now. You DO NOT have to create a loop (it's inefficient), you can do this: function getChatInput (button, pressed) if pressed then if keys[button] ~= nil then if (button == "enter") then setChatVisible(false) outputChatMessage(input) input = "" elseif (button == "escape") then setChatVisible(false) input = "" elseif (button == "backspace") then input = string.sub(input, 1, #input-1) elseif (button == "space") then input = input.." " else input = input..button end end end end It's 6:00am (06:00), I am going to sleep. If you still need help when I wake up, I'll help you. Private message me.
  10. Damn man, it works for me no errors, let me scrap my system and send it to you.
  11. Try: toggleControl("chatbox", false)
  12. From my knowledge you can't unbind any MTA controls, the player can but not the server nor the client scripts. You have to toggleControl("chatbox", false). https://wiki.multitheftauto.com/wiki/Control_names showChat(false) should have automatically disabled the control though.
  13. Try: TEMPORARY_VEHICLE = {}; function cmd_veh(plr, cmd, ...) local vehicleName = table.concat({...}, " ") local vehicleID = getVehicleModelFromName(vehicleName) local x, y, z = getElementPosition(plr) if isPedInVehicle(plr) then outputChatBox ("#C80000✖ #E7D9B0Get out of the vehicle first.", plr, 255, 255, 255, true) return end if vehicleID then if TEMPORARY_VEHICLE[plr] ~= false then destroyElement(TEMPORARY_VEHICLE[plr]); end TEMPORARY_VEHICLE[plr] = createVehicle (vehicleID, x, y, z, 0, 0, 0) warpPedIntoVehicle(plr, TEMPORARY_VEHICLE[plr]) outputChatBox ("#04B404✔ #E7D9B0You created a temporary vehicle named " .. vehicleName .. "#E7D9B0.", plr, 255, 255, 255, true) end end addCommandHandler("veh", cmd_veh) function deleteTempVeh(plr, seat, jacked) if not TEMPORARY_VEHICLE[plr] then return end destroyElement(TEMPORARY_VEHICLE[plr]) end addEventHandler("onVehicleExit", getRootElement(), deleteTempVeh) function PlayerQuit() if not TEMPORARY_VEHICLE[source] then return end destroyElement(TEMPORARY_VEHICLE[source]) end addEventHandler"onPlayerQuit", getRootElement(), PlayerQuit);
  14. Did you destroyElement(player_vehicle[plr])? Have to completely remove the newVehicle variable and replace it with the table variable.
  15. Yes you need to use a table and use the player element for the index. -- global table player_vehicle = {}; -- in the cmd_veh function if player_vehicle[plr] ~= false then destroyElement(player_vehicle[plr]); end player_vehicle[plr] = createVehicle(...) -- in onPlayerQuit event handler if player_vehicle[plr] ~= false then destroyElement(player_vehicle[plr]); end
  16. Alright man. I do not know what that means exactly. ("Command of cvar onbekend: chatbox") Maybe an MTA team member or someone more experienced with MTA scripting can elaborate. I've made me a custom chat box as well. It's designed just like World of Warcraft's chat box. I do not get anything like you're getting.
  17. guiGridListAddRow(vehicle_selector_grid) returned nil. Doesn't make sense because it's supposed to return false when failed. Maybe you're reading the error or line # wrong.
  18. You can just use any number for the (int rowIndex, int columnIndex) arguments. guiGridListGetItemText will return false if rowIndex or columnIndex are invalid, so check if it returns false. Does not have to be from guiGridListGetSelectedItem returned values. To get the amount of rows: https://wiki.multitheftauto.com/wiki/Gu ... etRowCount To get the amount of columns: https://wiki.multitheftauto.com/wiki/Gu ... olumnCount
  19. I do it for neatness. I also don't need to add semi-colons to end statements but I do it anyways.
  20. onClientKey gets called twice per key press. The variable 'pressed' is set to true for key down and false for key up. So... function getChatInput (button, pressed) if pressed == true then input = input..button end end
  21. What's calling getChatInput?
  22. ROOT_ELEMENT = getRootElement(); OnKey = function(button, pressed) -- source = client root if pressed == true then if button == "b" then outputChatBox("You've pressed 'b'!"); end end if pressed == false then if button == "b" then outputChatBox("You've released 'b'!"); end end return; end addEventHandler("onClientKey", ROOT_ELEMENT, OnKey ); https://wiki.multitheftauto.com/wiki/OnClientKey https://wiki.multitheftauto.com/wiki/Key_names - OR - OnBKey = function(key, state) if state == "down" then outputChatBox("You've pressed 'b'!"); end if state == "up" then outputChatBox("You've released 'b'!"); end return; end bindKey("b", "both", OnBKey); https://wiki.multitheftauto.com/wiki/BindKey
  23. Yeah I forgot to mention that my example would do that. Fixed: THIS_RESOURCE = getThisResource(); ROOT_ELEMENT = getRootElement(); LOCAL_PLAYER = getLocalPlayer(); GUI = { -- BUTTONS button = false }; OnResourceStart = function(resource) if resource == THIS_RESOURCE then GUI.button = guiCreateButton(0.40, 0.75, 0.20, 0.10, "CLICK ME", true, nil); -- x_position, y_position, width, height, text, relative, parent guiSetVisible(GUI.button, false); end return; end OnResourceStop = function(resource) if resource == THIS_RESOURCE then if GUI.button ~= false then destroyElement(GUI.button); end end return; end OnVehicleEnter = function(player, seat, jacked) -- source = vehicle_element if player == LOCAL_PLAYER then if GUI.button ~= false then guiSetVisible(GUI.button, true); end end return; end OnVehicleExit = function(player, seat, jacked) -- source = vehicle_element if player == LOCAL_PLAYER then if GUI.button ~= false then guiSetVisible(GUI.button, false); end end return; end OnGUIClick = function(button, state, x, y) -- source = gui if state == "up" then if source == GUI.button and guiGetVisible(GUI.button) == true then outputChatBox("You've clicked me!"); end end return; end addEventHandler("onClientResourceStart", ROOT_ELEMENT, OnResourceStart ); addEventHandler("onClientResourceStop", ROOT_ELEMENT, OnResourceStop ); addEventHandler("onClientVehicleEnter", ROOT_ELEMENT, OnVehicleEnter ); addEventHandler("onClientVehicleExit", ROOT_ELEMENT, OnVehicleExit ); addEventHandler("onClientGUIClick", ROOT_ELEMENT, OnGUIClick ); If you have any more problems or concerns, you can always contact me by Private Messaging me and I will fulfill any problem or question you may have.
  24. When you restart a resource all of the variables associated with that resource gets niled for garbage collection due to the Lua state being deleted from memory. So there is no way of store information unless you do so externally. You can have a separate resource that loads the information and have the resource you want restarted to make export calls to the resource storing the information. You can also make a custom element for the type of information you're storing (in this case custom vehicles) and you can have your script to see if that element already exists and if it doesn't, load from SQLite the information for that specific vehicle id and store into the custom element data. (having a custom vehicle manager and using custom elements are important for this type of system, but it is the best way to do it)
×
×
  • Create New...