Jump to content

Maurize

Members
  • Content Count

    226
  • Joined

  • Last visited

Everything posted by Maurize

  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) -- retur
  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) -
  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) outputChatB
  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. http://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.
  16. Hmm, seems like it was the too short timer which made trouble... howevery everything works fine now! Theres only that point, that I spawn the peds all arround los santos but sometimes if I shoot at a ped it doesn't loose health? SOLVED ~
  17. Hello everybody, I'm working on a "working" ped. However if resource is started a ped gets created. I trigger it to client and then execute following functions: local element = getLocalPlayer(); addEvent( "onClientActor", true ); addEventHandler( "onClientActor", element, function( actor ) if ( getElementData( element, "loaded" ) == false ) then setElementData( element, "loaded", true ); addEventHandler( "onClientRender", root, function() local enemy = getTarget( actor ); local _, _, rZ = getElementRotation( actor ); local aX, aY, aZ = getElementPosition( ac
  18. Falls das auch nicht funktioniert, probiert mal den Kompatibilitätsmodus aus,
  19. Die einen oder anderen Usernamen sagen mir sogar was. Falls das die Herrschaften von VIO sind, grüß mal lieb.
  20. Kostenlos wird sich da kein professioneller Scripter anbieten. Aber es gibt genug Scripter die das gegen etwas "Gage" machen.
  21. Hallo, habe dir dein script etwas überarbeitet Hoffe das problem ist gelöst! addCommandHandler( "starttruck", function( thePlayer ) curriercar = createVehicle( 411, 1200, -1831, 13.4, 0, 0, -90 , "currier" ) -- im wiki nachlesen welche parameter i.o. sind warpPedIntoVehicle( thePlayer, curriercar, 0 ) outputChatBox ( "Fahre zur angegebenen Markierung", thePlayer, 0, 130, 10, false ) currierblip = createBlip ( 1272.56, -1797.66, 13.13, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) curriermarker = createMarker ( 1272.56, -1797.66, 13.13, "checkpoint", 4.0, 255, 0,
  22. local mines = { { 1211, -1467.2827, -1287.6701, 99.15, 0, 0, 0 } }; -- all mines over here! addEventHandler( "onResourceStart", resourceRoot, -- if resource started the function starts to work! function() for i, v in ipairs( mines ) do -- loop the table above. you can add more mines if you add more data { { id, x, y, z, rx, ry, rz }, { same here and so on } } local mine = createObject( v[1], v[2], v[3], v[4], v[5], v[6], v[7] ); -- lets create it setElementData( mine, "mine", true ); -- lets set a data to remember it is a mine end setTimer( function() for i, p in ip
  23. Maurize

    ammo

    addEventHandler( "onPlayerVehicleEnter", getRootElement(), function( vehicle, seat, jacked ) if ( getElementModel( vehicle ) == 433 ) then if ( getPedWeapon( source ) == 31 ) then --if m4 giveWeapon( source, 31, 200 ); -- give m4 and 200 ammo elseif ( getPedWeapon( source ) == 30 ) then --if ak47 giveWeapon( source, 30, 300 ); -- then give weapon ak47 and 300 ammo elseif ( getPedWeapon( source ) == 35 ) then -- if rpg giveWeapon( source, 35, 2 ); -- then give weapon 35 and 2 ammo -- and so on how you like it. end outputChatBox( "Yeah, Ammo", source, 255, 255, 0 );
  24. Maurize

    ammo

    addEventHandler( "onPlayerVehiclenter", getRootElement(), function( vehicle, seat, jacked ) if ( ( getElementModel( vehicle ) == 433 ) and ( getPedWeapon( source, 5 ) == 31 ) ) then outputChatBox( "Yeah, Ammo", source, 255, 255, 0 ); giveWeapon( source, 31, 200 ); end end )
  25. addEvent( "onPlayerTax", true ); addEventHandler( "onPlayerTax", element, function() delay = 3600 - getElementData( element, "time" ); -- value starts from 1 and gets every second +1. Is loaded from database at spawn and saved in ElementData. setTimer( function() outputChatBox( "PAYDAY!" ); delay = 3600; end, delay, 0 ) end ) But what if player time is more than 3600? for example : delay = 3600 - 120120. Is there a math calculation which gets if a full hour is reached?
×
×
  • Create New...