Jump to content

βurak

Members
  • Posts

    376
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by βurak

  1. Change "theplayer" to "source" like this function afterlogin() local skinData = dbQuery(connection,"SELECT * FROM accounts WHERE id=? AND skin=? LIMIT 1",(id),(skin)) local result = dbPoll( qh, -1 ) if (skinData) then setElementData(source,"id",skinData.id) setElementModel (source, skinData.skin ) end end addEventHandler("onPlayerLogin",root, afterlogin)
  2. Can you show the code so we can help you?
  3. no problem if you have any other questions, open a new thread and I will help you as much as I can ?
  4. yes, I tested it, it didn't work. How about doing it on the server side with "onVehicleStartExit" instead? server: function blockPlayerExitIfLocked() if(isVehicleLocked(source)) then cancelEvent() end end addEventHandler("onVehicleStartExit", root, blockPlayerExitIfLocked)
  5. function blockPlayerExitIfLocked() if(isVehicleLocked(source)) then cancelEvent() end end addEventHandler("onClientVehicleStartExit", root, blockPlayerExitIfLocked) can you try this if we test normally if you don't mind?
  6. marker1 = createMarker(163.017578125, -89.5458984375, 1000.8046875,"cylinder",1.5) try increasing the size of the marker a little bit 1.5
  7. I tested your code and didn't see any problem. As IIYAMA said, do you want to do this to all of these markers? edit: actually, there is another bug here, because of the size of the marker, onMarkerHit event is not triggered, it only triggers when teleported, so I changed the size of the marker to 2.0 and the problem was resolved. Is your problem something related to this?
  8. If you have any other problems, open a new topic, I will be happy to help you.
  9. local inhouse = createMarker(-1883.283203125, 865.4765625, 35.171875,"arrow",4.0,0,255,255) function createmymarker(hitElement) setElementPosition(hitElement,-1883.283203125, 865.4765625, 35.171875) setElementInterior(hitElement, 18) end addEventHandler("onMarkerHit", inhouse, createmymarker) now it is better
  10. function blockPlayerExitIfLocked() if (source:getData("vehicles:locked") == 1) then cancelEvent() end end addEventHandler("onClientVehicleStartExit", root, blockPlayerExitIfLocked) not sure but test this
  11. To do this, you can lock and export the file in 3ds max. There are different programs in txd or you can have a look at this topic. https://forum.multitheftauto.com/topic/131845-model-encrypter-protect-your-models-dff-txd-col/ if you are looking for a way to load the file without downloading it sorry i don't know that
  12. why don't you do it the normal way what is your purpose here by doing it?
  13. I tried this as normal. Are you sure this is what you want? Do you want to encrypt txd or dff? if not, you can get what you want by changing the extensions You can change it to ".dff.3D" or ".3D" same applies in txd it worked in both cases addEventHandler("onClientResourceStart", resourceRoot, function () local txd = engineLoadTXD("skin.txd.3D") engineImportTXD (txd, 10) local dff = engineLoadDFF("skin.dff.3D") engineReplaceModel(dff, 10) end ) <meta> <script src="skin_c.lua" type="client" /> <file src="skin.txd.3D" /> <file src="skin.dff.3D" /> </meta>
  14. for vehicle and player damage you can try these but I haven't tested them if attacker and getElementType(attacker) == "vehicle" and damage_causing == 49 then local player = getVehicleOccupant(attacker) local isGodForSource = getElementData(source, "godmode.active") local isGodForAttacker = getElementData(player, "godmode.active") if(isGodForSource or isGodForAttacker) then if(player ~= source) then cancelEvent() end end end if attacker and getElementType(attacker) == "player" then local isGodForSource = getElementData(source, "godmode.active") local isGodForAttacker = getElementData(attacker, "godmode.active") if(isGodForSource or isGodForAttacker) then if(attacker ~= source) then cancelEvent() end end end
  15. assuming you are using the edit box first get the link you entered with guiGetText guiGetText() then create an event on server side function startImageDownload(player, url) fetchRemote (url, sendFiletoClient, "", false, player) end function sendFiletoClient(responseData, errorCode, player) if (errorCode == 0) then triggerClientEvent(player, "printImageInfo", resourceRoot, responseData) else outputChatBox("Error Image Failed!", player) end end addEvent("requestGetImage", true) addEventHandler("requestGetImage", root, function(url) startImageDownload(source, url) end ) For client-side event, print the information before closing the file then close the file addEvent("printImageInfo", true) addEventHandler( "printImageInfo", resourceRoot, function(pixels) local image = fileCreate ("image.jpeg") fileWrite(image, pixels) local fileSize = fileGetSize(image) outputChatBox("File Size: "..fileSize.." Byte") fileClose(image) end ) then inside onClientGUIClick event call requestGetImage event with on triggerServerEvent triggerServerEvent("requestGetImage", localPlayer, link here) -- enter here the link you get with guiGetText then printImageInfo will tell you the size of the image with callback
  16. server: function startImageDownload(player) fetchRemote ("https://i.imgur.com/Aa9kXWi.jpeg", sendFiletoClient, "", false, player) -- use direct link for this end function sendFiletoClient(responseData, errorCode, player) if (errorCode == 0) then triggerClientEvent(player, "printImageInfo", resourceRoot, responseData) end end local player = getPlayerFromName("Burak2346") -- change with your nick startImageDownload(player) client: addEvent("printImageInfo", true) addEventHandler( "printImageInfo", resourceRoot, function(pixels) local image = fileCreate ("image.jpeg") fileWrite(image, pixels) local fileSize = fileGetSize(image) outputDebugString(fileSize) fileClose(image) end ) Since it calculates the file size in bytes, you can do some math and convert it to the size you want, such as kb, mb.
  17. fixed the problem is that the map is too high resolution, I reduced the map to 2k no problem now
  18. hello, sometimes when I go to another server and then enter my own local server, the map goes black like this and does not fix until I restart the mta. what could this be due to? this is how it is normally client: local screenW,screenH = guiGetScreenSize() local myW, myH = 1920, 1080 local relX, relY = (screenW/myW), (screenH/myH) local middleX,middleY = screenW/2, screenH/2 local thisResource = getThisResource() local isMapVisible = false local isInfoTextVisible = true local zoom = 1 local zoomRate = 0.1 local movementSpeed = 5 local minZoomLimit = 1 local maxZoomLimit = 5 local xOffset = 0 local yOffset = 0 local x,y = 0,0 local hSize = 0 local vSize = 0 local mapR, mapG, mapB, mapA = 255, 255, 255, 220 -- map opacity is mapA local mapDrawColor = tocolor(mapR, mapG, mapB, mapA) local normalColor = tocolor(255, 255, 255, 255) local mapFile = "images/radar8192.jpg" local topLeftWorldX, topLeftWorldY = -3000,3000 local lowerRightWorldX, lowerRightWorldY = 3000,-3000 local mapWidth, mapHeight = 6000,6000 local pixelsPerMeter = screenH/6000 local imageOwnerResource = getThisResource() local radarStates = { ["radar_zoom_in"] = false, ["radar_zoom_out"] = false, ["radar_move_north"] = false, ["radar_move_south"] = false, ["radar_move_east"] = false, ["radar_move_west"] = false } local CustomgetControlState = getPedControlState addEventHandler("onClientResourceStart", resourceRoot, function() toggleControl("radar", false) calculateFirstCoordinates() for control,state in pairs(radarStates) do for key,states in pairs(getBoundKeys(control)) do bindKey(key, "both", handleStateChange, control) end end end ) addEventHandler("onClientResourceStop", root, function(resource) if (resource == imageOwnerResource) and (resource ~= thisResource) then setPlayerZRMapImage() end end ) addEvent("onClientPlayerMapHide") addEvent("onClientPlayerMapShow") function getPedControlState(control) local radarState = radarStates[control] if (radarState == nil) then return CustomgetControlState(control) else return radarState end end function handleStateChange(key, state, control) radarStates[control] = (state == "down") end function calculateFirstCoordinates() hSize = pixelsPerMeter*mapWidth*zoom vSize = pixelsPerMeter*mapHeight*zoom x = middleX-hSize/2+xOffset*zoom y = middleY-vSize/2+yOffset*zoom end function drawRadarMap() if (isMapVisible == false) then dxDrawImage(0, 0, 0, 0, mapFile, 0, 0, 0, 0, false) else checkMovement() hSize = pixelsPerMeter*mapWidth*zoom vSize = pixelsPerMeter*mapHeight*zoom x = middleX-hSize/2+xOffset*zoom y = middleY-vSize/2+yOffset*zoom -- priority draws here dxDrawImage(x, y, hSize, vSize, mapFile, 0, 0, 0, mapDrawColor, false) drawRadarAreas() drawBlips() drawLocalPlayerArrow() drawInfoMessage() end end addEventHandler("onClientPreRender", root, drawRadarMap) function drawMapInfoText(text, posX, posY) local mapMin, mapMax local position = Vector2(posX, posY) do local mx, my, Mx, My = getPlayerZRMapBoundingBox() if (mx) then mapMin = Vector2(mx, my) mapMax = Vector2(Mx, My) else return end end local fMx, fMy = (position.x + 3000) / 6000, -(position.y - 3000) / 6000 local fmx, fmy = 1 - fMx, 1 - fMy local screenMapPos = Vector2((fmx * mapMin.x) + (fMx * mapMax.x), (fmy * mapMin.y) + (fMy * mapMax.y)) if (screenMapPos.x >= 0 and screenMapPos.y >= 0 and screenMapPos.x <= screenW and screenMapPos.y <= screenH) then dxDrawText(text, screenMapPos.x, screenMapPos.y, screenMapPos.x, screenMapPos.y, tocolor(255, 255, 255, 255), 1 * relX, "default", "center", "center") end end function drawInfoMessage() if(isInfoTextVisible) then drawMapInfoText("(+) Zoom In Map. / (-) Zoom Out Map.", 0, 2890) drawMapInfoText("(NUM 4) Move Left. / (NUM 6) Move Right.", 0, 2770) drawMapInfoText("(NUM 8) Move Forward. / (NUM 2) Move Backward.", 0, 2650) drawMapInfoText("(NUM 0) Hide / Show This Info.", 0, 2530) end end function drawRadarAreas() local radarAreas = getElementsByType("radararea") if (#radarAreas > 0) then local tick = math.abs(getTickCount()%1000-500) local aFactor = tick/500 for _,radararea in ipairs(radarAreas) do local x,y = getElementPosition(radararea) local sx,sy = getRadarAreaSize(radararea) local r,g,b,a = getRadarAreaColor(radararea) local isFlashing = isRadarAreaFlashing(radararea) if (isFlashing) then a=a*aFactor end local hx1,hy1 = getZRMapFromWorldPosition(x, y+sy) local hx2,hy2 = getZRMapFromWorldPosition(x+sx, y) local width = hx2-hx1 local height = hy2-hy1 dxDrawRectangle(hx1, hy1, width, height, tocolor(r, g, b, a), false) end end end function drawBlips() local blips = getElementsByType("blip") for _,blip in ipairs(blips) do local icon = getBlipIcon(blip) or 0 local size = (getBlipSize(blip) or 2)*4 local r,g,b,a = getBlipColor(blip) if (icon ~= 0) then r,g,b = 255, 255, 255 size = 16 end local x,y,z = getElementPosition(blip) x,y = getZRMapFromWorldPosition(x, y) local halfsize = size/2 dxDrawImage(x-halfsize, y-halfsize, size, size, "images/blips/"..icon..".png", 0, 0, 0, tocolor(r, g, b, a), false) end end function drawLocalPlayerArrow() local x,y,z = getElementPosition(localPlayer) local _, _, rz = getElementRotation(localPlayer) local mapX, mapY = getZRMapFromWorldPosition(x, y) dxDrawImage(mapX-8, mapY-8, 16, 16, "images/blips/2.png", (-rz)%360, 0, 0, normalColor, false) end function zoomOutRecalculate() local newVSize = pixelsPerMeter*mapHeight*zoom if (newVSize > screenH) then local newY = middleY-newVSize/2+yOffset*zoom if (newY > 0) then yOffset = -(middleY-newVSize/2)/zoom elseif (newY <= (-newVSize+screenH)) then yOffset = (middleY-newVSize/2)/zoom end else yOffset = 0 end local newHSize = pixelsPerMeter*mapWidth*zoom if (newHSize > screenW) then local newX = middleX-newHSize/2+xOffset*zoom if (newX >= 0) then xOffset = -(middleX-newHSize/2)/zoom elseif (newX <= (-newHSize+screenW)) then xOffset = (middleX-newHSize/2)/zoom end else xOffset = 0 end end function checkMovement() -- Zoom if (getPedControlState("radar_zoom_in") and zoom < maxZoomLimit) then zoom = zoom+zoomRate if (zoom > maxZoomLimit) then zoom = maxZoomLimit end elseif (getPedControlState("radar_zoom_out") and zoom > minZoomLimit) then zoom = zoom-zoomRate if (zoom < minZoomLimit) then zoom = minZoomLimit end zoomOutRecalculate() end -- Move if (getPedControlState("radar_move_north")) then local newY = y-yOffset*zoom+(yOffset+movementSpeed)*zoom if (newY < 0) then yOffset = yOffset+movementSpeed end end if (getPedControlState("radar_move_south")) then local newY = y-yOffset*zoom+(yOffset-movementSpeed)*zoom if (newY > (-vSize+screenH)) then yOffset = yOffset-movementSpeed end end if (getPedControlState("radar_move_west")) then local newXOff = (xOffset+movementSpeed) local newX = x-xOffset*zoom+newXOff*zoom if (newX < 0) then xOffset = xOffset+movementSpeed end end if (getPedControlState("radar_move_east")) then local newX = x-xOffset*zoom+(xOffset-movementSpeed)*zoom if (newX > (-hSize+screenW)) then xOffset = xOffset-movementSpeed end end end function toggleZRMap() if(isMapVisible) then local onMapHide = triggerEvent("onClientPlayerMapHide", root, false) if(onMapHide) then isMapVisible = false end else local onMapShow = triggerEvent("onClientPlayerMapShow", root, false) if(onMapShow) then isMapVisible = true end end end bindKey("F11", "down", toggleZRMap) function toggleInfoText() if(isMapVisible == false) then return end if(isInfoTextVisible == false) then isInfoTextVisible = true else isInfoTextVisible = false end end bindKey("num_0", "down", toggleInfoText) -- EXPORT FUNCTIONS function getPlayerZRMapBoundingBox() return x,y,x+hSize,y+vSize end function isPlayerZRMapVisible() return isMapVisible end function setPlayerZRMapVisible(value) isMapVisible = value if(isMapVisible) then triggerEvent("onClientPlayerMapShow", root, true) else triggerEvent("onClientPlayerMapHide", root, true) end end function getZRMapFromWorldPosition(worldX, worldY) local mapX = x+pixelsPerMeter*(worldX-topLeftWorldX)*zoom local mapY = y+pixelsPerMeter*(topLeftWorldY-worldY)*zoom return mapX, mapY end function getWorldFromZRMapPosition(mapX, mapY) local worldX = topLeftWorldX+mapWidth/hSize*(mapX-x) local worldY = topLeftWorldY-mapHeight/vSize*(mapY-y) return worldX, worldY end function setPlayerZRMapImage(image, tLX, tLY, lRX, lRY) if (image and type(image) == "string") and (type(tLX) == "number") and (type(tLY) == "number") and (type(lRX) == "number") and (type(lRY) == "number") then sourceResource = sourceResource or thisResource if (string.find(image,":") ~= 1) then sourceResourceName = getResourceName(sourceResource) image = ":"..sourceResourceName.."/"..image end if (dxDrawImage(0, 0, 0, 0, image, 0, 0, 0, 0, false)) then imageOwnerResource = sourceResource mapFile = image topLeftWorldX,topLeftWorldY = tLX,tLY lowerRightWorldX,lowerRightWorldY = lRX,lRY mapWidth,mapHeight = lRX-tLX,tLY-lRY pixelsPerMeter = math.min(screenW/(mapWidth),screenH/mapHeight) zoom = 1 xOffset = 0 yOffset = 0 return true end elseif not (image) then imageOwnerResource = thisResource mapFile = "images/radar8192.jpg" topLeftWorldX,topLeftWorldY = -3000,3000 lowerRightWorldX,lowerRightWorldY = 3000,-3000 mapWidth,mapHeight = 6000,6000 pixelsPerMeter = screenH/6000 zoom = 1 xOffset = 0 yOffset = 0 return true end return false end function getPlayerZRMapImage() return mapFile end function setPlayerZRMapColor(colorR, colorG, colorB, colorA) mapDrawColor = tocolor(colorR, colorG, colorB, colorA) mapR, mapG, mapB, mapA = colorR, colorG, colorB, colorA end function setPlayerZRMapMovementSpeed(value) movementSpeed = value end function getPlayerZRMapMovementSpeed() return movementSpeed end function getPlayerZRMapZoomFactor() return zoom end function getPlayerZRMapZoomRate() return zoomRate end function setPlayerZRMapZoomFactor(value) if (value >= minZoomLimit) and (value <= maxZoomLimit) then local prevZoom = zoom zoom = value if (value < prevZoom) then zoomOutRecalculate() end end end function setPlayerZRMapMinZoomLimit(value) minZoomLimit = value end function setPlayerZRMapMaxZoomLimit(value) maxZoomLimit = value end function getPlayerZRMapMinZoomLimit() return minZoomLimit end function getPlayerZRMapMaxZoomLimit() return maxZoomLimit end function getPlayerZRMapColor() return mapR, mapG, mapB, mapA end
  19. triggerServerEvent("otur2", localPlayer, localPlayer) try using it like this
  20. βurak

    Marker

    ok my mistake try this code local DELAY_TELEPORT = 5000 -- millisecond delay local IntervalTeleport = 0 local hitsCount = 0 local teleportX, teleportY, teleportZ = 106.99030, 1924.18860, 18.52914 local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255) addEventHandler("onMarkerHit", teleportMarker, function(hitElement) if(getElementType(hitElement) == "player") then if(hitsCount < 5) then setElementPosition(hitElement, teleportX, teleportY, teleportZ) hitsCount = hitsCount + 1 if(hitsCount == 5) then IntervalTeleport = getTickCount() end else if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second setElementPosition(hitElement, teleportX, teleportY, teleportZ) IntervalTeleport = getTickCount() else outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false) end end end end )
  21. βurak

    Marker

    I tested the code, I didn't see any problems, it works as it should, maybe you can extend the waiting delay?
  22. βurak

    Marker

    local DELAY_TELEPORT = 5000 -- millisecond delay local IntervalTeleport = 0 local hitsCount = 0 local teleportMarker = createMarker(0, 0, 3, "cylinder", 3.0, 255, 0, 0, 255) addEventHandler("onMarkerHit", teleportMarker, function(hitElement) if(getElementType(hitElement) == "player") then if(hitsCount < 5) then setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914) hitsCount = hitsCount + 1 else if(IntervalTeleport and getTickCount() - IntervalTeleport > DELAY_TELEPORT) then --teleport player every 5 second setElementPosition(hitElement, 106.99030, 1924.18860, 18.52914) IntervalTeleport = getTickCount() else outputChatBox("You need to wait 5 seconds!", hitElement, 255, 0, 0, false) end end end end ) you can try this
  23. You can use hasObjectPermissionTo You can give the authority to use weapons to the groups you want. If you add this to the group's acl rights, that group will be able to use weapons. otherwise their weapons will be taken <right name="permission.weaponUse" access="true"></right> and change your lua code like this function test1() local playerAccount = getPlayerAccount(source) if(isGuestAccount(playerAccount) == false) then local accName = getAccountName(playerAccount) if(hasObjectPermissionTo(source, "permission.weaponUse", false) == false) then takeAllWeapons(source) outputChatBox ("Tagın olmadığı için silahların alındı.", source, 255, 0, 0, true) end end end addEventHandler("onPlayerWeaponSwitch", getRootElement(), test1)
  24. function test1() local playerAccount = getPlayerAccount(source) if(isGuestAccount(playerAccount) == false) then local accName = getAccountName(playerAccount) if not isObjectInACLGroup("user."..accName, aclGetGroup("EGM")) then takeAllWeapons(source) outputChatBox ("Tagın olmadığı için silahların alındı.", source, 255, 0, 0, true) end end end addEventHandler("onPlayerWeaponSwitch", getRootElement(), test1) try this
×
×
  • Create New...