MTA Mappen

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Da sind nur die 2 Dateien drin Client Objects und darin finde ich leider nichts.



    --[[************************************************** Developer: Justus* INFORMATION: getCameraLine, processCameraLineOfSight, processCursorLineOfSight, getTargetedElement are part of mta's map editor*************************************************--]]local g_maxSelectDistance = 50
    function getCameraLine() -- get start point of vector camX, camY, camZ, endX, endY, endZ = getCameraMatrix()
    -- alter the vector length to fit the maximum distance local distance = getDistanceBetweenPoints3D ( camX, camY, camZ, endX, endY, endZ ) targetX = camX + ((endX - camX)/distance) * g_maxSelectDistance targetY = camY + ((endY - camY)/distance) * g_maxSelectDistance targetZ = camZ + ((endZ - camZ)/distance) * g_maxSelectDistance
    return camX, camY, camZ, endX, endY, endZend-- get the point and element targeted by the camerafunction processCameraLineOfSight() local camX, camY, camZ, endX, endY, endZ = getCameraLine()
    -- get collision point on the line local surfaceFound, targetX, targetY, targetZ, targetElement, nx, ny, nz, material, lighting, piece, buildingId, bx, by, bz, brx, bry, brz, buildingLOD = processLineOfSight(camX, camY, camZ, endX, endY, endZ, true, true, true, true, true, true, false, true, localPlayer, true)
    -- if there is none, use the end point of the vector as the collision point if not surfaceFound then targetX, targetY, targetZ = endX, endY, endZ end
    local buildingInfo = buildingId and { LODid=buildingLOD, id=buildingId, x=bx, y=by, z=bz, rx=brx, ry=bry, rz=brz }
    return targetX, targetY, targetZ, targetElement, buildingInfoend-- get the point and element targeted by the cursorfunction processCursorLineOfSight() -- get start point of vector local camX, camY, camZ = getCameraMatrix()
    --! getCursorPosition is innacurate, so we get the coordinates from the click event local cursorX, cursorY, endX, endY, endZ = getCursorPosition()
    local surfaceFound, targetX, targetY, targetZ, targetElement, nx, ny, nz, material, lighting, piece, buildingId, bx, by, bz, brx, bry, brz, buildingLOD = processLineOfSight(camX, camY, camZ, endX, endY, endZ, true, true, true, true, true, true, false, true, localPlayer, true)
    -- if there is none, use the end point of the vector as the collision point if not surfaceFound then targetX, targetY, targetZ = endX, endY, endZ end
    local buildingInfo = buildingId and { LODid=buildingLOD, id=buildingId, x=bx, y=by, z=bz, rx=brx, ry=bry, rz=brz }
    return targetX, targetY, targetZ, targetElement, buildingInfoend
    function getTargetedElement(hitX, hitY, hitZ) local targetX, targetY, targetZ, targetedElement
    if (g_mode == CAMERA_MODE) then targetX, targetY, targetZ, targetedElement, buildingInfo = processCameraLineOfSight() elseif (g_mode == CURSOR_MODE) then targetX, targetY, targetZ, targetedElement, buildingInfo = processCursorLineOfSight() end
    local camX, camY, camZ = getCameraMatrix()
    -- check for collisionless elements between camera and collision point --local tempElement, tempHitX, tempHitY, tempHitZ = --processLineForElements(camX, camY, camZ, targetX, targetY, targetZ)
    -- if collisionless element was found in front of the collision point, use it if (tempElement) then targetedElement = tempElement targetX, targetY, targetZ = tempHitX, tempHitY, tempHitZ end
    if targetedElement then if getElementType(targetedElement) == "player" then targetedElement = false end end
    return targetedElement, targetX, targetY, targetZ, buildingInfoend
    local DISTANCE = 50function removeBuilding(cmd) local targetElement, targetX, targetY, targetZ, buildingInfo = getTargetedElement() removeWorldModel(buildingInfo.id, DISTANCE, buildingInfo.x, buildingInfo.y, buildingInfo.z) removeWorldModel(buildingInfo.LODid, DISTANCE, buildingInfo.x, buildingInfo.y, buildingInfo.z) saveToXML(buildingInfo.id, buildingInfo.LODid, buildingInfo.x, buildingInfo.y, buildingInfo.z) --teleport the player/camera far away to stream that buildings out local x, y, z = getCameraMatrix(localPlayer) setTimer(function() setCameraMatrix(x+1000, y+1000, z+1000) setTimer(function() setCameraMatrix(x, y, z) --teleport him back end, 50, 1) end, 50, 1)endaddCommandHandler("remove", removeBuilding)
    function saveToXML(model, LODmodel, x, y, z) local rootnode = xmlLoadFile("objects.xml") local child = xmlCreateChild(rootnode, "object") xmlNodeSetAttribute(child, "model", model) xmlNodeSetAttribute(child, "LODmodel", LODmodel) xmlNodeSetAttribute(child, "x", x) xmlNodeSetAttribute(child, "y", y) xmlNodeSetAttribute(child, "z", z) xmlSaveFile(rootnode)endaddEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() --get data from xml file if not fileExists("objects.xml") then outputChatBox("objects.xml existiert nicht. Neue objects.xml erstellt.", 255, 255, 0) local rootnode = xmlCreateFile("objects.xml", "objects") --create xml file, if not exists xmlSaveFile(rootnode) return end outputChatBox("Objekte werden entfernt...", 255, 255, 0) local rootnode = xmlLoadFile("objects.xml") local children = xmlNodeGetChildren(rootnode) for index, node in ipairs(children) do local model = tonumber(xmlNodeGetAttribute(node, "model")) local LODmodel = tonumber(xmlNodeGetAttribute(node, "LODmodel")) local x = tonumber(xmlNodeGetAttribute(node, "x")) local y = tonumber(xmlNodeGetAttribute(node, "y")) local z = tonumber(xmlNodeGetAttribute(node, "z")) --remove worldobjects removeWorldModel(model, DISTANCE, x, y, z) --model removeWorldModel(LODmodel, DISTANCE, x, y, z) --LOD endend)

  • Also ich Mappe ja mit beidem - MTA und Samp Map Constructor. Heute mehr mit SAMP als MTA aber früher hatte ich das immer so gemacht: Ich hab in MTA die Objekte entfernt und mir gemerkt, welche in entfernt habe. Nachdem ich mit der Map fertig war convertierte ich sie mir - bin in SAMP Consturctor rein und hatte dort die nötigen Objekte gelöscht. Den Code dann einfach mit zu den convertierten Zeilen schreiben und dem scripter schicken.

  • Objekte entfernt und wollte es dann unter OnGameModeInit einfügen

    Die Gelöschten Objekte müssen unter public OnPlayerConnect(playerid) und nicht unter public OnGameModeInit() dort kommen nur die gemappten Objekte rein ;) .

    Die Kritik an anderen hat noch keinem die eigene Leistung erspart.

    – Noël Coward