SDK

Members
  • Content Count

    635
  • Joined

  • Last visited

Community Reputation

1 Neutral

3 Followers

About SDK

  • Rank
    Pimp

Details

  • Location
    Planckendael (Belgium)

Recent Profile Visitors

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

  1. This should be in scripting, but you need to change the gamemode in the meta for the mode and the maps so mapmanager recognizes them as different
  2. Some suggestions I came up with that would be a big improvement over the default debug console: + reload log on join so you can see what happened before you joined or what happens on /reconnect + view the debug of other clients + toggle to prevent spam like suggested earlier
  3. Looks interesting, hope you continue working on it
  4. Tried something, not tested but hoping to give you a general idea. Arenas = {} Arenas.selected = nil -- ... addEventHandler("onClientRender",root, function() local isAnyArenaSelected = false for i, arena in pairs(Arenas) do local r, g, b = getColorFromString(getElementData(arena.Element, "color")) arena.Color = tocolor(r, g, b, 255) dxDrawRectangle ( arena.x, arena.y, arena.size, arena.height, arena.Color, true) local mx, my = getCursorPosition() hover = mouseCheck(mx, my, arena.x, arena.x+arena.size, arena.mouseY, arena.mouseY+arena.height) if hover == true then isAnyArenaSelected = true if not Arenas.selected then -- preset animation when mouse is over arena selectArena(arena) end end end if not isAnyArenaSelected and Arenas.selected then -- preset animation when mouse isn't over any arena and there is still one selected selectArena( nil ) end end) function selectArena(arena) Arenas.selected = arena -- this function prepares all new positions and sizes when an arena is (de)selected for i, a in pairs(Arenas) do if arena == nil then -- no arena selected, move back to default size and position arena.next_y = ... arena.next_height = defaultArenaHeight elseif a == arena then -- this is the selected arena, maximum height arena.next_y = ... arena.next_height = MaxArenaHeight else -- this is an arena that needs to be minimized arena.next_y = ... arena.next_height = defaultArenaHeight * NumArenas - MaxArenaHeight end end end setTimer(function() -- this timer moves y and height up to their next_ value for i, arena in pairs(Arenas) do if (arena.next_y and arena.y ~= arena.next_y) then if arena.y < arena.next_y then arena.y += 1 else arena.y += -1 end end if (arena.next_height and arena.height ~= arena.next_height) then if arena.height < arena.next_height then arena.height += 1 else arena.height += -1 end end end end, 100, 0) -- 100 can be used to change the animation speed If you're still having trouble I would recommend adding one feature at the time to your script. Use GUI Images and use clicks (OnClientGUIClick) instead of hovering to keep it simple and have something that works. Afterwards you can modify that to use onClientMouseEnter/Leave for hover or back to dxDraw functions.
  5. MTA's login system is built-in, there are no .lua files.
  6. Car health ranges from a little above 1000 to 250, between 250 and 0 the car is burning. To ignore the under 250 part you can use math.max(). So to get it in a percentage: carHealth = ( math.max(getElementHealth(vehicle) - 250, 0) ) / 7.5 Slap some rounding function on that and you should be good to go.
  7. I think you don't need to split it if you use this function: http://wiki.multitheftauto.com/wiki/Tri ... lientEvent Not sure, since I never used it myself before
  8. Some small mistakes fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then local skin = getElementModel (player) if ( skin == 100 or skin == 255) then cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi )
  9. You can delete all the files with fileDelete on onClientResourceStart or an other event.
  10. There's no real function for it yet, but there's an note here: http://wiki.multitheftauto.com/wiki/SetObjectStatic (replaced with setElementFrozen) So you could use onClientRender and isElementOnScreen to recreate the broken objects. As an extra you could run a timer which recreates every object every 5 seconds, depending on how important the objects are.
  11. SDK

    SQL question

    Yes, has been awhile since used sqlite im afraid The first query was wrong: "CREATE TABLE tempTable AS SELECT DISTINCT * FROM originalTable" "DROP TABLE originalTable" "ALTER TABLE tempTable RENAME TO originalTable" I tested it on a commandline and it worked, no duplicates.
  12. function killMe (thePlayer) if (thePlayer) then setTimer (killPed, 10000, 1, thePlayer) outputChatBox("You will be killed in 10 seconds.", thePlayer, 255, 0, 0) end end addCommandHandler ("kill", killMe)
  13. while not setElementModel (localPlayer,newSkin) do newSkin = newSkin + 1 end triggerServerEvent ("skin", localPlayer, newSkin) This will first find a skin to the left/right, and then send it to the server Edit: ninja
  14. SDK

    SQL question

    Another way is using SELECT DISTINCT, which only selects unique rows and skips the duplicates, to create a (fixed) new db. "SELECT DISTINCT * INTO newtable FROM oldtable" Then drop (delete) the original table "DROP TABLE oldtable" and rename the new table to the old one. "ALTER TABLE newtable RENAME TO oldtable" (Found this after some googling, I'd expect it to work, but didn't test it so make sure you backup your database first)
  15. You need to use setElementModel serverside, use triggerServerEvent in the gui script to send the skin to the server.