Jump to content

Revolt

Members
  • Posts

    113
  • Joined

  • Last visited

Everything posted by Revolt

  1. You can explore the Lua's wiki to find out more about these topics you're interested in, but if you only wish to learn Lua for MTA, you don't need to understand all of them (for example, Lua does not use classes at all, rather it uses light user data, therefore you probably won't need them either) Here are some links you might find useful: http://lua-users.org/wiki/SimpleLuaClasses http://lua-users.org/wiki/TablesTutorial http://www.lua.org/pil/11.1.html http://www.lua.org/pil/2.5.html
  2. It is not related in any way with the server. setTimer(..) on a client will set the timer locally, and when player leaves, all Lua execution terminates. It is different from the server Lua scripts since they run all the time (whenever the server is running, so server variable/process cleanup is recommended to lower RAM/processor usage)
  3. Learn SQL, analyze the database that you wish to be used as a default one, write a code that checks if login is valid and then incorporate it in a login resource. As of upgrading old accounts, you should either manually add them to the SQL database, or if there is too many of them, write code to do so for you.
  4. Army@1, it would terminate itself since the player has actually left the server.
  5. codylewiz, open the wiki and you'll see that it only returns/pushes back a boolean, not an element. Don't spread false information to the people who are willing to learn. KalashnikovZ, do what Alexs_Steel said, it is the only (or at least the easiest) way to accomplish what you wish to do.
  6. That won't work. givePedWeapon(..) does not return a weapon, it returns a boolean. Therefore, that will cause an error.
  7. This wont work. If you wish to have a custom weapon, you have to replace the model and texture of an existing one.
  8. local tempCol = { [1] = createColCuboid ( 1367.1826171875, -1659.076171875, 13.3828125, 23, 12.5, 10), } function getVehicleWithinColShap() local cars = getElementsWithinColShape(tempCol[1], "vehicle") outputDebugString(tostring(#cars)) for i, veh in ipairs(cars) do -- it should be ipairs, not pairs return veh -- however, you are returning only the first vehicle, since return actually stops the function execution end end function testCommand(player, cmd) local found = getVehicleWithinColShap() if not found then outputChatBox(" ERROR ", player, 255, 255, 255, false ) end end addCommandHandler("test", testCommand)
  9. Only if it is executed by the server.
  10. Your code seems correct, therefore it shouldn't change visibility twice per button press. Maybe you had accidentally bound it twice, or used "both" instead of "down"?
  11. function updatePlayerList(oldNick, newNick) for i = 0, (guiGridListGetRowCount(GUIEditor.gridlist[1]) - 1) do if (guiGridListGetItemText(GUIEditor.gridlist[1], i, 1) == oldNick) then guiGridListSetItemText(GUIEditor.gridlist[1], i, 1, newNick, false, false) end end end addEventHandler("onClientPlayerChangeNick", root, updatePlayerList)
  12. function afterTimerTicks() -- this is triggered after 15 seconds end setTimer(afterTimerTicks, 15000, 1)
  13. function gzkill(player, cmd, name, ammount) local otherPlayer = getPlayerFromName(name) if (otherPlayer) then local ammount = tonumber(ammount) lpkills = getElementData(player, "zombieskilled") pkills = getElementData(otherPlayer, "zombieskilled") akills = pkills + ammount rkills = lpkills - ammount setElementData(otherPlayer, "zombieskilled", akills) setElementData(player, "zombieskilled", rkills) outputChatBox("Sucessfully added!", root, 255, 255, 255, false) else outputChatBox("Wrong name!", root, 255, 255, 255, false) end end addCommandHandler("idz", gzkill) --restricted
  14. May be possible if you handle it right. If you're going to display the browser window in a 3D world, then make sure that you load it only when the player is close to it.
  15. function rowDoubleClick() local selection = guiGridListGetSelectedItem(guiGridlistObject) if (selection ~= -1) then -- An item was dbl clicked end end addEventHandler("onClientGUIDoubleClick", guiGridlistObject, rowDoubleClick, false)
  16. Can't you just reduce the colcircle radius?
  17. You can. setVehicleDoorState getVehicleDoorState setVehiclePanelState getVehiclePanelState Thanks, I searched everywhere and somehow overlooked this. I guess the restart delay is not fixable, but better something than nothing.
  18. You cannot. It has been disabled for some reason, if you don't believe me, you can try it yourself and stop trying to be a smart-ass. Yes, unfortunately that is how I'am doing it right now. But the problem is that some of the vehicles are used by the players at the moment of restart, therefore a small delay occurs in-between the restart period, and not to mention that you cannot save vehicle visual damage (or at least I haven't found the function to do so).
  19. -- CLIENT SIDED CODE, REMEMBER! for _, vehicle in ipairs(vehicleTable) do --guiGridListClear(guiGridlistObject) local Row = guiGridListAddRow(guiGridlistObject) guiGridListSetItemText(guiGridlistObject, Row, 1, getVehicleName(vehicle), false, false) end
  20. local vehicleTable = getElementsWithinColShape(colShapeObjectVar, "vehicle")
  21. Yeah, but that doesn't explain the export issue. Why can't I trigger an exported function (that creates a vehicle) from a different resource?
  22. Why not? It seems like an useful feature. Why completely eliminate it? I've also seen that they eliminated the possibility to create elements in exported functions.
  23. Is it possible to keep elements created by a resource upon restarting it?
  24. I've sent you a PM. Here are some scripts I made (my Housing System also incorporates elements from business system): https://forum.multitheftauto.com/viewtopic.php?f=108&t=95241
×
×
  • Create New...