Jump to content

HiroShi

Members
  • Posts

    73
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by HiroShi

  1. function buyItem(player, item, value, amount, count, db) if (getElementData(player, "char.money") or 0) >= amount then exports.inventario:giveItem(player, item, value, db, 0) takePlayerMoney(player, amount) exports["info"]:showBoxS(player,"Compra efetuada com sucesso","info") else exports["info"]:showBoxS(player,"Dinheiro insuficiente","error") end end addEvent("addItem", true) addEventHandler("addItem", getRootElement(), buyItem) tente isso
  2. Você deverá aprender muita coisa, recomendo estudar um pouco a Linguagem lua e a nossa wiki. você usará: addCommandHandler - evento para verificar o comando /cap. Para salvar o capacete/verificar o mesmo, deverá usar banco de dados. Você pode usar setElementData, getElementData, dbExec(Caso saiba usar sqLite), setAccountData. Para o evento de entrar no marker e aparecer a msg vc usará: onMarkerHit
  3. CNHCategorias = { {"A"}, {"B"}, {"C"}, {"D"}, {"E"}, } function Revistar (source) local Jogador = getElementData(source, "PX:Abordando") if Jogador then setPedAnimation( source, "POLICE", "plc_drgbst_01", 3100, true, false, false, false) triggerClientEvent(Jogador, "addNotification", root, "**Policial está te revistando!**", "info") if getPlayerWantedLevel(Jogador) >= 1 then outputChatBox("**O jogador está procurado pela justiça!**",source,255,0,0,true) else outputChatBox("**O jogador não está pedido!**",source,255,0,0,true)--------------------------------COR COR end for i,v in ipairs(CNHCategorias) do if getElementData(Jogador,"DNL:Categoria("..v[1]..")") == true then outputChatBox("**O jogador tem Habilitação "..v[1].."!**",source,255,0,0,true) else outputChatBox("**O jogador não tem Habilitação "..v[1].."!**",source,255,0,0,true) end end local Quantidade = getElementData(source, "PX:"..Droga_Selecionada.."") or 0 for slot = 0, 12 do local Armamento = getPedWeapon ( Jogador, slot ) if Armamento > 0 then local NomeDaArma = getWeaponNameFromID ( Armamento ) outputChatBox("**O jogador tem "..NomeDaArma.."!**",source,255,0,0,true) end end end end addEvent("PX:Revistar", true) addEventHandler("PX:Revistar", root, Revistar) pfv use esse código, está mais otimizado
  4. Concerteza ele depende de algum outro resource, e quando o servidor inicia ele não funciona corretamente pq o susposto resource não está ativo, mais quando você dar restart o Suposto resource ja deve está ativo
  5. Concerteza existe um função de deletar items desse inventário, recomendo procurar se dentro desse script tem alguma função com takeItem, removeItem, procure algo relacionado, ou então me mande a função server-side do seu sistema pfv
  6. basta usar isso: dbExec(db, "DELETE FROM Veiculos WHERE Conta = ? AND ID = ?", getAccountName(getPlayerAccount(player)), id_do_elemento)
  7. getElementRotation - função setElementRotation - função setTimer - evento recomendo usar isso, usar um evento setTimer, verificar a rotação do veiculo e mudar a rotação do player.
  8. @Tronerboyteste assim: -------------------------------------------------------------- -- © [2019] Varzen Advanced [2019] © -- -- © Creditos: Varzen Advanced © -- -- © Facebook: https://www.facebook.com/VarzenAdvanced © -- -- © Youtube: http://www.youtube.com/c/VarzenBR © -- -- © Blog: https://varzenadvanced.blogspot.com/ © -- -------------------------------------------------------------- addEvent("updateINTDIM2", true) addEventHandler("updateINTDIM2", getRootElement(), function (vehicleId) for index, value in ipairs (getElementsByType("vehicle")) do if getElementData(value, "ID") == tonumber(vehicleId) then if getElementData(value, "ownercar") == getElementData(source, "ID") then setElementInterior(value,0) setElementDimension(value,0) local x, y, z = getElementPosition(source) setElementPosition(value, x, y, z) warpPedIntoVehicle(source,value) end end end end ) addEvent("guardar", true) addEventHandler("guardar", getRootElement(), function (vehicleId) for index, value in ipairs (getElementsByType("vehicle")) do if getElementData(value, "ID") == tonumber(vehicleId) then if getElementData(value, "ownercar") == getElementData(source, "ID") then local gerarposicao = math.random(50,100) setElementPosition(value,1805.39368, -2448.51196, 13.44729) setElementInterior(value,gerarposicao) setElementDimension(value,gerarposicao) outputChatBox("#9ACD32[SRP] #ffffffVeículo Guardado.",source,0,0,0,true) end end end end ) addEvent("updateINTDIM22", true) addEventHandler("updateINTDIM22", getRootElement(), function (vehicleId) for index, value in ipairs (getElementsByType("vehicle")) do if getElementData(value, "ID") == tonumber(vehicleId) then if getElementData(value, "ownercar") == getElementData(source, "ID") then setElementInterior(value,0) setElementDimension(value,0) end end end end ) -------------------- Arquivo Cliente -------------------------------------------------------------- -- © [2019] Varzen Advanced [2019] © -- -- © Creditos: Varzen Advanced © -- -- © Facebook: https://www.facebook.com/VarzenAdvanced © -- -- © Youtube: http://www.youtube.com/c/VarzenBR © -- -- © Blog: https://varzenadvanced.blogspot.com/ © -- -------------------------------------------------------------- local customCarNames = { {474, "Fusca"}, {526, "Gol Gts"}, {410, "Chevette"}, {436, "Gol G4"}, {589, "Uno"}, {600, "Saveiro G7"}, {400, "EcoEsport"}, {579, "Fiat Touro"}, {587, "Bmw M3"}, {580, "Porsche Cayenne"}, {506, "Ferrari F430"}, {603, "Camaro"}, {451, "Lamborghine Galardo"}, {439, "Dodge charger"}, {586, "Titan-160"}, {468, "XT-660"}, {521, "XJ6"}, {581, "S1000"}, {522, "CB1000"}, } function getVehicleRealName(model) for k, v in ipairs(customCarNames) do if v[1] == model then return v[2] end end return "Desconhecido" end local odimension = getElementDimension(localPlayer) local ointerior = getElementInterior(localPlayer) local screenSize = {guiGetScreenSize()} screenSize.x, screenSize.y = screenSize[1], screenSize[2] local myScreenSource = dxCreateScreenSource(screenSize.x, screenSize.y) function infoSound(file) playSound("files/sounds/"..file..".mp3") end function isCursorHover(startX, startY, sizeX, sizeY) if isCursorShowing() then local cursorPosition = {getCursorPosition()} cursorPosition.x, cursorPosition.y = cursorPosition[1] * screenSize.x, cursorPosition[2] * screenSize.y if cursorPosition.x >= startX and cursorPosition.x <= startX + sizeX and cursorPosition.y >= startY and cursorPosition.y <= startY + sizeY then return true else return false end else return false end end local dashboardOpened = false local dutyskinOpened = false local width, height = 800, 450 local startX, startY = (screenSize.x - width) / 2 , (screenSize.y - height) / 2 local bgColor = tocolor(0, 0, 0, 180) local slotColor = tocolor(40, 40, 40, 200) local hoverColor = tocolor(154, 205, 50, 180) local secondColor = tocolor(154, 205, 50, 180) local cancelColor = tocolor(243, 85, 85, 180) local spacer = 2 local spacerBig = 5 local roboto = dxCreateFont("files/fonts/Roboto.ttf", 8, false, "proof") local robotoBold = dxCreateFont("files/fonts/Roboto.ttf", 10, true, "proof") local robotoBig = dxCreateFont("files/fonts/Roboto.ttf", 11, false, "proof") local robotoBig2 = dxCreateFont("files/fonts/Roboto.ttf", 10, false, "proof") local robotoGui = guiCreateFont("files/fonts/Roboto.ttf", 9) local menuPoints = {{"Propriedade", "property"}} local menuPointsWidth = (width - (#menuPoints - 1) * spacerBig) / #menuPoints local playerInfos = {} local optionsText = {"Ativado"} optionsText[0] = "Desligado" local changeTips = {"Desligar"} changeTips[0] = "Ligar" local vehicleTuningDatas = {{"engine", "Motor"}, {"turbo", "turbo"}, {"gearbox", "projeto de lei"}, {"ecu", "Ecu"}, {"pneus", "goma"}, {"brakes", "freio"}} local vehicleTunings = {"#999999Não", "#acd737Rua", "#ffcc00Profissional", "#ff6600Competição", "#ff1a1aEngrenagem" , "#ff1a1aEngrenagem"} vehicleTunings[0] = "#999999não" local optionsCreateColor = "" local optionsCreateText = "" local maxdistance = 0 local groupMembers = {} local groupVehicles = {} local meInGroup = {} local admins = {} local openedTick = getTickCount() - 2000 parkYerleri = {} park = dxCreateTexture("parking.png") parkYerleri = createMarker(1457.3518066406, -1783.7336425781, 13.546875-0.95, "cylinder", 2, 0, 176, 196, 10 ) parkYerleri2 = createMarker(1925.9207763672,-1857.4606933594,13.90625-0.95, "cylinder", 2, 0, 176, 196, 10 ) parkYerleri3 = createMarker(-2234.9548339844,2357.5026855469,5-0.95, "cylinder", 2, 0, 176, 196, 10 ) parkYerleri4 = createMarker(1705.2884521484,-1100.5689697266,23.178125, "cylinder", 2, 0, 176, 196, 10 ) parkYerleri5 = createMarker(2544.34, 2880.475, 104.769-0.95, "cylinder", 2, 0, 176, 196, 10 ) parkYerleri6 = createMarker(2814.2902832031, -1539.9907226563, 10.455365180969, "cylinder", 2, 0, 176, 196, 10 ) local myBlip = createBlipAttachedTo ( parkYerleri, 55 ) local myBlip2 = createBlipAttachedTo ( parkYerleri2, 55 ) local myBlip3 = createBlipAttachedTo ( parkYerleri3, 55 ) local myBlip4 = createBlipAttachedTo ( parkYerleri4, 55 ) local myBlip5 = createBlipAttachedTo ( parkYerleri5, 55 ) local myBlip6 = createBlipAttachedTo ( parkYerleri6, 55 ) function parkYeri() _3DResim(parkYerleri,park); _3DResim(parkYerleri2,park); _3DResim(parkYerleri3,park); _3DResim(parkYerleri4,park); _3DResim(parkYerleri5,park); _3DResim(parkYerleri6,park); end addEventHandler("onClientRender", getRootElement(), parkYeri) addEventHandler( "onClientMarkerHit", parkYerleri6, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then currentPage = 1 dashboardOpened = true openedTick = getTickCount() getMyVehicles() maxVehicleRows = 9 currentVehicleRow = 1 lastVehicleRow = 1 selectedVehicle = 1 end end ) addEventHandler( "onClientMarkerLeave", parkYerleri6, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then dashboardOpened = false end end ) addEventHandler( "onClientMarkerHit", parkYerleri5, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then currentPage = 1 dashboardOpened = true openedTick = getTickCount() getMyVehicles() maxVehicleRows = 9 currentVehicleRow = 1 lastVehicleRow = 1 selectedVehicle = 1 end end ) addEventHandler( "onClientMarkerLeave", parkYerleri5, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then dashboardOpened = false end end ) addEventHandler( "onClientMarkerHit", parkYerleri4, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then currentPage = 1 dashboardOpened = true openedTick = getTickCount() getMyVehicles() maxVehicleRows = 9 currentVehicleRow = 1 lastVehicleRow = 1 selectedVehicle = 1 end end ) addEventHandler( "onClientMarkerLeave", parkYerleri4, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then dashboardOpened = false end end ) addEventHandler( "onClientMarkerHit", parkYerleri3, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then currentPage = 1 dashboardOpened = true openedTick = getTickCount() getMyVehicles() maxVehicleRows = 9 currentVehicleRow = 1 lastVehicleRow = 1 selectedVehicle = 1 end end ) addEventHandler( "onClientMarkerLeave", parkYerleri3, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then dashboardOpened = false end end ) addEventHandler( "onClientMarkerHit", parkYerleri2, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then currentPage = 1 dashboardOpened = true openedTick = getTickCount() getMyVehicles() maxVehicleRows = 9 currentVehicleRow = 1 lastVehicleRow = 1 selectedVehicle = 1 end end ) addEventHandler( "onClientMarkerLeave", parkYerleri2, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then dashboardOpened = false end end ) addEventHandler( "onClientMarkerHit", parkYerleri, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then currentPage = 1 dashboardOpened = true openedTick = getTickCount() getMyVehicles() maxVehicleRows = 9 currentVehicleRow = 1 lastVehicleRow = 1 selectedVehicle = 1 end end ) addEventHandler( "onClientMarkerLeave", parkYerleri, function ( hitElement, matchingDimension ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then dashboardOpened = false end end ) addEventHandler("onClientDoubleClick", root, function(button) if button == "left" and dashboardOpened and currentPage == 1 then local selectedVehicleToGps = false lastVehicleRow = currentVehicleRow + maxVehicleRows - 1 for key, value in ipairs(myVehicles) do if key >= currentVehicleRow and key <= lastVehicleRow then key = key - currentVehicleRow + 1 local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22 if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) then selectedVehicleToGps = key + currentVehicleRow - 1 end end end if tonumber(selectedVehicleToGps) then --triggerServerEvent("updateINTDIM2", localPlayer, getElementData(myVehicles[selectedVehicleToGps], "ID")) gpsVehicle("gps", getElementData(myVehicles[selectedVehicleToGps], "ID")) end end end ) function gpsVehicle(commandName, vehicleId) if not vehicleId then outputChatBox("#9ACD32[SRP] #ffffffVocê não pode guardar um veículo com placa fria.",0,0,0,true) return end if vehicleId then for index, value in ipairs (getElementsByType("vehicle")) do if getElementData(value, "ID") == tonumber(vehicleId) then if not getElementData(value, "ownercar") == getElementData(localPlayer, "ID") then outputChatBox("#9ACD32[SRP] #ffffffVocê não é o dono do veículo!",0,0,0,true) return end local counter = 0 for seat, player in pairs(getVehicleOccupants(value)) do counter = counter + 1 end if counter > 0 then outputChatBox("#9ACD32[SRP] #ffffffNão pode guardar com um ocupante.",0,0,0,true) return end if (getElementDimension(value) == 0) then if not isElementWithinMarker(value, parkYerleri) then return end if not isElementWithinMarker(value, parkYerleri2) then return end if not isElementWithinMarker(value, parkYerleri3) then return end if not isElementWithinMarker(value, parkYerleri4) then return end if not isElementWithinMarker(value, parkYerleri5) then return end if not isElementWithinMarker(value, parkYerleri6) then return end setElementData(value,"veiculo.garagem", true) triggerServerEvent("guardar", localPlayer, vehicleId) return end if (getElementData(value, "detranAP")) then outputChatBox("#9ACD32[SRP] #ffffffSeu veiculo está no detran!",0,0,0,true) triggerServerEvent("updateINTDIM22", localPlayer, vehicleId) else triggerServerEvent("updateINTDIM2", localPlayer, vehicleId) outputChatBox("#9ACD32[SRP] #ffffffVeiculo retirado.",0,0,0,true) setElementData(value,"veiculo.garagem", false) end end end end end addEventHandler("onClientKey", root, function(button, pressed) if pressed and getElementData(localPlayer, "CharLoggedIn") then --if button == "F4" then --changeState() --cancelEvent() --end if dashboardOpened then if currentPage == 1 then if isCursorHover(startX + 2 * spacerBig, startY + 2 * spacerBig + 30, width / 2 - 4 * spacerBig, maxVehicleRows * 22 + spacer) then if button == "mouse_wheel_down" then if currentVehicleRow < #myVehicles - (maxVehicleRows - 1) then currentVehicleRow = currentVehicleRow + 1 end elseif button == "mouse_wheel_up" then if currentVehicleRow > 1 then currentVehicleRow = currentVehicleRow - 1 end elseif button == "mouse1" then lastVehicleRow = currentVehicleRow + maxVehicleRows - 1 for key, value in ipairs(myVehicles) do if key >= currentVehicleRow and key <= lastVehicleRow then key = key - currentVehicleRow + 1 local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22 if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) then selectedVehicle = key + currentVehicleRow - 1 end end end end end end end end end ) addEventHandler("onClientElementDataChange", root, function(dataName, oldValue) if source and getElementType(source) == "player" then if source == localPlayer then if dataName == "char:vehSlot" then getMyVehicles() end end end end) function thousandsStepper(amount) local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2') if k == 0 then break end end return formatted end function getMyVehicles() myVehicles = {} for key, value in ipairs(getElementsByType("vehicle")) do if getElementData(value,"ownercar") == getElementData(localPlayer,"ID") then table.insert(myVehicles, value) end end vehicleInfos = {"Solaria RolePlay - Garagem"} vehicleInfos2 = {"Clique duas vezes no veiculo para retirar/guardar"} end addEventHandler("onClientRender", root, function() if dashboardOpened then --if isChatVisible() then showChat(false) end if getElementData(localPlayer, "toggle-->All") then setElementData(localPlayer, "toggle-->All", false) end --dxDrawRectangle(startX, startY, width, height, bgColor) if currentPage == 1 then --- Vehicles local sizeX = ((width / 2 - 4 * spacerBig) - 2 * spacerBig) / 3 local key = 0 dxDrawText(vehicleInfos[key + 1], startX + 55 * spacerBig + key * (sizeX + spacerBig), startY + 5 * spacerBig, startX + 2 * spacerBig + key * (sizeX + spacerBig) + sizeX, startY + 2 * spacerBig + 30 - spacerBig, tocolor(255, 255, 255), 1, robotoBig, "center", "center") dxDrawText(vehicleInfos2[key + 1], startX + 55 * spacerBig + key * (sizeX + spacerBig), startY + 94 * spacerBig, startX + 2 * spacerBig + key * (sizeX + spacerBig) + sizeX, startY + 2 * spacerBig + 30 - spacerBig, tocolor(255, 255, 255), 1, robotoBig2, "center", "center") dxDrawRectangle(startX + 2 * spacerBig, startY + 2 * spacerBig + 30, width / 2 - 4 * spacerBig, maxVehicleRows * 22 + spacer, bgColor) if #myVehicles > 0 then for key = 0, maxVehicleRows - 1 do local forY = startY + 2 * spacerBig + 30 + spacer + key * 22 dxDrawRectangle(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20, slotColor) if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) or key == selectedVehicle - currentVehicleRow then dxDrawRectangle(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20, hoverColor) end end lastVehicleRow = currentVehicleRow + maxVehicleRows - 1 for key, value in ipairs(myVehicles) do if key >= currentVehicleRow and key <= lastVehicleRow then key = key - currentVehicleRow + 1 local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22 local statusv = getElementData(localPlayer,"veiculo.garagem", true) local modelo = getElementModel(value) dxDrawText(getVehicleRealName(modelo), startX + 3 * spacerBig + spacer, forY, startX + 3 * spacerBig + spacer + width / 2 - 4 * spacerBig - 2 * spacer, forY + 20, tocolor(255, 255, 255), 1, roboto, "left", "center") dxDrawText("Status: "..math.floor(getElementHealth(value) / 10 + 0.5).."%", startX + 2 * spacerBig + spacer, forY, startX + 2 * spacerBig + spacer + width / 2 - 5 * spacerBig - 2 * spacer, forY + 20, tocolor(255, 255, 255), 1, roboto, "right", "center") if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) or key == selectedVehicle - currentVehicleRow + 1 then dxDrawText(getVehicleRealName(modelo), startX + 3 * spacerBig + spacer, forY, startX + 3 * spacerBig + spacer + width / 2 - 4 * spacerBig - 2 * spacer, forY + 20, tocolor(0, 0, 0), 1, roboto, "left", "center") dxDrawText("Status: "..math.floor(getElementHealth(value) / 10 + 0.5).."%", startX + 2 * spacerBig + spacer, forY, startX + 2 * spacerBig + spacer + width / 2 - 5 * spacerBig - 2 * spacer, forY + 20, tocolor(0, 0, 0), 1, roboto, "right", "center") end end end else dxDrawText("Nenhum veiculo", startX + 2 * spacerBig + spacerBig, startY + 2 * spacerBig + 30, startX + 2 * spacerBig + spacerBig + width / 2 - 4 * spacerBig, startY + 2 * spacerBig + 30 + maxVehicleRows * 22 + spacer, cancelColor, 1, robotoBig, "center", "center") end local rightSx = startX + 390 + 4 * spacerBig end end end) function dxDrawButton(text, startX, startY, width, height, color) dxDrawRectangle(startX - 1, startY, 1, height, bgColor) --left dxDrawRectangle(startX + width, startY, 1, height, bgColor) --right dxDrawRectangle(startX - 1, startY - 1, width + 2, 1, bgColor) --top dxDrawRectangle(startX - 1, startY + height, width + 2, 1, bgColor) --bottom dxDrawRectangle(startX, startY, width, height, color) dxDrawText(text, startX, startY, startX + width, startY + height, tocolor(255, 255, 255), 1, roboto, "center", "center", false, false, false, true) end function dxDrawEdit(startX, startY, width, height, element) dxDrawRectangle(startX - 1, startY, 1, height, bgColor) --left dxDrawRectangle(startX + width, startY, 1, height, bgColor) --right dxDrawRectangle(startX - 1, startY - 1, width + 2, 1, bgColor) --top dxDrawRectangle(startX - 1, startY + height, width + 2, 1, bgColor) --bottom dxDrawRectangle(startX, startY, width, height, slotColor) dxDrawText(guiGetText(element), startX + 4, startY, startX + width, startY + height, tocolor(255, 255, 255), 1, roboto, "left", "center") end function _3DResim(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 2 local width = width or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255)) end end end end function dxDrawOctagon3D(x, y, z, radius, width, color) if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" then return false end local radius = radius or 1 local radius2 = radius/math.sqrt(2) local width = width or 1 local color = color or tocolor(255,255,255,150) point = {} for i=1,8 do point = {} end point[1].x = x point[1].y = y-radius point[2].x = x+radius2 point[2].y = y-radius2 point[3].x = x+radius point[3].y = y point[4].x = x+radius2 point[4].y = y+radius2 point[5].x = x point[5].y = y+radius point[6].x = x-radius2 point[6].y = y+radius2 point[7].x = x-radius point[7].y = y point[8].x = x-radius2 point[8].y = y-radius2 for i=1,8 do if i ~= 8 then x, y, z, x2, y2, z2 = point.x,point.y,z,point[i+1].x,point[i+1].y,z else x, y, z, x2, y2, z2 = point.x,point.y,z,point[1].x,point[1].y,z end dxDrawLine3D(x, y, z, x2, y2, z2, color, width) end return true end
  9. faça uma tabela vazia, dps puxe a tabela de contas do mysql e aplique nessa tabela, dps você puxa a imagem pelo nome da conta (da tabela que criou é claro).
  10. Então eu não sei se você viu isso no meu canal: Victor Scripting, mas ok vms lá vou deixar um exemplo a qual está na wiki do mta no seguinte link: https://wiki.multitheftauto.com/wiki/FetchRemote server-side: Este exemplo mostra como você pode buscar uma imagem de uma página da web e transferi-la para um cliente específico: function startImageDownload( playerToReceive ) fetchRemote ( "http://www.example.com/image.jpg", myCallback, "", false, playerToReceive ) end function myCallback( responseData, error, playerToReceive ) if error == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end client-side: addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function( pixels ) if myTexture then destroyElement( myTexture ) end myTexture = dxCreateTexture( pixels ) end ) addEventHandler("onClientRender", root, function() if myTexture then local w,h = dxGetMaterialSize( myTexture ) dxDrawImage( 200, 100, w, h, myTexture ) end end ) ou seja note que o fetchRemote pega/baixa essa imagem através do link dela e envia para a function: myCallback como parâmetro e a function myCallBack leva o objeto para o client-side através do triggerClientEvent. No client side ela recebe a imagem como um objeto e transforma numa textura através do dxCreateTexture e no evento onClientRender ela puxa a imagem pela sua variável.
  11. estive analisando to o tópico e as resposta da galera, então achei uma solução, porém complicada. Se você quer realmente proteger as imagens terá que deixar o arquivo client-side e server-side como cashe=fase, e pelo client você chamara uma função no server-side que é fetchRemote.
  12. ja que usa MYSQL poderia definir o avatar na tabela dos players, e ao digitar o nome ele puxa o avatar através do nome pelo banco de dados MYSQL.
  13. preciso que explique melhor a situação para melhor eu lhe ajudar .-.
  14. Nos 2 códigos já está determinado que se o jogador não tiver com o ID, vai ficar como: N/A, ou seja se ficar deslogado vai ficar assim !!!. Resumindo não precisa mexer mais em nada nesse sistema !
  15. amigo infelizmente em 2020 você não achará um curso de Lua(mtasa) o que eu recomendo é você estudar a logica da programação no YOUTUBE, e aprender sobre a linguagem Lua, para depois você vim na wiki, e ver o manual scripting da wiki!
  16. deve ser o seu radar, pois você deve atribuir funções para aparecer o blip. Caso você esteja usando um radar da INTERNET, recomendo usar outro .-.
  17. tente assim agora: local wx, hy = guiGetScreenSize() local gpsX = 250 local gpsY = 196 local mapSizeX = 214 local mapSizeY = 121 local mapX = -7.00 local mapY = hy-gpsY- -1 local playerX = mapX+127 local playerY = mapY+83.5 local playerSizeX = 26 local playerSizeY = 27 local playerSizeX2 = 16 local playerSizeY2 = 16 addEventHandler("onClientResourceStart", getResourceRootElement(),function() xsize = mapSizeX+30 rr = dxCreateRenderTarget(xsize,xsize,true) rr2 = dxCreateRenderTarget(xsize,xsize,true) centerleft = xsize / 2 centertop = mapSizeY / 2 blipsize = 16 end) playerTexture = dxCreateTexture ("images/GPS/player.png","argb",false,"clamp") playerTexture2 = dxCreateTexture ("images/GPS/player.png","argb",false,"clamp") mapTexture = dxCreateTexture ("images/GPS/radar.jpg","argb",false,"clamp") gpsTexture = dxCreateTexture ("images/GPS/gps.png","argb",false,"clamp") function drawPlayersInTeam(x,y) setPlayerHudComponentVisible("radar", false) --if not getElementData(getLocalPlayer(),"logedin") then return end if getElementData(getLocalPlayer(),"GPS") < 1 then return end for i, player in ipairs(getElementsByType("player")) do if getElementData(player,"gang") == getElementData(getLocalPlayer(),"gang") and getElementData(localPlayer,"gang") ~= 5000 and player ~= localPlayer and getElementData(player,"GPS") > 0 then local playerx,playery = getElementPosition (player) local _,_,rotplayer = getElementRotation(player) if getDistanceBetweenPoints2D ( x,y,playerx,playery) < 5000 then local markx, marky if x > 0 and y > 0 then markx, marky = centerleft+(math.abs(playerx/2)-math.abs(x/2)), centerleft-(math.abs(playery/2)-math.abs(y/2)) elseif x < 0 and y < 0 then markx, marky = centerleft-(math.abs(playerx/2)-math.abs(x/2)), centerleft+(math.abs(playery/2)-math.abs(y/2)) elseif x < 0 and y > 0 then markx, marky = centerleft-(math.abs(playerx/2)-math.abs(x/2)), centerleft-(math.abs(playery/2)-math.abs(y/2)) elseif x > 0 and y < 0 then markx, marky = centerleft+(math.abs(playerx/2)-math.abs(x/2)), centerleft+(math.abs(playery/2)-math.abs(y/2)) end dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255)) --dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255)) --dxDrawImage(markx-(playerSizeX2/2), marky-(playerSizeY2/2),playerSizeX2,playerSizeY2,playerTexture2,-rotplayer,0,0,tocolor(0, 0, 255)) end end end end function createGPS() --if not getElementData(getLocalPlayer(),"logedin") then return end if getElementData(getLocalPlayer(),"GPS") < 1 then return end local x,y = getElementPosition(getLocalPlayer()) local _, _,camrot = getElementRotation(getCamera()) dxSetRenderTarget(rr) dxDrawImageSection(0,0,xsize,xsize,1500+x/2-centerleft,1500-y/2-centerleft,xsize,xsize,mapTexture,0,0,0) drawPlayersInTeam(x,y) dxSetRenderTarget() dxSetRenderTarget(rr2) dxDrawImage(0,0,xsize,xsize,rr,camrot) dxSetRenderTarget() dxDrawImageSection(mapX+20,mapY+22,mapSizeX,mapSizeY,(xsize-mapSizeX)/2,(xsize-mapSizeY)/2,mapSizeX,mapSizeY,rr2,0,0,0) dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255)) dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255)) --dxDrawImage(playerX-playerSizeX/2,playerY-playerSizeY/2,playerSizeX,playerSizeY,playerTexture,0,0,0,tocolor(255, 0, 0, 255)) dxDrawImage(mapX+7,mapY,gpsX,gpsY,gpsTexture) end addEventHandler("onClientRender", getRootElement(), createGPS)
  18. cabeça doeu kk, mais acabei entendendo tudo
  19. você deve registrar os carros na tabela: customCarNames
  20. Você terá que fazer uma função igual a function getPlayerFromPartialName(name) no caso você fará um loop que verifica todos os players e separa o que tem o id a qual foi chamado ex: function getPlayerFromId(id) for i,v in ipairs("players") do if getElementData(v, "ID") == tonumber(id) then -- nesse caso usei o elementData famoso do DNL que é do sistema de id dele que é "ID" return v -- esse "V" veio através do loop antes da if o "V" era todos os jogogadores, mais apartir da IF ele se transformou no destinário ! end end end espero ter ajudado edit: lembrando para você chamar ele dentro da function que for usar você usa getPlayerFromId(Id do jogador)
×
×
  • Create New...