Jump to content

Maurize

Members
  • Posts

    226
  • Joined

  • Last visited

About Maurize

  • Birthday 27/05/1994

Details

  • Location
    Germany, Wolfsburg

Recent Profile Visitors

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

Maurize's Achievements

Trick

Trick (18/54)

0

Reputation

  1. However it seems like that any element which is attached to another will lose it's element data on move. (maybe it's because the "element" data remains at the default location)
  2. Thank you very much! The function is exactly what I needed! The positions are now exactly like I want them.
  3. Hello again, I'm trying to spawn the player onto an element. This element has a non-fixed rotation. I'm just wondering if the function getPointFromDistanceRotation isn't enough to do this? Player details can be found here and the ships details are here I'm currently using this snippet (to try) to get the explained result: addCommandHandler("boat", function(player, cmd) local x, y, z = getElementPosition(player) local _, _, r = getElementRotation(player) outputChatBox("player pos: "..x..","..y..","..z..","..r, player) local ship = createShip(x, y, z, r) -- returns model of pirateship local x, y, z = getElementPosition(ship) local _, _, r = getElementRotation(ship) outputChatBox("ship pos: "..x..","..y..","..z..","..r, player) local x, y = getPointFromDistanceRotation(x - 0.1, y - 2.7, 5, r) -- offset included outputChatBox("new player pos: "..x..","..y..","..z..","..r, player) setElementPosition(player, x, y, 43.7) end) What am I'm doing wrong? Do I need to calculate the offset coordinates extra? Greetings, Maurize
  4. Update: The creation of the elements could be useful for finding a solution local ship = createObject(8493, x, y, z) server.ships[id].ship = ship ... local doorEntrance = createObject(3093, x, y, z) attachElements(doorEntrance, ship, -1.2, -30.3, -9.9, 0, 0, 270) ... local action = #server.actions + 1 server.actions[action] = enterBoat setElementData(doorEntrance, "action", action) setElementData(doorEntrance, "parent", id) ... function enterBoat(player, element) local id = getElementData(element, "parent") teleportPlayer(player, true, 3, -4, 1000.6, 90, id) -- simple set position with camera effects end
  5. Hello forums! to the current script: I created a boat (vehicle) and attached a pirateship to it. On the pirateship there are some doors attached. I'm using following function to interact with the objects: addEvent("onPlayerInteraction", true) addEventHandler("onPlayerInteraction", server.root, function() local nearest = getNearest(source, "object", 5) -- is working if (nearest) then outputChatBox("object found", source) local id = getElementData(nearest, "action") if (id) then local action = server.actions[id] action(source, nearest) outputChatBox("object found with id"..id, source) else outputChatBox("object found with no id", source) end else outputChatBox("no object found", source) end end) If the ship is created (and not moved) everything works fine. As soon as the ship is moved the function outputs "no object found". Is this a known bug or am I'm missing something?
  6. Right. This makes sense, Castillo. This means an if-statement where I call data from database is impossible?
  7. Yeah I thought the same but this didn't solved my problem. If I try to outputChatBox the result it gives an error -> Expected string Current function: local db = dbConnect("mysql", "host=localhost;dbname=mtasa", "root", ""); function getData(player, db_table, db_row) dbQuery(function(e) local r = dbPoll(e, 0); return r[1][db_row]; end, db, "SELECT "..db_row.." FROM "..db_table.." WHERE username = '"..getPlayerName(player).."' LIMIT 1"); end I think the async makes problems. If I do the query directly in database it works like charm but not in .lua.
  8. Hey, Solidsnake14. Thanks, this is a useful hint (performance...). Anyway something seems like to fail. Sadly there is no way to print the whole table.
  9. Hello Ladies and Gentleman, I'm tying to create a function which allows me to get fields from my mysql table. What I've done so far: local db = dbConnect("mysql", "host=localhost;dbname=mtasa", "root", ""); function getData(player, db_table, db_row) dbQuery(function(e) local result = dbPoll(e, 0); return result[db_row]; end, db, "SELECT "..db_row.." FROM "..db_table.." WHERE username = '"..getPlayerName(player).."' LIMIT 1"); end This gives an error if I try to outputChatBox the result. Maybe someone can help me up with this.
  10. Hello community, As I watched the movie 'Chappie' I'm wondering how those "roboters" are build. My plan is to control an electrical part from car which moves up and down if power is on. So this is my current plan: -end- actuator(from car ~ 12v) <-- ? (must be programmable via usb port) <-- power unit - for electricity(from computer, later from car battery ~ 80-100ah | both have a power output of 12v) -start- I only need the cut between this components to write the program via usb port (or stick). So any ideas?
  11. Maurize

    quetion

    Lad his question was: --serverside-- addEventHandler( "onResourceStart", resourceRoot, function() for i, v in ipairs( getElementsByType( "player" ) ) do triggerClientEvent( "onPlayerCreateMarker", v ); end end ) --clientside-- addEvent( "onPlayerCreateMarker", true ); addEventHandler( "onPlayerCreateMarker", getLocalPlayer(), local marker = createMarker( x, y, z, "cylinder", 1, 255, 255, 0, 255 ); -- now you can add the rest of functions to marker here end ) This will do the work!
  12. If you want simple refill vehicle health use setElementHealth( vehicle, 1000 ) If you want to increase the vehicle health in maximum use a timer or the onVehicleDamage event. https://wiki.multitheftauto.com/wiki/SetElementHealth https://wiki.multitheftauto.com/wiki/OnVehicleDamage
  13. You have to change FarClipDistance for object. https://wiki.multitheftauto.com/wiki/SetFarClipDistance
  14. I don't really get what you want but if you want to prevent ped from being teleported into the helicopter simply delete the line with warpPedIntoVehicle( ... )
  15. Maurize

    quetion

    for i, v in ipairs( getElementsByType( "player" ) ) do local marker = createMarker( ... ) end nerver tried, maybe works. But if this doesn't work you could trigger for all players from serverside and then create marker clientside.
×
×
  • Create New...