Jump to content

xyz

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by xyz

  1. xyz

    Peds' aim

    What? I don't want to trigger this on literally every colshape I leave. That colshape is the only colshape in that resource so I can use resourceRoot. I didn't ask for that. resourceRoot works well as it is. Also, I'm not leaving the colshape, just going behind a wall, how is leaving the colshape going to help in any way?
  2. xyz

    Peds' aim

    So I am making a robbery script with guards, but the guards only hit me when I restart the script near them. When I go behind a wall and come back their aim is off, and they don't hit me. It sometimes looks like the bullet goes into me but no damage. function cancelUnkillableDamage(p, md) if (isElement(p)) then if (p.type ~= "player") then return end addEventHandler("onClientRender", root, function() for _, v in ipairs(Element.getAllByType("ped")) do if (v:getData("ms:guard") == true) then local x, y, z = getPedBonePosition(p, 3) local px, py, pz = getElementPosition(v) local dg = findRotation(px, py, x, y) setPedAimTarget(v, x, y, z) setPedControlState(v, "fire", true) setElementRotation(v, 0, 0, tonumber(dg)) end end end) end end addEventHandler("onClientColShapeHit", resourceRoot, cancelUnkillableDamage)
  3. Doesn't look like you get playerPos from anywhere, can you post the function that triggers the checkPlayerPos event
  4. What makes the function get executed? Also the chances of being exactly at those coordinates are really slim.
  5. xyz

    ScrollBar

    onClientGUIScroll, guiScrollBarGetScrollPosition(scroll) / amount is what I use to limit the maximum
  6. Change root to localPlayer and remove root completely
  7. Use setElementRotation
  8. xyz

    Browser to ingame

    Second question is, how can I get ingame players to a browser site? inb4 no one knows
  9. Simply, does MTA have any connection thing that like starts it up and connects to a server if it's not started up or anything, if it does can I have an example? EDIT: From a webpage like from google chrome.
  10. Loop through all the players and use getDistanceBetweenPoints3D to check if they're near enough.
  11. So I made a script that creates a vehicle in the air, and the vehicle needs to drop instantly, but it doesnt as it's not rendered for anyone. Is there way to make it drop instantly?
  12. xyz

    SQL to gridlist

    Nobody can answer?
  13. xyz

    SQL to gridlist

    I do create a new table for every new user addEventHandler("onPlayerLogin", root, function() local acc = getPlayerAccount(source) local accn = getAccountName(acc) dbExec(con, "CREATE TABLE IF NOT EXISTS "..accn.." ('num', 'model', 'x', 'y', 'z', 'yRot', 'r', 'g', 'b', 'fuel', 'hp', 'plate', 'upgrades')") end)
  14. xyz

    SQL to gridlist

    Doesn't work, the problem here is that it doesn't get the stuff from the table, it just inserts nil and false into the gridlist.
  15. xyz

    SQL to gridlist

    I changed it, these are the errors I get. And yes the vehicles are saved to the database.
  16. xyz

    SQL to gridlist

    So I'm trying to make a vehicle system, and I can't get the stuff from SQL database to gridlist. -- Client function insertVehs(res) for _, vehn in ipairs(res) do local num, model, x, y, z, yRot, r, g, b, fuel, hp, plate, upgrades = unpack(vehn) local row = guiGridListAddRow(p.g) guiGridListSetItemText(p.g, row, 1, num, false, false) guiGridListSetItemText(p.g, row, 2, getVehicleNameFromModel(model), false, false) guiGridListSetItemText(p.g, row, 3, hp, false, false) guiGridListSetItemText(p.g, row, 4, fuel, false, false) end end addEvent("vehs:insertVehsIntoGui", true) addEventHandler("vehs:insertVehsIntoGui", root, insertVehs) bindKey("F3", "down", "vehicles") function openPGui() local state = not guiGetVisible(p.w) guiSetVisible(p.w, state) showCursor(state) triggerServerEvent("vehs:getVehicles", localPlayer) end addCommandHandler("vehicles", openPGui) -- Server function getActualVehs(qh, source) local res = dbPoll(qh, 0) triggerClientEvent(source, "vehs:insertVehsIntoGui", source, res) end function getVeh() local acc = getPlayerAccount(client) local accn = getAccountName(acc) dbQuery(getActualVehs, {client}, con, "SELECT * FROM "..accn) end addEvent("vehs:getVehicles", true) addEventHandler("vehs:getVehicles", root, getVeh)
  17. Do you have an actual police team? If so, change it so that team can use it, as that faction thingy might cause problems
  18. I helped you to start off, use dxDrawText and getTimerDetails to get the seconds thing. You won't learn if we do it for you
  19. setTimer( function () for _, v in ipairs(getElementsByType("player")) do if (isPedInVehicle(v)) then local x, y, z = getElementPosition(v) local veh = getPedOccupiedVehicle(v) destroyElement(veh) veh = nil vehicle = createVehicle(vehicle id here, x, y, z) warpPedIntoVehicle(v, vehicle) end end end, 15000, 0 ) This is what you mean? Just use math.random to change vehicle
  20. Showchat and showhud aren't that big of a problem in most cases, you can just cancel the chat event 'onPlayerChat' if the player isn't logged in. EDIT: You can probably disable showchat and showhud with canceling OnPlayerCommand, havent tested it
  21. nvm got working
  22. xyz

    Ped anims

    So I made this system that you can add peds with and they get saved to database, but after I reconnect the ped's animations don't happen. And yes, animations get saved to database.
  23. xyz

    From SQL to GUI Memo

    Got it working, thanks anyway.
  24. xyz

    From SQL to GUI Memo

    bad argument #1 to 'gsub' (string expected, got nil)
×
×
  • Create New...