Jump to content

botder

MTA Team
  • Posts

    524
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by botder

  1. Code Explanation In the beginning you create 2 tables called Parachuting_marker_pos and Parachuting_pos. Each of those contain another tables with each 3 number values (the position). After creating the tables you start a loop for the table Parachuting_marker_pos for each element (each table) inside it. Each iteration inside the loop creates a blip and a marker using the coordinates from the table from Parachuting_marker_pos. The last table's marker element will be stored in the variable pMarker. Your memory should look like that: At the end you add an event handler for the event onClientMarkerHit, which will be used everytime for ANY player, which hits the marker. That player will be teleported to each position stored in the table Parachuting_pos, resulting in placing the player in the last position in that table. The Problem(s) You don't check if the local player hits the marker. You don't check if the player enters a marker, which was made by your resource. You set always the last position in your location table for the local player - that code will teleport EVERY player to the position.
  2. Do you even understand what (My-)SQL is offering you? Probably not. 'vehs' (a very ugly shortage) will be your SQL table. Each 'veh' ("vehicle") is a row in your SQL table. You need to create columns in that SQL table, which will e.g. save your X, Y, Z coordinates for each row (each vehicle).
  3. The hidden variable client is an automatically filled variable with the player-element, which triggered the event. Manipulated clients could trigger serverside events for other players. For example in the race resource a player can request to get killed by triggering a serverside event. The manipulated client could trigger that event for everyone and make everyone get killed. To avoid this, the race resource has a function to catch those false triggered events (source == client) called checkClient.
  4. triggerServerEvent("onPartyAccept",inviter,localPlayer) In your event handler onPartyAccept (serverside) you will have those values: source = inviter client = localPlayer player = localPlayer The parameter player is wrong in the triggerServerEvent call (clientside).
  5. I made a hack-menu resource to test which 'hacks' I can realize in the race gamemode. Some of the features were especially made for bypassing scripts on SKC (e.g. No Bouncer 'AFK Kicker'). I will make a video showing the power of the script and I also think about releasing the script on github. Furthermore, I got a list with features I plan to add.
  6. There is no mysql_connect function in the code you posted.
  7. If you create ~60 peds per second in an onClientRender handler, then yes, it can lag.
  8. I am a bit tired, but you may try to use that code: local mapCount = #mapslist --[[debug:]] + 50 local beginIndex = math.max(0, (progress * mapCount) - 8) local endIndex = (beginIndex + 8) for i = beginIndex, endIndex do -- draw end
  9. triggerServerEvent("onPartyAccept",inviter,localPlayer) function onPartyAccept(player) if client == player then player will be always 'localPlayer'.
  10. I use them for drag-and-drop scrolling to keep the scrolling bar inside the window.
  11. Copied it from my resource. Sorry, but I am too lazy to explain it properly, but the code is already commented. Source: https://github.com/Necktrox/debugconsole -- Example values local index = 0 -- Currently selected line (-index) local linecount = 25 -- Number of visible lines local playercount = 75 -- Number of all lines (also not visible) local windowheight = 300 -- Height of the playerlist-window -- Calculate how much we show from the actual count local visiblefactor = math.min(linecount / playercount, 1.0) -- Make sure we have a minimum factor visiblefactor = math.max(visiblefactor, 0.05) -- Calculate the bar height local barheight = (windowheight - 20) * visiblefactor -- Calculate the position local position = math.min(index / playercount, 1.0 - visiblefactor) * (windowheight - 20) -- Draw the scrollbar background dxDrawRectangle(x, y, 10, windowheight - 20, tocolor(0, 0, 0), true) -- Draw the scrollbar dxDrawRectangle(x, y + position, 10, barheight, tocolor(255, 255, 255), true)
  12. I don't know if you are going to accept this answer, but you could take a look into my resource: https://community.multitheftauto.com/in ... ls&id=7424
  13. IIRC the developers of MTA added a protection against opening too many files per resource. You have to close the handle after creating the file. local handle = fileCreate("something.txt") if handle then fileClose(handle) end
  14. SQLite is a kind of compact form of MySQL. The syntax is almost the same and you should have no problems if you start with SQLite or MySQL. Anyway, I suggest you to start with MySQL, because it will cover the SQLite syntax.
  15. You can use sockets. Use the socket module and take a look at the irc resource, which makes use of the module, to understand the technique.
  16. It's worth for the experience: How to handle rendering effectively without ripping the FPS in half. It won't make you a successful scripter (how is 'successful' even defined?).
  17. GTA:Multiplayer has released a new video showing their progress:
  18. IIRC is protected a flag, which prevents resources and players from stopping that resource (/stopall still works), default is for the default resource for the web interface and startup should be a flag, if the resource should start when the server starts.
  19. setElementData(resourceRoot, "foo", true) Use the resource root element.
  20. I showed you the (probably) easiest way. local models = { [417] = true, [593] = true, [493] = true, [509] = true, [487] = true, [497] = true } if models[getElementModel(veh)] then -- do something end local models = { 417, 593, 493, 509, 487, 497 } local vehmodel = getElementModel(veh) for index, model in pairs(models) do if vehmodel == model then -- do something break end end function hasModel(vehmodel) for index, model in pairs(models) do if vehmodel == model then return true end end return false end if hasModel(getElementModel(veh)) then -- do something end
  21. function containsNumber(what, ...) for index, value in pairs({...}) do if value == what then return true end end return false end if containsNumber(getElementModel(veh), 417, 593, 493, 509, 487, 497) then -- do something end
  22. Does not work with negative numbers function split_number(number) local values = { } while (number > 0) do values[#values + 1] = (number >= 30) and 30 or number number = number - values[#values] end return values end Works with negative numbers: function split_number(number) local values = { } while number ~= 0 do if number > 0 then values[#values + 1] = (number >= 30) and 30 or number else values[#values + 1] = (number <= -30) and -30 or number end number = number - values[#values] end return values end
  23. botder

    Coroutines

    IMHO are coroutines useless in MTA and should be avoided. I only delivered an example as explanation for him.
  24. Do you mean this one? https://wiki.multitheftauto.com/wiki/Ge ... ootElement
  25. You could try to stop mapmanager if you have only one map for the whole gamemode.
×
×
  • Create New...