Jump to content

Search the Community

Showing results for tags 'scripting'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. CLIENT: function cancelTazerDamage(attacker, weapon, bodypart, loss) if (weapon==24) then -- deagle local mode = getElementData(attacker, "handTaser") if (mode==true) then cancelEvent() end end end addEventHandler("onClientPlayerDamage", localPlayer, cancelTazerDamage) local cFunc = {} local cSetting = {} cSetting["shots"] = {} cSetting["shot_calcs"] = {} local last_shot = 1 cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) local lastx, lasty, lastz = x1, y1, z1 local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) cSetting["shot_calcs"][last_shot] = {} last_shot = last_shot+1 end cFunc["wait_shot"] = function() toggleControl("fire", false) setTimer(function() toggleControl("fire", true) end, 15000, 1) end cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) if(wp == 24) and (getElementData(localPlayer,"handTaser"))then cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) cancelEvent() if(source == localPlayer) then cFunc["wait_shot"]() end end end cFunc["anim_check"] = function(attacker, wep, bodypart,loss) if(wep == 24) and (getElementData(localPlayer,"handTaser"))then local playerX,playerY,playerZ = getElementPosition(localPlayer) local targetX,targetY,targetZ = getElementPosition(source) if getDistanceBetweenPoints3D(playerX,playerY,playerZ,targetX,targetY,targetZ) <= 12 then triggerServerEvent("tazerFired", getRootElement(), source) end end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientResourceStart",resourceRoot,function() setElementData(localPlayer, "tazed",0) end) addEventHandler("onClientRender",getRootElement(),function() if getElementData(localPlayer, "tazed") == 1 then toggleAllControls(false, false, false) toggleControl("fire", false) toggleControl("sprint", false) toggleControl("crouch", false) toggleControl("jump", false) toggleControl('next_weapon',false) toggleControl('previous_weapon',false) toggleControl('aim_weapon',false) end end) SERVER: local cFunc = {} local cSetting = {} function tazerFired(target) if (isElement(target) and getElementType(target)=="player") then fadeCamera ( target, false, 1.0, 255, 255, 255 ) setElementData(target, "tazed", 1) toggleAllControls(target, false, false, false) setPedAnimation(target, "ped", "FLOOR_hit_f", -1, false, false, true) setTimer(removeAnimation, 30000, 1, target) end end addEvent("tazerFired", true ) addEventHandler("tazerFired", getRootElement(), tazerFired) function removeAnimation(thePlayer) if (isElement(thePlayer) and getElementType(thePlayer)=="player") then fadeCamera(thePlayer, true, 0.5) if getElementData(thePlayer,"isAnim") then setElementFrozen(thePlayer,true) setPedAnimation(thePlayer,"sweet","sweet_injuredloop",-1,false,false,false) else setPedAnimation(thePlayer,nil,nil) toggleAllControls(thePlayer, true, true, true) end setElementData(thePlayer, "tazed", 0) end end I do not get any errors/warnings in debugscript 3, just simply does not working the script.. What wrong in this codes? :s
  2. Eu queria separar as funções de um script de bar ( Separar uma função pra cada bebida, Catuaba, Vodca e Cerveja ) pois é muito desorganizado e tambem porque coloquei um painel novo nesse script... ja tentei varias e varias vezes e todas deram errado; c.lua ( A Parte das funções que quero separar Antes ) Esse aqui funciona normalmente, mas o proximo que eu separei não funciona.. function clickEffectDrink(button,state) if button == "left" and state == "up" then if isMouseInPosition(drawDrinksBVS.bgCatuabaX, drawDrinksBVS.bgCatuabaY, drawDrinksBVS.bgCatuabaW, drawDrinksBVS.bgCatuabaH) then if (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 200) else playSoundFrontEnd(6) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end elseif isMouseInPosition(drawDrinksBVS.bgVodkaX, drawDrinksBVS.bgVodkaY, drawDrinksBVS.bgVodkaW, drawDrinksBVS.bgVodkaH) then if (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 150) else playSoundFrontEnd(6) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end elseif isMouseInPosition(drawDrinksBVS.bgCervejaX, drawDrinksBVS.bgCervejaY, drawDrinksBVS.bgCervejaW, drawDrinksBVS.bgCervejaH) then if (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 100) else playSoundFrontEnd(6) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end elseif isMouseInPosition(drawDrinksBVS.bgCloseX, drawDrinksBVS.bgCloseY, drawDrinksBVS.bgCloseW, drawDrinksBVS.bgCloseH) then if isEventHandlerAdded("onClientRender", root, drawDrinks) and isEventHandlerAdded("onClientClick", root, clickEffectDrink) then removeEventHandler("onClientRender", root, drawDrinks) removeEventHandler("onClientClick", root, clickEffectDrink) showCursor(false) end end end end c.lua ( Aqui eu refiz separando as funções das bebidas Catuaba, Vodca e Cerveja, adicionei algumas coisas a mais porque como eu disse, mudei o painel. ) function Catuaba(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143) then if (not isTimer(timerExpireDrinks)) then setBlur(false) triggerServerEvent("server:onPlayerBuyDrinkBVS", localPlayer, 200) removeEventHandler("onClientRender", root, drawDrinks) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) else playSound("sfx/hit.mp3", false) outputChatBox("#1066E7Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end end end end end addEventHandler("onClientClick", root, Catuaba) function Vodca(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143) then if (not isTimer(timerExpireDrinks)) then setBlur(false) triggerServerEvent("server:onPlayerBuyDrinkBVS", localPlayer, 150) removeEventHandler("onClientRender", root, drawDrinks) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) else playSound("sfx/hit.mp3", false) outputChatBox("#1066E7Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end end end end end addEventHandler("onClientClick", root, Vodca) function Cerveja(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143) then if (not isTimer(timerExpireDrinks)) then setBlur(false) triggerServerEvent("server:onPlayerBuyDrinkBVS", localPlayer, 100) removeEventHandler("onClientRender", root, drawDrinks) showChat(true) showCursor(false) playSound("sfx/hit.mp3", false) else playSound("sfx/hit.mp3", false) outputChatBox("#1066E7Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) end end end end end addEventHandler("onClientClick", root, Cerveja) Oque há de errado no script ? se puderem me informar o erro como sempre agradeço irmãos!
  3. Boa noite, eu estudei um pouco na wiki e fiz um script de bar, assim, o script do bar não fui eu que fiz, apenas coloquei um painel e alguns sistemas, talvez eu venda + talvez não porque fiz outro parecido só que de limpar ficha e ficou mais exclusivo.. assim vamos lá, primeiramente são 4 bares, com o interior 11, assim que entra ne qualquer um deles, tem o ped, em cima do ped coloquei um dxDrawText mandando o player pressionar a letra "M" para abrir o cursor que é a função com nome de "Nametag", e depois clicar no ped para abrir o painel menu para compra a bebida que ele deseja, mas após abrir clicar no ped e o painel menu ter aberto, a função "Nametag" ( A que manda o player pressionar a letra M e clicar no ped, ou seja o texto continua no ped mesmo com o painel-menu aberto ), e também não seta o walkingStyle.. voces poderiam me informar o erro e como resolve-lo ? c.lua --[[ ################################################ # # # RESOURCE DESENVOLVIDO por: # # < #Horus > # # # # # ################################################ ]] local ped = createPed(240, 497.283, -77.876, 998.765, 0) local ped2 = createPed(240, 497.283, -77.876, 998.765, 0) local ped3 = createPed(240, 497.283, -77.876, 998.765, 0) local ped4 = createPed(240, 497.283, -77.876, 998.765, 0) setElementInterior(ped, 11) setElementDimension(ped, 1) setElementFrozen(ped, true) setElementInterior(ped2, 11) setElementDimension(ped2, 2) setElementFrozen(ped2, true) setElementInterior(ped3, 11) setElementDimension(ped3, 3) setElementFrozen(ped3, true) setElementInterior(ped4, 11) setElementDimension(ped4, 4) setElementFrozen(ped4, true) local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 10) local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) function setBlur(state) setElementData(localPlayer, "showBlur", state) end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function dxDrawLinedRectangle( x, y, width, height, color, _width, postGUI ) _width = _width or 1 dxDrawLine ( x, y, x+width, y, color, _width, postGUI ) -- Top dxDrawLine ( x, y, x, y+height, color, _width, postGUI ) -- Left dxDrawLine ( x, y+height, x+width, y+height, color, _width, postGUI ) -- Bottom return dxDrawLine ( x+width, y, x+width, y+height, color, _width, postGUI ) -- Right end function cancelPedDamage(attacker) cancelEvent() end addEventHandler("onClientPedDamage", ped, cancelPedDamage) addEventHandler("onClientPedDamage", ped2, cancelPedDamage) addEventHandler("onClientPedDamage", ped3, cancelPedDamage) addEventHandler("onClientPedDamage", ped4, cancelPedDamage) function drawDrinks() tocolor1 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469) then -- CATUABA tocolor1 = tocolor(16, 102, 231, 100) end tocolor2 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469) then -- VODCA tocolor2 = tocolor(16, 102, 231, 100) end tocolor3 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469) then -- CERVEJA tocolor3 = tocolor(16, 102, 231, 100) end tocolorF = tocolor(217, 0, 5, 0) if isCursorOnElement(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417) then -- CLOSE tocolorF = tocolor(217, 0, 5, 150) end -- ################# BACKGROUND ################# dxDrawRectangle(screenW * 0.3140, screenH * 0.3490, screenW * 0.3507, screenH * 0.3997, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.3140, screenH * 0.3490, screenW * 0.3507, screenH * 0.0417, tocolor(0, 0, 0, 150), false) -- ################# BUTTONS ################# dxDrawRectangle(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469, tocolor1, false) -- CATUABA dxDrawRectangle(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469, tocolor2, false) -- VODCA dxDrawRectangle(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469, tocolor3, false) -- CERVEJA dxDrawRectangle(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417, tocolorF, false) -- CLOSE -- ################# IMAGENS ################# dxDrawImage(screenW * 0.3287, screenH * 0.4180, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.5573, screenW * 0.0191, screenH * 0.0339, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3257, screenH * 0.6458, screenW * 0.0265, screenH * 0.0430, "", 0, 0, 0, tocolor(254, 254, 254, 205), false) dxDrawImage(screenW * 0.3287, screenH * 0.4661, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.5143, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.6042, screenW * 0.0191, screenH * 0.0339, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) -- ################# TEXTOS ################# dxDrawText("Bar Passa Tempo - MENU", screenW * 0.4280, screenH * 0.3600, screenW * 0.4324, screenH * 0.3984, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("X", screenW * 0.6500, screenH * 0.3555, screenW * 0.7610, screenH * 0.3984, tocolor(255, 255, 255, 202), 1.30, "default-bold", "left", "top", false, false, false, true, false) dxDrawText("Catuaba", screenW * 0.3522, screenH * 0.4232, screenW * 0.4632, screenH * 0.4661, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Vodca", screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Cerveja", screenW * 0.3522, screenH * 0.5183, screenW * 0.4632, screenH * 0.5573, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF200", screenW * 0.6044, screenH * 0.4245, screenW * 0.7154, screenH * 0.4674, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF150", screenW * 0.6044, screenH * 0.4674, screenW * 0.7154, screenH * 0.5104, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF100", screenW * 0.6044, screenH * 0.5182, screenW * 0.7154, screenH * 0.5612, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Selecione uma bebida abaixo:", screenW * 0.4350, screenH * 0.3898, screenW * 0.4324, screenH * 0.7487, tocolor(255, 255, 255, 202), 0.8, dxfont0_fonte, "left", "top", false, false, false, true, false) end function render() local screenx, screeny, worldx, worldy, worldz = getCursorPosition() local px, py, pz = getCameraMatrix() local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, worldx, worldy, worldz ) local tx, ty, tz = getElementPosition(localPlayer) local rx, ry, rz = getElementPosition(ped) local distancia = getDistanceBetweenPoints3D(tx, ty, tz, rx, ry, rz) if not isEventHandlerAdded("onClientRender", root, drawDrink) then if (distancia < 5) then if hit then if elementHit == ped then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped2 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped3 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped4 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end end end end end addEventHandler("onClientClick", root, render) local rootElement = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() local maxrange = 9 function Nametag() local pedX, pedY, pedZ = getElementPosition(ped) local sx, sy = getScreenFromWorldPosition (pedX,pedY,pedZ +1) local cameraX, cameraY, cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then if not getElementData(localPlayer, "showBlur") then dxDrawRectangle(sx - x*110,sy + y*57, screenW * 0.2514, screenH * 0.0630, tocolor(0, 0, 0, 165), false) dxDrawText("Garçom - Bebidas e Diversão;",sx - 25 ,sy + 60,screenWidth, screenHeight,tocolor ( 255, 255, 255, 230 ), 0.9,dxfont0_fonte) dxDrawText('Pressione #FF0000"M" #FFFFFFe clique no garçom para abrir o menu!',sx - 100,sy + 80,screenWidth, screenHeight,tocolor ( 255, 255, 255, 230 ), 0.8,dxfont0_fonte, "left", "top", false, false, false, true, false) end end end end addEventHandler("onClientRender",rootElement, Nametag) function closePanel(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417) then showCursor(false) showChat(true) playSound("sfx/hit.mp3", false) removeEventHandler("onClientRender", root, drawDrinks) setElementData(localPlayer, "showBlur", false) end end end end addEventHandler("onClientClick", root, closePanel) function Catuaba(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 200) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Catuaba) function Vodca(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 150) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Vodca) function Cerveja(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 100) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Cerveja) function currentEffectDrinks() ---------------------------------------------------------- timerControlDrinks = setTimer(function() setPedControlState(localPlayer, "walk", true) end, 100, 0) setWindVelocity(100, 100, 0) setCameraShakeLevel(255) ---------------------------------------------------------- timerExpireDrinks = setTimer(function() ---------------------------------------------------------- resetWindVelocity() setCameraShakeLevel(1) if isTimer(timerControlDrinks) then killTimer(timerControlDrinks) end setPedControlState(localPlayer, "walk", false) outputChatBox("O efeito da bebida acabou.", 0, 255, 0) triggerServerEvent("resetWalkingStyle",resourceRoot) ---------------------------------------------------------- end, math.random(40000, 60000), 1) end addEvent("client:currentEffectDrinks", true) addEventHandler("client:currentEffectDrinks", resourceRoot, currentEffectDrinks) function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end s.lua local markersBarPositions = { {2348.547, -1372.678, 24.398, 501.900, -67.600, 999.700, 11, 1}, -- 1 {1000.592, -919.914, 42.328, 501.900, -67.600, 999.700, 11, 2}, -- 2 {2369.240, 1984.234, 10.820, 501.900, -67.600, 999.700, 11, 3}, -- 3 {-2432.25, -183.043, 35.312, 501.900, -67.600, 999.700, 11, 4}, -- 4 } local markersBarEnter = {} local markersBarExit = {} for i=1, #markersBarPositions do local xEnter, yEnter, zEnter, xExit, yExit, zExit, intEnter, dimEnter = unpack(markersBarPositions[i]) markersBarEnter[i] = createMarker(xEnter, yEnter, zEnter+1, "arrow", 1.5, 0, 16, 102, 231) local blip = createBlip(xEnter, yEnter, zEnter, 49) setBlipVisibleDistance(blip, 300) markersBarExit[i] = createMarker(xExit, yExit, zExit+0.1, "arrow", 1.5, 255, 0, 0, 255) setElementInterior(markersBarExit[i], intEnter, xExit, yExit, zExit-1) setElementDimension(markersBarExit[i], dimEnter) function enterBarBV:~(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and (matchingDimension) then local vehicle = getPedOccupiedVehicle(hitElement) local playerAccount = getPlayerAccount(hitElement) if (not vehicle) then if (playerAccount) then if (not isGuestAccount(playerAccount)) then setElementInterior(hitElement, intEnter, xExit, yExit-2, zExit) setElementDimension(hitElement, dimEnter) setElementPosition(hitElement, xExit, yExit-2, zExit) setElementRotation(hitElement, 0, 0, 180) end end end end end addEventHandler("onMarkerHit", markersBarEnter[i], enterBarBV:~) function exitBarBV:~(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and (matchingDimension) then setElementInterior(hitElement, 0, xEnter, yEnter-5, zEnter) setElementDimension(hitElement, 0) setElementPosition(hitElement, xEnter, yEnter-5, zEnter) end end addEventHandler("onMarkerHit", markersBarExit[i], exitBarBV:~) end function onPlayerBuyDrinkBVS(price) local money = getPlayerMoney(client) if (money >= price) then takePlayerMoney(client, price) local atualHealth = getElementHealth(client) setElementHealth(client, atualHealth + 20) playSound("sfx/hit.mp3", false) ----------------------------------------------------- setPedWalkingStyle(client, 126) triggerClientEvent(client, "client:currentEffectDrinks", resourceRoot) ----------------------------------------------------- outputChatBox("Drink comprado com sucesso.", client, 16, 102, 231) else playSound("sfx/hit.mp3", false) outputChatBox("Você não possui dinheiro suficiente.", client, 255, 0, 0) end end addEvent("server:onPlayerBuyDrinkBVS", true) addEventHandler("server:onPlayerBuyDrinkBVS", resourceRoot, onPlayerBuyDrinkBVS) function resetWalkingStyle() setPedWalkingStyle(client, 0) end addEvent("resetWalkingStyle", true) addEventHandler("resetWalkingStyle", resourceRoot, resetWalkingStyle)
  4. Queria que quando o player coilidisse com o ultimo marker do objetivo, setasse um frozen nele junto da setTimer do fim3, para que eles não buguem e dupliquem ou tripliquem o givePlayerMoney, se poderem me dar umas explicações como sempre ksks destinos = { [1] = {1905.856, -1117.615, 25.664}, -- table com todos os destinos em ordem. [2] = {1496.891, -691.943, 94.75}, [3] = {1684.788, -2101.417, 13.834} } local Minicio3 = createMarker (2104.386, -1806.494, 12.6, "cylinder", 1, 16, 102, 231, 50) -- Cria o marker onde o player deve usar o comando. local veh = {} -- Cada elemento específico de cada jogador deve estar em uma table para ser criado e acessado corretamente. local Mfim3 = {} -- Marker final específico do player. local Bfim3 = {} -- Blip do marker final específico do player. local sourceAccount = getPlayerAccount ( source ) function inicio3 (source) if source and getElementType (source) == "player" and not getPedOccupiedVehicle (source) then -- Quando o jogador colide no marker e está sem veículo, então: outputChatBox ("#1066E7──────────────── Trabalho BvP™ ────────────────",source,255,255,255,true) -- Avisa pra ele usar o comando /trampo4 para começar o emprego. outputChatBox ("#FF0000Trabalho de Entregador de Pizzas #FFFFFF→ Neste trabalho você terá que entregar as Pizzas até aos destinos no radar. Sua recompensa é de R$2000.",source,255,255,255,true) outputChatBox (" ",source,255,255,255,true) outputChatBox ("* Digite #FF0000/emprego3 #FFFFFFpara aceitar o trabalho.",source,255,255,255,true) outputChatBox ("#1066E7───────────────────────────────────────────",source,255,255,255,true) end end addEventHandler ("onMarkerHit", Minicio3, inicio3) function startJob3 (thePlayer, cmd) if isElementWithinMarker (thePlayer, Minicio3) and not getPedOccupiedVehicle (thePlayer) then -- Ao usar o comando, só funciona se o jogador estiver no marker e estiver sem veículo. if veh[thePlayer] and isElement (veh[thePlayer]) then -- Se por acaso existir o veículo do trampo do jogador, destroi ele. destroyElement (veh[thePlayer]) veh[thePlayer] = nil end veh[thePlayer] = createVehicle (468, 2095.678, -1796.701, 13.383) -- Cria o veículo do trampo. local x, y, z = unpack (destinos[1]) -- x, y, z recebem as coordenadas do destinos[1]. Mfim3[thePlayer] = createMarker (x, y, z, "cylinder", 2, 0, 255, 0, 255, thePlayer) -- Cria o marker do objetivo do jogador na coordenada 1. setElementData (Mfim3[thePlayer], "owner", thePlayer) -- Seta esse jogador como dono do marker, para que só funcione com ele. setElementData (Mfim3[thePlayer], "trip", 1) -- Seta uma data no marker pra saber a qual coordenada ele pertence. Bfim3[thePlayer] = createBlipAttachedTo (Mfim3[thePlayer], 19) -- Cria o blip e anexa ao marker. warpPedIntoVehicle (thePlayer, veh[thePlayer]) -- Teleporta o player para o veículo do trampo. setPedSkin ( thePlayer, 20 ) dxMsg(thePlayer, "Leve as Pizzas ate a bandeira no radar! (1/"..#destinos..")!", "info") -- Avisa o player o que ele tem que fazer agora. addEventHandler ("onMarkerHit", Mfim3[thePlayer], fim3) -- Adiciona o evento que faz funcionar o marker do objetivo. end end addCommandHandler ("emprego3", startJob3) function fim3 (hitElement) if (hitElement == getElementData (source, "owner")) then -- Se o elemento que colidiu for o dono do marker, então: if veh[hitElement] and isElement(veh[hitElement]) then -- Se existe o veículo do trampo do jogador, então: if (getElementData (source, "trip") < #destinos) then -- Se a data do marker é menor que a quantidade de destinos, então: (indicando que não é a última viagem) local x, y, z = unpack (destinos[getElementData (source, "trip") + 1]) -- x, y, z recebem a próxima coordenada da table destinos. setElementPosition (source, x, y, z) -- Coloca o marker de objetivo nessa nova coordenada. setElementData (source, "trip", getElementData (source, "trip") + 1) -- Seta a nova viagem nesse marker. dxMsg(hitElement, "Você entregou as Pizzas no destino. Siga para o próximo. ("..getElementData (source, "trip").."/"..#destinos..")", "info") -- Avisa o jogador quantas viagens ele fez e quantas são no total, pra ele não pensar que está trabalhando de graça. else -- Se o marker de objetivo colidido não tem data menor que a quantidade de viagens, então: (indicando que esse é o último objetivo) dxMsg(hitElement, "Recebendo Pagamento...", "info") setTimer(function(hitElement) removeEventHandler ("onMarkerHit", Mfim3[hitElement], fim3) -- Remove o evento que ativa este marker, pois ele não será mais usado. destroyElement (veh[hitElement]) -- Destroi o veículo do trampo do jogador. givePlayerMoney (hitElement, 2000) -- Dá o dinheiro do trampo. if isElement(Bfim3[hitElement]) then destroyElement (Bfim3[hitElement]) end -- Destroi o blip anexado ao marker de objetivo. Bfim3[hitElement] = nil if isElement(Mfim3[hitElement]) then destroyElement (Mfim3[hitElement]) end -- Destroi o marker de objetivo. Mfim3[hitElement] = nil dxMsg(hitElement, "Pagamento recebido (R$ 2000)!", "sucess") -- Avisa o jogador que ele completou o trampo. end, 5000, 1,hitElement) end end end end function sair3 (thePlayer) if (veh[thePlayer]) and isElement(veh[thePlayer]) then -- Se o veículo do trampo existe, então: removeEventHandler ("onMarkerHit", Mfim3[thePlayer], fim3) -- Remove o evento que ativa o marker de objetivo. destroyElement (veh[thePlayer]) -- Destroi o veículo do trampo. destroyElement (Bfim3[thePlayer]) -- Destroi o blip de objetivo do trampo. Bfim3[thePlayer] = nil destroyElement (Mfim3[thePlayer]) -- Destroi o marker de objetivo do trampo. Mfim3[thePlayer] = nil dxMsg(thePlayer, "Você abandonou a moto e perdeu o trabalho seu bastardo!", "error") -- Avisa o jogador que ele falhou no trampo. end end addEventHandler ("onVehicleExit", getRootElement(), sair3) -- Executa essa função quando o player sair de um veículo qualquer. function quit3 () if isElement(Bfim3[source]) then destroyElement (Bfim3[source]) end if isElement(Mfim3[source]) then destroyElement (Mfim3[source]) end if isElement(veh[source]) then destroyElement(veh[source]) end Bfim3[source] = nil Mfim3[source] = nil veh[source] = nil end addEventHandler("onPlayerQuit", getRootElement(), quit3) function kill3 () if isElement(Bfim3[source]) then destroyElement (Bfim3[source]) end if isElement(Mfim3[source]) then destroyElement (Mfim3[source]) dxMsg(source, "Você se matou e perdeu o trabalho seu imbecil!", "error") end if isElement(veh[source]) then destroyElement(veh[source]) end Bfim3[source] = nil Mfim3[source] = nil veh[source] = nil end addEventHandler("onPlayerWasted", getRootElement(), kill3) function logout3 () if isElement(Bfim3[source]) then destroyElement (Bfim3[source]) end if isElement(Mfim3[source]) then destroyElement (Mfim3[source]) end if isElement(veh[source]) then destroyElement(veh[source]) end Bfim3[source] = nil Mfim3[source] = nil veh[source] = nil end addEventHandler("onPlayerLogout", getRootElement(), logout) function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end
  5. Client.lua: function processLockUnlock(vehicle) if vehicle then local vehicleID = tonumber(getElementData(vehicle, "veh:id")) or -1 local vehFaction = tonumber(getElementData(vehicle, "veh:faction")) or 0 local vehOwner = tonumber(getElementData(vehicle, "veh:owner")) or -1 local vehJobID = tonumber(getElementData(vehicle, "veh:jobvehID")) or -1 local locked = isVehicleLocked(vehicle) local vehID = getElementModel(vehicle) local vehName = getVehicleRealName(vehID) if isPedInVehicle(localPlayer) then playSounds("lockin") else playSounds("lockout") end if locked then triggerServerEvent("vehicleLock", localPlayer,localPlayer, vehicle, false) else triggerServerEvent("vehicleLock", localPlayer,localPlayer, vehicle, true) end else outputChatBox("#FFFFFF Nincs kulcsod ehhez a járműhöz.", 169,139,101, true) end end local klikkTimer = false function setVehicleLockState() if klikkTimer then return end if isTimer(klikkTimerRun) then return end klikkTimer = true klikkTimerRun = setTimer(function() klikkTimer = false end,1000,1) local vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle then processLockUnlock(vehicle) else local int2 = getElementInterior(localPlayer) local dim2 = getElementDimension(localPlayer) local mx,my,mz = getElementPosition(localPlayer) local interior = getElementData(localPlayer, "interior") or false if not interior then for k,v in ipairs(getElementsByType("vehicle")) do local x,y,z = getElementPosition(v) local int = getElementInterior(v) local dim = getElementDimension(v) local dist = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) if dist <= 3 and int2 == int and dim2 == dim then processLockUnlock(v) return end end end end end bindKey("k", "down", setVehicleLockState) setTimer(function() if not bindKey("k", "down", setVehicleLockState) then bindKey("k", "down", setVehicleLockState) end end, 1000, 0) Server.lua: addEvent("vehicleLock",true) addEventHandler("vehicleLock",getRootElement(),function(player,veh,value) setVehicleLocked(veh, value) veh:setData("veh:status", value) end) No errors / warnings in debugscript... if i press the [K] button, nothing happens... what wrong in this code? how to fix?
  6. Hello MTA, sorry if my English is bad I'm looking for a way to load a website in the game, for example a website that I have forums.javaliferoleplay.web.id I have a code like this function register_panel( ) local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 1280, 720 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 local window = guiCreateWindow( left, top, windowWidth, windowHeight , "Register", false ) local browser = guiCreateBrowser( 0, 28, windowWidth, windowHeight -60, false, false, false, window ) local theBrowser = guiGetBrowser( browser ) guiWindowSetSizable(window, false) requestBrowserDomains({ "forums.javaliferoleplay.web.id" }) addEventHandler( "onClientBrowserCreated", theBrowser, function( ) loadBrowserURL( source, "http://forums.javaliferoleplay.web.id/" ) end ) local close = guiCreateButton(0, 700, 1280, 50, "CLOSE", false, window) addEventHandler ( "onClientGUIClick", close, function() guiSetVisible(window, false) end ) end In the code above, the website I intended to load does not appear, but there is a dialog box asking for permission to open the link. But when opening youtube for example, the website opens normally. Can someone help me? Thanks before
  7. Hello to everyone. My name is Jahseh, i need a developer for my MTA french roleplay server. I can speak french and english. The goal is to make me some "job script" or anything else do make it more original than others servers or repair some script than doesn't work well. You will send the script to me or showing me your experiences on scripting and you will get paid. It depends on what you gonna do on my server, we will talk about money together. If you are interested email me : [email protected] Or just come on my teamspeak : horizonroleplay.ts3serv.com I don't have many experiences on scripting, i can just modify a little bit but i already got a gamemode translated in french and fully playable ! Thanks a lot ! See you soon ?
  8. here's a video about the bug..: How to fix this bug? I tried many things, but unsuccessfully.. :s Here the code: Client.lua: local sX, sY = guiGetScreenSize() setElementData(localPlayer,"name",nil) GUIEditor = { button = {}, edit = {} } GUIEditor.button[1] = guiCreateButton(0.72, 0.74, 0.03, 0.04, ">", true) kuldottpmek = {} fogadottpmek = {} GUIEditor.edit[1] = guiCreateEdit(0.38, 0.74, 0.34, 0.04, ".", true) guiEditSetMaxLength(GUIEditor.edit[1], 150) local dxfont0_gothic = dxCreateFont(":mta_wintertime/gothic.ttf", 14) local screenW, screenH = guiGetScreenSize() local players = getElementsByType ( "player" ) addEventHandler("onClientRender", root, function() local players = getElementsByType ( "player" ) local elem = 0 local fpm = 0 local kpm = 0 local uzenet = guiGetText(GUIEditor.edit[1]) dxDrawRectangle(screenW * 0.3722, screenH * 0.2722, screenW * 0.3833, screenH * 0.5100, tocolor(0, 0, 0, 162), false) dxDrawRectangle(screenW * 0.1757, screenH * 0.2722, screenW * 0.1896, screenH * 0.5100, tocolor(0, 0, 0, 162), false) dxDrawText("Játékoslista", screenW * 0.1764, screenH * 0.2722, screenW * 0.3653, screenH * 0.3167, tocolor(255, 255, 255, 255), 1.00, dxfont0_gothic, "center", "center", false, false, false, false, false) for id,player in ipairs(players) do local plname = getPlayerName(player) elem = elem + 1 dxDrawText(plname, screenW * 0.1764, screenH * 0.2500+(elem*70), screenW * 0.3653, screenH * 0.3578, tocolor(255, 255, 255, 255), 0.65, dxfont0_gothic, "left", "center", false, false, true, true, false) dxDrawRectangle(screenW * 0.1764, screenH * 0.2850+(elem*35), screenW * 0.1889, screenH * 0.0367, tocolor(0, 0, 0, 162), false) end dxDrawText(getElementData(localPlayer,"name") or "Válassz játékost", screenW * 0.3722, screenH * 0.2722, screenW * 0.7556, screenH * 0.3167, tocolor(255, 255, 255, 255), 1.00, dxfont0_gothic, "center", "center", false, false, false, true, false) dxDrawText(getElementData(localPlayer,"name") and "Elérhető most" or "", screenW * 0.5278, screenH * 0.3056, screenW * 0.6014, screenH * 0.3411, tocolor(255, 255, 255, 255), 0.65, dxfont0_gothic, "center", "center", false, false, false, true, false) dxDrawRectangle(screenW * 0.3722, screenH * 0.3467, screenW * 0.3833, screenH * 0.3844, tocolor(0, 0, 0, 162), false) for k,v in ipairs(kuldottpmek) do kpm = kpm + 1 dxDrawRectangle(screenW * 0.3722, screenH * 0.2775+(kpm*62), screenW * 0.3833, screenH * 0.0633, tocolor(94, 192, 254, 162), false) dxDrawText("Te:", screenW * 0.3729, screenH * 0.1430+(kpm*124), screenW * 0.7556, screenH * 0.4367, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, false, true, false) dxDrawText(v, screenW * 0.3729, screenH * 0.3050+(kpm*62), screenW * 0.7556, screenH * 0.4733, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, true, true, false, false) for k,v in ipairs(fogadottpmek) do kpm = kpm + 1 dxDrawRectangle(screenW * 0.3722, screenH * 0.2775+(kpm*62), screenW * 0.3833, screenH * 0.0633, tocolor(255, 255, 254, 162), false) dxDrawText(getElementData(localPlayer,"name")..":", screenW * 0.3729, screenH * 0.1430+(kpm*124), screenW * 0.7556, screenH * 0.4367, tocolor(110, 110,111, 200), 1.00, "default-bold", "left", "center", false, false, false, true, false) dxDrawText(v, screenW * 0.3729, screenH * 0.3050+(kpm*62), screenW * 0.7556, screenH * 0.4733, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, true, true, false, false) end end end ) function onClientClick(button, state) local elem = 0 if button == "left" and state == "down" then for k, v in ipairs(players) do local plname = getPlayerName(v) elem = elem+1 if isInBox(screenW * 0.1764, screenH * 0.2850+(elem*35), screenW * 0.1889, screenH * 0.0367) then if plname == getPlayerName(localPlayer) then return end setElementData(localPlayer,"name",plname) kuldottpmek = {} fogadottpmek = {} end end end end addEventHandler("onClientClick", root, onClientClick) function isInBox(xS,yS,wS,hS) if(isCursorShowing()) then local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*sX, cursorY*sY if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then return true else return false end end end function trig1() if getElementData(localPlayer,"name") == nil then return end local nev =getElementData(localPlayer,"name") or "" local targetPlayer = getPlayerFromName ( nev ) if targetPlayer then local uzenet = guiGetText(GUIEditor.edit[1]) table.insert(kuldottpmek,uzenet) end end addEvent("uzenet",true) addEventHandler("uzenet",root,trig1) function trig2() if getElementData(localPlayer,"name") == nil then return end local nev =getElementData(localPlayer,"name") or "" local targetPlayer = getPlayerFromName ( nev ) if targetPlayer then local uzenet = guiGetText(GUIEditor.edit[1]) table.insert(fogadottpmek,uzenet) end end addEvent("uzenet2",true) addEventHandler("uzenet2",root,trig2) function test() if getElementData(localPlayer,"name") == nil then return end local uzenet = guiGetText(GUIEditor.edit[1]) triggerServerEvent("pmuzenet",localPlayer,getLocalPlayer(),uzenet) end addEventHandler("onClientGUIClick",GUIEditor.button[1],test,false) Server.lua: function privateMessage(thePlayer) local sendToName = getElementData(thePlayer,"name") local toPlayer = getPlayerFromParticalName (sendToName) triggerClientEvent(thePlayer,"uzenet",toPlayer) triggerClientEvent(toPlayer,"uzenet2",thePlayer) setElementData(toPlayer,"fogadott",true) setElementData(thePlayer,"fogadott",false) end addEvent("pmuzenet",true) addEventHandler("pmuzenet",root,privateMessage) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end
  9. I want create a dx private message system, like the fb messenger.. But how to make it possible? Or where can i download a script like this? sorry for my bad english..
  10. function asdasdsas() playSound("http://www.convertmp3.io/fetch/?video=https://www.youtube.com/watch?v=iq7q82Cd6RI") end addCommandHandler("test",asdasdsas) what wrong? the API working fine, but the playSound not.. how to fix?
  11. Hello guys! I started with shaders today, I made a script to apply a texture to the weapons fire, but it is not working, nor does it give any error in the debug. Client-side shader = dxCreateShader("shader/shader.fx") fire_fx = dxCreateTexture("files/fire.png") function replaceFireFX() engineApplyShaderToWorldTexture(shader, "muzzle_texture4") dxSetShaderValue(shader, "gTexture", fire_fx) end addEventHandler("onClientResourceStart", resourceRoot, replaceFireFX) addEventHandler("onClientPlayerJoin", root, replaceFireFX) FX-Code texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } } fire.png
  12. Hello ! I have a probblem. Everytime when I creating a ped in the server using 'createPed' function, the ped that creating can't be killed [ immortal ]. I don't like that way. The ped should be able to killed. Did you know to fix this ? createPed(0, 0, 0, 5)
  13. local redcircle = dxCreateTexture("teszt.png") addEventHandler("onClientRender", root, function() dxDrawMaterialLine3D(-1989.73804, 214.91431, 50,-1989.73804, 214.91431,43.1096496582031, redcircle, 6, tocolor(255,255,255),0,5,6) end) I change numbers, but i cannot rotate the image... how to rotate the image? sorry for my bad english..
  14. Quando o player chegar no marker, ao invez de pegar o trabalho de uma vez, ele ter q digitar o comando do addCommandHandler Obs: A Mensagem de quando ele passa em cima do marker mandando o player digitar o tal comando eu ja sei fazer.. mas tentei de varias formas adicionar o addCommandHandler e fracassei! Eu tambem queria saber, como faço pro marker do "Mfim4" sumir após o player completar o trabalho! O Marker do Mfim4 fica no lugar, mesmo sem a pessoa estar no trabalho e ele nao sai server.lua local Minicio4 = createMarker (1038.02332, -1337.93970, 12.8, "cylinder", 1, 16, 102, 231, 100) local Mfim4 = createMarker ( 2801.29663, -1088.36243, 30.72142 -1, "cylinder", 2, 0 ,255 ,0, 255 ) local Bfim4 = createBlipAttachedTo ( Mfim4, 19 ) setElementVisibleTo ( Bfim4, root, false ) veh = {} function incio4 (source) if isElementWithinMarker(source, Minicio4) then if veh[source] and isElement( veh[source] ) then destroyElement ( veh[source] ) veh[source] = nil end x,y,z = getElementPosition(source) Trabalho = true veh[source] = createVehicle(498,1009.50598, -1355.16431, 13.34428) setElementVisibleTo ( Bfim4, source, true ) warpPedIntoVehicle ( source, veh[source] ) dxMsg(source, "Leve as rosquinhas ate a bandeira no radar!", "info") end end addEventHandler( "onMarkerHit", Minicio4, incio4 ) function fim4 (source) if veh[source] and isElement(veh[source]) then destroyElement (veh[source]) givePlayerMoney(source,2500) -------------- Caso queira mudar o dinheiro que o player vai ganhar ao finalizar o trabalho setElementVisibleTo ( Bfim4, source, false ) setElementVisibleTo ( entregafinalizar, source, false ) dxMsg(source, "Você entregou as rosquinhas a fabrica e ganhou R$2500!", "sucess") else end end addEventHandler("onMarkerHit",Mfim4 ,fim4) function sair4 (source) if (veh[source]) and isElement(veh[source]) then setElementVisibleTo ( Bfim4, source, false ) destroyElement (veh[source]) dxMsg(source, "Você saiu do veiculo e perdeu o trabalho!", "error") else end end addEventHandler ( "onVehicleExit", getRootElement(), sair4 ) function dxMsg(source, text, type) exports.dxmessages:outputDx(source, text, type) end O Client eu fiz um script text que fica esrito em cima do marker o nome do trabalho mas isso nao tem nada haver ent n colocarei!
  15. local Minicio4 = createMarker (1038.02332, -1337.93970, 13.72656 -1, "cylinder", 1, 16 ,102 ,231, 100) Quando coloco -1 após as coordenadas, junto com o marker de tamanho 1 após o "cylinder" o script nao funciona!!! Todos os markers de trab do meu servidor são do tamanho "1" queria deixar esse tmb oque é glr ? Obs: eu sublinei e grifei o -1 e o tamanho do marker q é "1" após o "cylinder" para facilitar
  16. if i create a table, and i insert datas with table.insert, the datas are deleted when i reconnect.. why? how to save datas? sorry for my terrible english :ss
  17. Eu novamente aqui skkssk, Então meus irmãos, é um script que baixei do site original do mta, muitos devem conhece-l, é o script de danças do fortnite! Mais assim, parece que ele nao esta configurado e eu meio que nao entendo sobre arquivos ifp de dança, o author desse script, colocou um exemplo nele, que quando troca de nick exibe a animação e realmente apaguei os -- e funcionou, eu ate entendi, o script vem com 13 danças, porem nao estou conseguindo configurar! server.lua function setPedFortniteAnimation (ped,animation,tiempo,repetir,mover,interrumpible) if (type(animation) ~= "string" or type(tiempo) ~= "number" or type(repetir) ~= "boolean" or type(mover) ~= "boolean" or type(interrumpible) ~= "boolean") then return false end if isElement(ped) then if animation == "baile 1" or animation == "baile 2" or animation == "baile 3" or animation == "baile 4" or animation == "baile 5" or animation == "baile 6" or animation == "baile 7" or animation == "baile 8" or animation == "baile 9" or animation == "baile 10" or animation == "baile 11" or animation == "baile 12" or animation == "baile 13" then for i = 1,3 do triggerClientEvent ( root, "setPedFortniteAnimation", root, ped,animation,tiempo,repetir,mover,interrumpible ) if tiempo > 1 then setTimer(setPedAnimation,tiempo,1,ped,false) setTimer(setPedAnimation,tiempo+100,1,ped,false) end end end end end --[[ EJEMPLO/EXAMPLE CUANDO CAMBIA EL NICK WHEN NICK IS CHANGED function wasNickChangedByUser(oldNick, newNick, changedByUser) setPedFortniteAnimation(source,"baile 8",7000,true,false,false,false) end addEventHandler("onPlayerChangeNick", getRootElement(), wasNickChangedByUser) -- add an event handler --]] function howtouse ( player, command, dance ) if isElement(player) then exports.fortnitedances:setPedFortniteAnimation(player,"baile "..dance.."",-1,true,false,false,false) end end addCommandHandler ( "dance", howtouse ) client.lua local customIfp = nil function setPedFortniteAnimation (ped,animation,tiempo,repetir,mover,interrumpible) if (type(animation) ~= "string" or type(tiempo) ~= "number" or type(repetir) ~= "boolean" or type(mover) ~= "boolean" or type(interrumpible) ~= "boolean") then return false end if isElement(ped) then if animation == "baile 1" or animation == "baile 2" or animation == "baile 3" or animation == "baile 4" or animation == "baile 5" or animation == "baile 6" or animation == "baile 7" or animation == "baile 8" or animation == "baile 9" or animation == "baile 10" or animation == "baile 11" or animation == "baile 12" or animation == "baile 13" then for i = 1,3 do setPedAnimation(ped, "Fortnite_"..i.."", animation, tiempo, true, false, false) if tiempo > 1 then setTimer(setPedAnimation,tiempo,1,ped,false) setTimer(setPedAnimation,tiempo+100,1,ped,false) end end end end end addEvent("setPedFortniteAnimation",true) addEventHandler("setPedFortniteAnimation",getRootElement(),setPedFortniteAnimation) addEventHandler("onClientResourceStart", resourceRoot, function ( startedRes ) customIfp = engineLoadIFP ("Fortnite pt1.ifp", "Fortnite_1") customIfp2 = engineLoadIFP ("Fortnite pt2.ifp", "Fortnite_2") customIfp3 = engineLoadIFP ("Fortnite pt3.ifp", "Fortnite_3") if customIfp and customIfp2 and customIfp3 then outputDebugString ("Animaciones de Fortnite cargadas") else outputDebugString ("Las animaciones de Fortnite no fueron cargadas") end end ) Vou colocar o meta.xml tambem pra voces verem o export caso possa ser isso tambem meta.xml <meta> <info author="Drex" version="1.1" name="Bailes de Fortnite" type="script" /> <export function="setPedFortniteAnimation" type="shared" /> <file src="Fortnite pt1.ifp" /> <file src="Fortnite pt2.ifp" /> <file src="Fortnite pt3.ifp" /> <script src="client.lua" type="client" cache="false" /> <script src="server.lua" type="sever" cache="false" /> </meta>
  18. function onClientClick(button, state) if button == "left" and state == "down" then for k, v in ipairs(fegyverek) do if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then fegyver = k end end if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then if fegyver == 3 then outputChatBox("asd") end end end end addEventHandler("onClientClick", root, onClientClick) function isInBox(xS,yS,wS,hS) if(isCursorShowing()) then local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*sX, cursorY*sY if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then return true else return false end end end What wrong in this? No error/warning in debugscript..
  19. Como faço pra quando alguem manda mensagem pro player, ele digita /r ( nome do player ) ( mensagem ) para responder automaticamente e ai por diante function privateMessage(thePlayer,commandName,sendToName,...) local pvWords = { ... } local pvMessage = table.concat( pvWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) if not (toPlayer == thePlayer) then if not (pvMessage == "") then outputChatBox("#00ff00[PV]#FFFFFF Enviada para #FFFFFF" .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pvMessage, thePlayer, 255, 255, 255, true) outputChatBox("#00ff00[PV]#FFFFFF Recebida de #FFFFFF" .. getPlayerName(thePlayer) .. "#FFFFFF: " .. pvMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#00ff00[PV]#FFFFFF Sintaxe inválida! Use:#FFFFFF /pv [Nome do Jogador] [Mansagem]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#00ff00[PV]#FFFFFF Você não pode mandar pv para si mesmo#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#00ff00[PV]#FFFFFF Jogador não encontrado! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#00ff00[PV]#FFFFFF Sintaxe inválida! Use:#FFFFFF /pv [Nome do Jogador] [Mensagem]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pv", privateMessage) function infopv() outputChatBox ('',getRootElement(),255,255,255,true) end setTimer(infopv, 350000, 350) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end
  20. I wanna get remaining time from the video, but does not working.. Why? function callback(data, error) if (error ~= 0) then return outputChatBox(error) end if (data == "ERROR") then return outputChatBox("data error") end local data = fromJSON("["..data.."]") if (data) then local minutes, seconds = convertTime(tonumber(data.length)) if seconds < 10 then seconds = "0"..seconds end outputChatBox("Title: "..data.title) outputChatBox("Length: "..minutes..":"..seconds ) outputChatBox("Remaining: "..data.remaining) loadBrowserURL( browser, data.link ) end end
  21. I want get online player count from my secondary server, and show with a label.. But how is it possible?
  22. teria como passar um valor de uma variavel do client para o servidor? e o servidor respassar outro valor para o client? exemplo: -- Client Online = 0 function dxText() dxDrawText(Online .. " Online", 612, 312, 728, 344, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, true, false, false, false) end function botaoAtivacao() Entrar = guiCreateButton(618, 367, 115, 47, "Entrar", false) addEventHandler("onClientGUIClick", Entrar, Ativacao, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), botaoAtivacao) function Ativacao() triggerServerEvent("Entrada", getLocalPlayer()) end no Script da parte do client e criado uma variavel global chamada Online, nela e enserido um valor q é concatenado com o dxDrawText apos isto crio um botao fazendo a chamada no servidor. --Server function tab(teamName) RPG = createTeam("RPG", 0, 0, 0, 255) end addEventHandler("onResourceStart", resourceRoot, tab) function click() if RPG then setPlayerTeam(source, RPG) Online = Online +1 end end addEvent("Entrada", true) addEventHandler("Entrada", getRootElement(), click) na parte do servidor eu crio uma team chamada RPG, quando o player clicka no botao ele e inserido na team e apos isto a variavel Online e dado um novo valor só q esse valor nao é repassado para o client. Como posso repassala para o Client?
  23. Tenho um sistema de concessionária porém, qualquer player não logado (guest) consegue comprar carros, e isso ta bugando, como faço pra apenas jogadores logados terem acesso a concessionária ? Client: function centerWindow ( center_window ) local sx, sy = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( sx - windowW ) / 2, ( sy - windowH ) / 2 guiSetPosition ( center_window, x, y, false ) end local customCarNames = -- Ids dos veiculos pra add mais copie e cole um abaixo do outro e mude o nome { [541] = 'Bugatti Veyron'; [494] = 'Jaguar F-Type'; [506] = 'Pagani Zonda F'; [550] = 'Porsche Panamera'; } setTimer ( function () local theCol = getElementData(root, "BlockExportCol") function isInColExport () if isElement(theCol) and isElementWithinColShape(localPlayer,theCol) then return true else return false end end function ClientExplosionCFunction() if isInColExport () then cancelEvent () end end addEventHandler("onClientExplosion", root, ClientExplosionCFunction) end , 1000, 1 ) local screX, screY = guiGetScreenSize() Window_VS = guiCreateWindow(373, 219, 557, 303,"Painel de Veiculos Comprados",false) guiSetAlpha(Window_VS, 0.88) guiWindowSetSizable(Window_VS, false) guiSetVisible(Window_VS, false) centerWindow(Window_VS) Grid_VS = guiCreateGridList(10, 28, 361, 235, false, Window_VS) guiGridListSetSelectionMode(Grid_VS, 1) guiGridListAddColumn(Grid_VS, "Nome", 0.4) guiGridListAddColumn(Grid_VS, "Preço", 0.3) guiGridListAddColumn(Grid_VS, "HP Auto", 0.2) Button_VS_sn_s = guiCreateStaticImage(381, 28, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_sn_o = guiCreateStaticImage(381, 28, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_sn = guiCreateLabel(381, 28, 166, 25, "Spawnar", false, Window_VS) guiSetFont(Button_VS_sn, "default-bold-small") guiLabelSetColor(Button_VS_sn, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_sn, "center") guiLabelSetHorizontalAlign(Button_VS_sn, "center") Button_VS_dy_s = guiCreateStaticImage(381, 63, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_dy_o = guiCreateStaticImage(381, 63, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_dy = guiCreateLabel(381, 63, 166, 25, "Remover", false, Window_VS) guiSetFont(Button_VS_dy, "default-bold-small") guiLabelSetColor(Button_VS_dy, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_dy, "center") guiLabelSetHorizontalAlign(Button_VS_dy, "center") Button_VS_Warp_s = guiCreateStaticImage(381, 98, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_Warp_o = guiCreateStaticImage(381, 98, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_Warp = guiCreateLabel(381, 98, 166, 25, "Teleport", false, Window_VS) guiSetFont(Button_VS_Warp, "default-bold-small") guiLabelSetColor(Button_VS_Warp, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_Warp, "center") guiLabelSetHorizontalAlign(Button_VS_Warp, "center") Button_VS_Warp_info = guiCreateLabel(428, 500, 103, 26, "Teleport: 500$", false) guiSetFont(Button_VS_Warp_info, "default-bold-small") guiLabelSetColor(Button_VS_Warp_info, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_Warp_info, "center") guiLabelSetHorizontalAlign(Button_VS_Warp_info, "center") --Button_VS_Warp_info Button_VS_Fix_s = guiCreateStaticImage(381, 133, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_Fix_o = guiCreateStaticImage(381, 133, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_Fix = guiCreateLabel(381, 133, 166, 25, "Fixar", false, Window_VS) guiSetFont(Button_VS_Fix, "default-bold-small") guiLabelSetColor(Button_VS_Fix, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_Fix, "center") guiLabelSetHorizontalAlign(Button_VS_Fix, "center") Button_VS_Fix_info = guiCreateLabel(428, 500, 103, 26, "Conserto: 500$", false) guiSetFont(Button_VS_Fix_info, "default-bold-small") guiLabelSetColor(Button_VS_Fix_info, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_Fix_info, "center") guiLabelSetHorizontalAlign(Button_VS_Fix_info, "center") Button_VS_lk_s = guiCreateStaticImage(381, 168, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_lk_o = guiCreateStaticImage(381, 168, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_lk = guiCreateLabel(381, 168, 166, 25, "Aberto - Fechado", false, Window_VS) guiSetFont(Button_VS_lk, "default-bold-small") guiLabelSetColor(Button_VS_lk, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_lk, "center") guiLabelSetHorizontalAlign(Button_VS_lk, "center") Button_VS_sl_s = guiCreateStaticImage(381, 203, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_sl_o = guiCreateStaticImage(381, 203, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_sl = guiCreateLabel(381, 203, 166, 25, "Vender Veiculo", false, Window_VS) guiSetFont(Button_VS_sl, "default-bold-small") guiLabelSetColor(Button_VS_sl, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_sl, "center") guiLabelSetHorizontalAlign(Button_VS_sl, "center") Button_VS_give_s = guiCreateStaticImage(381, 238, 166, 25, "images/button_standard.png", false, Window_VS) Button_VS_give_o = guiCreateStaticImage(381, 238, 166, 25, "images/button_mouse.png", false, Window_VS) Button_VS_give = guiCreateLabel(381, 238, 166, 25, "Vender Para o Jogador", false, Window_VS) guiSetFont(Button_VS_give, "default-bold-small") guiLabelSetColor(Button_VS_give, 255, 255, 255) guiLabelSetVerticalAlign(Button_VS_give, "center") guiLabelSetHorizontalAlign(Button_VS_give, "center") adLabel = guiCreateLabel(130, 269, 296, 24, "Loja De carros", false, Window_VS) -------------- Nome do seu servidor guiSetFont(adLabel, "default-bold-small") guiLabelSetHorizontalAlign(adLabel, "center", false) guiLabelSetVerticalAlign(adLabel, "center") guiSetVisible(Button_VS_sn_o,false)-- guiSetVisible(Button_VS_dy_o,false)-- guiSetVisible(Button_VS_Warp_o,false) guiSetVisible(Button_VS_Warp_info,false) guiSetVisible(Button_VS_Fix_o,false) guiSetVisible(Button_VS_Fix_info,false) guiSetVisible(Button_VS_lk_o,false) guiSetVisible(Button_VS_sl_o,false) guiSetVisible(Button_VS_give_o,false) --Button_VS_Warp_info --Button_VS_Fix_info Window_CHK = guiCreateWindow(screX/2-155,screY/2-60,310,120,"Vender Veiculo!",false) guiSetVisible(Window_CHK, false) guiSetProperty(Window_CHK, "AlwaysOnTop", "true") guiWindowSetSizable(Window_CHK, false) Label_CHK = guiCreateLabel(21,28,266,36,"",false,Window_CHK) guiLabelSetColor(Label_CHK, 38, 122, 216) guiLabelSetHorizontalAlign(Label_CHK,"center",true) Button_CHK_Y = guiCreateButton(17,73,129,36,"Deseja Vender?",false,Window_CHK) Button_CHK_N = guiCreateButton(161,73,129,36,"Cancelar",false,Window_CHK) function updateGridList() local data = getElementData(localPlayer, "VehicleInfo") if data then local rw, cl = guiGridListGetSelectedItem(Grid_VS) guiGridListClear(Grid_VS) for i, data in ipairs (data) do local carName = customCarNames[ data['Model'] ] or getVehicleNameFromModel(data["Model"]) local ID = data["ID"] local Cost = data["Cost"] local HP = math.floor(data["HP"]) local PreCost = math.ceil(Cost*.9*HP/100/10) local row = guiGridListAddRow(Grid_VS) guiGridListSetItemText(Grid_VS, row, 1, carName, false, true) guiGridListSetItemData(Grid_VS, row, 1, ID) guiGridListSetItemText(Grid_VS, row, 2, PreCost, false, true) guiGridListSetItemText(Grid_VS, row, 3, HP.." HP", false, true) end guiGridListSetSelectedItem(Grid_VS, rw, cl) end end bindKey("F7", "down", function() if getElementInterior(localPlayer) == 0 and getElementDimension(localPlayer) == 0 then if getElementData(localPlayer, "MissionWarProtection") and getElementData(localPlayer, "MissionProtection")then return end guiSetVisible(Window_VS, not guiGetVisible(Window_VS)) guiSetVisible (Window_CHK, false) showCursor(guiGetVisible(Window_VS)) end end) triggerServerEvent("onOpenGui", localPlayer) addEventHandler("onClientElementDataChange", root, function(dd) if getElementType(source) == "player" and source == localPlayer and dd == "VehicleInfo" then local data = getElementData(source, dd) if data then updateGridList() end end end) function WINDOW_CLICK_VEHICLE (button, state, absoluteX, absoluteY) local id = guiGridListGetSelectedItem(Grid_VS) local ID = guiGridListGetItemData(Grid_VS, id, 1) if source == Button_VS_close then guiSetVisible(Window_VS, false) showCursor(false) end if (source == Grid_VS) then if id == -1 and idd then guiGridListSetSelectedItem(Grid_VS, idd, 1) return false else idd = guiGridListGetSelectedItem(Grid_VS) end elseif id == -1 then elseif (source == Button_VS_sn) then if not isInColExport () then triggerServerEvent("SpawnMyVehicle", localPlayer, ID) end elseif (source == Button_VS_dy) then triggerServerEvent("DestroyMyVehicle", localPlayer, ID) elseif (source == Button_VS_lt) then triggerServerEvent("LightsMyVehicle", localPlayer, ID) elseif (source == Button_VS_bp) then triggerServerEvent("BlipMyVehicle", localPlayer, ID) elseif (source == Button_VS_lk) then triggerServerEvent("LockMyVehicle", localPlayer, ID) elseif (source == Button_VS_sl) then guiSetVisible(Window_CHK, true) local carName = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 1) local carprice = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 2) guiSetText(Label_CHK, 'Você deseja realmente vender seu "'..carName..'" por $'..carprice) elseif source == Button_VS_give then createPlayersList(id) elseif source == Button_CHK_Y then triggerServerEvent("SellMyVehicle", localPlayer, ID) guiSetVisible(Window_VS, false) guiSetVisible(Window_CHK, false) showCursor(false) elseif source == Button_CHK_N then guiSetVisible (Window_CHK, false) elseif source == Button_VS_Spc then if getElementInterior(localPlayer) == 0 then if getElementData(localPlayer,"Stats") < 2 then SpecVehicle(ID) end end elseif source == Button_VS_Fix then triggerServerEvent("FixMyVehicle", localPlayer, ID) elseif source == Button_VS_Warp then if not isInColExport () then triggerServerEvent("WarpMyVehicle", localPlayer, ID) end elseif source == Button_PLS_Y then local row = guiGridListGetSelectedItem ( playerList_PLS ) if row and row ~= -1 then -- if guiGridListGetItemText ( playerList_PLS, row, 1 ) == getPlayerName ( localPlayer ) then -- return true -- end if (tonumber(guiGetText (edit_PLS_price)) or 0) >= 0 then outputMessage ( "#c1c1c1Esperar uma resposta do jogador.", 10, 250, 10,true ) invitations_send = true triggerServerEvent ( 'inviteToBuyCarSended', localPlayer, guiGridListGetItemText ( playerList_PLS, row, 1 ), guiGetText (edit_PLS_price) or 0, guiGridListGetItemText(Grid_VS, id, 1), guiGridListGetItemData(Grid_VS, id, 1) ) destroyElement ( Window_PLS ) end end elseif source == Button_PLS_N then destroyElement ( Window_PLS) end end addEventHandler("onClientGUIClick", resourceRoot, WINDOW_CLICK_VEHICLE) function invitationsClickVehicle () if source == Button_ABC_Y then showCursor ( false ) destroyElement ( Window_ABC ) if getPlayerMoney () >= ( tonumber(inv_price) or 0 ) then triggerServerEvent ("invitationBuyCarAccepted",localPlayer, inv_player, inv_acc, inv_price, inv_veh_name, inv_veh_id) else triggerServerEvent ("invitationBuyCarNotAccepted",localPlayer, inv_player ) end if #listOfInvitations > 0 then createAcceptBuyCarWindow (listOfInvitations[1][1],listOfInvitations[1][2],listOfInvitations[1][3],listOfInvitations[1][4] ) table.remove (listOfInvitations,1) end elseif source == Button_ABC_N then showCursor ( false ) triggerServerEvent ("invitationBuyCarNotAccepted",localPlayer, inv_player ) destroyElement ( Window_ABC ) if #listOfInvitations > 0 then createAcceptBuyCarWindow (listOfInvitations[1][1],listOfInvitations[1][2],listOfInvitations[1][3],listOfInvitations[1][4] ) table.remove (listOfInvitations,1) end end end addEventHandler("onClientGUIClick", resourceRoot, invitationsClickVehicle) function createPlayersList (row_id) showCursor ( true ) Window_PLS = guiCreateWindow(screX/2-155,screY/2-220,310,420,"Venda de carros!",false) guiSetVisible(Window_PLS, true) guiSetProperty(Window_PLS, "AlwaysOnTop", "true") guiWindowSetSizable(Window_PLS, false) Label_PLS_info = guiCreateLabel(21,28,266,36,"Digite o preço dos carros:",false,Window_PLS) edit_PLS_price = guiCreateEdit ( 110,58,90,36, guiGridListGetItemText(Grid_VS, row_id, 2) or 0, false, Window_PLS ) guiLabelSetColor(Label_PLS_info, 38, 122, 216) guiLabelSetHorizontalAlign(Label_PLS_info,"center",true) Button_PLS_Y = guiCreateButton(17,379,129,36,"Vender",false,Window_PLS) Button_PLS_N = guiCreateButton(161,379,129,36,"Fechar",false,Window_PLS) addEventHandler("onClientGUIChanged", edit_PLS_price, function(element) guiSetText ( edit_PLS_price, string.gsub (guiGetText( edit_PLS_price ), "%a", "") ) end) playerList_PLS = guiCreateGridList ( 21, 100, 268, 265, false, Window_PLS ) local column = guiGridListAddColumn( playerList_PLS, "Jogadores", 0.85 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList_PLS ) guiGridListSetItemText ( playerList_PLS, row, column, getPlayerName ( player ), false, false ) end end end --createPlayersList () listOfInvitations = {} inv_player, inv_acc, inv_price, inv_veh_name, inv_veh_id = nil, nil, nil, nil, nil addEvent("recieveInviteToBuyCar", true) addEventHandler("recieveInviteToBuyCar", root, function(player, acc, price, veh_name, veh_id) if player and price and acc and veh_name and veh_id then if getPlayerFromName ( player ) then if not isElement ( Window_ABC ) then createAcceptBuyCarWindow (player,acc,price, veh_name, veh_id) else table.insert ( listOfInvitations, {player,acc,price, veh_name, veh_id}) end else outputMessage ( "#c1c1c1Jogador não pode ser encontrado", source, 250, 10, 10,true) end end end) addEvent("cleanCarInvitations", true) addEventHandler("cleanCarInvitations", root, function() invitations_send = false end) function createAcceptBuyCarWindow(player,acc,price, veh_name, veh_id) showCursor ( true ) inv_player, inv_acc, inv_price, inv_veh_name, inv_veh_id = player,acc,price, veh_name, veh_id Window_ABC = guiCreateWindow(screX/2-155,screY/2-220,410,100,"Venda de carros",false) guiSetVisible(Window_ABC, true) guiSetProperty(Window_ABC, "AlwaysOnTop", "true") guiWindowSetSizable(Window_ABC, false) Label_ABC_info = guiCreateLabel(10,28,390,36,player.." Te ofereceu o "..veh_name.." por "..price.."$ (o seu dinheiro: "..getPlayerMoney() .."$)",false,Window_ABC) guiLabelSetColor(Label_ABC_info, 38, 216, 38) guiLabelSetHorizontalAlign(Label_ABC_info,"center",true) Button_ABC_Y = guiCreateButton(17,70,129,36,"Comprar",false,Window_ABC) Button_ABC_N = guiCreateButton(264,70,129,36,"Cancelar",false,Window_ABC) end function SpecVehicle(id) if spc then removeEventHandler("onClientPreRender", root, Sp) setCameraTarget(localPlayer) if isTimer(freezTimer) then killTimer(freezTimer) end freezTimer = setTimer(function() setElementFrozen(localPlayer, false) end, 2500, 1) spc = false return end for i, vehicle in ipairs(getElementsByType("vehicle")) do if getElementData(vehicle, "Owner") == localPlayer and getElementData(vehicle, "ID") == id then cVeh = vehicle spc = true addEventHandler("onClientPreRender", root, Sp) guiSetVisible(Window_VS, false) showCursor(false) break end end end function Sp() if isElement(cVeh) then local x, y, z = getElementPosition(cVeh) setElementFrozen(localPlayer, true) setCameraMatrix(x, y-1, z+15, x, y, z) else removeEventHandler("onClientPreRender", root, Sp) setCameraTarget(localPlayer) if isTimer(freezTimer) then killTimer(freezTimer) end freezTimer = setTimer(function() setElementFrozen(localPlayer, false) end, 2500, 1) spc = false end end ShopMarkersTable = {} local ShopTable = { --------- Ids de cada um na sua loja do mesmo jeito que adicionou la encima bote aqui e mude os preços tambem [1] = {ID = {{541, 700000} ,{494, 500000} ,{506, 900000} ,{550, 450000} }, vPosX = 2134, vPosY = -1170, vPosZ = 28.15, PosX = 2133, PosY = -1149, PosZ = 23.4, CamX = 2134.1, CamY = -1160, CamZ = 35, lookAtX = 2133.3, lookAtY = -1168, lookAtZ = 28}, [2] = {ID = {{541, 700000} ,{494, 500000} ,{506, 900000} ,{550, 450000} }, vPosX = 552, vPosY = -1288, vPosZ = 18, PosX = 562, PosY = -1270, PosZ = 16, CamX = 552, CamY = -1275.82, CamZ = 21.61, lookAtX = 552, lookAtY = -1276.77, lookAtZ = 21.29}, [3] = {ID = {{541, 700000} ,{494, 500000} ,{506, 900000} ,{550, 450000} }, vPosX = 1942.5, vPosY = 2052, vPosZ = 11, PosX = 1946, PosY = 2068, PosZ = 10, CamX = 1930.36, CamY = 2052.78, CamZ = 14.71, lookAtX = 1931.36, lookAtY = 2052.78, lookAtZ = 14.43}, [4] = {ID = {{541, 700000} ,{494, 500000} ,{506, 900000} ,{550, 450000} }, vPosX = -1950, vPosY = 266, vPosZ = 36.2, PosX = -1954, PosY = 299, PosZ = 34, CamX = -1960.18, CamY = 266.06, CamZ = 37.94, lookAtX = -1959.2, lookAtY = 266.06, lookAtZ = 37.73}, [5] = {ID = {{541, 700000} ,{494, 500000} ,{506, 900000} ,{550, 450000} }, vPosX = -1660, vPosY = 1213, vPosZ = 7, PosX = -1634, PosY = 1199, PosZ = 6, CamX = -1648.9, CamY = 1212.27, CamZ = 10.16, lookAtX = -1649.88, lookAtY = 1212.27, lookAtZ = 9.94} } VehicleShop_Window = guiCreateWindow(screX-350,screY-450, 343, 436, "Shop de Veiculos", false) guiSetVisible(VehicleShop_Window, false) guiWindowSetSizable(VehicleShop_Window , false) guiSetAlpha(VehicleShop_Window, 0.8) carGrid = guiCreateGridList(9, 20, 324, 329, false, VehicleShop_Window) guiGridListSetSelectionMode(carGrid, 0) carColumn = guiGridListAddColumn(carGrid, "Nome", 0.5) costColumn = guiGridListAddColumn(carGrid, "Preço", 0.4) carButton_s = guiCreateStaticImage(14, 355, 86, 56, "images/button_standard.png", false, VehicleShop_Window) carButton_o = guiCreateStaticImage(14, 355, 86, 56, "images/button_mouse.png", false, VehicleShop_Window) carButton = guiCreateLabel(14, 355, 86, 56, "Comprar", false, VehicleShop_Window) guiSetFont(carButton, "default-bold-small") guiLabelSetColor(carButton, 255, 255, 255) guiLabelSetVerticalAlign(carButton, "center") guiLabelSetHorizontalAlign(carButton, "center") carColorButton_s = guiCreateStaticImage(128, 355, 86, 56, "images/button_standard.png", false, VehicleShop_Window) carColorButton_o = guiCreateStaticImage(128, 355, 86, 56, "images/button_mouse.png", false, VehicleShop_Window) carColorButton = guiCreateLabel(128, 355, 86, 56, "Pintar", false, VehicleShop_Window) guiSetFont(carColorButton, "default-bold-small") guiLabelSetColor(carColorButton, 255, 255, 255) guiLabelSetVerticalAlign(carColorButton, "center") guiLabelSetHorizontalAlign(carColorButton, "center") closeButton_s = guiCreateStaticImage(237, 355, 86, 56, "images/button_standard.png", false, VehicleShop_Window) closeButton_o = guiCreateStaticImage(237, 355, 86, 56, "images/button_mouse.png", false, VehicleShop_Window) closeButton = guiCreateLabel(237, 355, 86, 56, "Sair", false, VehicleShop_Window) guiSetFont(closeButton, "default-bold-small") guiLabelSetColor(closeButton, 255, 255, 255) guiLabelSetVerticalAlign(closeButton, "center") guiLabelSetHorizontalAlign(closeButton, "center") guiSetVisible(carButton_o,false) guiSetVisible(closeButton_o,false) guiSetVisible(carColorButton_o,false) addEventHandler( "onClientMouseLeave", root, function() if source == Button_VS_sn then guiSetVisible(Button_VS_sn_s,true) guiSetVisible(Button_VS_sn_o,false) elseif source == Button_VS_dy then guiSetVisible(Button_VS_dy_s,true) guiSetVisible(Button_VS_dy_o,false) elseif source == Button_VS_Warp then guiSetVisible(Button_VS_Warp_s,true) guiSetVisible(Button_VS_Warp_o,false) guiSetVisible(Button_VS_Warp_info,false) elseif source == Button_VS_Fix then guiSetVisible(Button_VS_Fix_s,true)--Button_VS_Fix_info guiSetVisible(Button_VS_Fix_o,false) guiSetVisible(Button_VS_Fix_info,false) elseif source == Button_VS_lk then guiSetVisible(Button_VS_lk_s,true) guiSetVisible(Button_VS_lk_o,false) elseif source == Button_VS_sl then guiSetVisible(Button_VS_sl_s,true) guiSetVisible(Button_VS_sl_o,false) elseif source == Button_VS_give then guiSetVisible(Button_VS_give_s,true) guiSetVisible(Button_VS_give_o,false) elseif source == carButton then guiSetVisible(carButton_s,true) guiSetVisible(carButton_o,false) elseif source == closeButton then guiSetVisible(closeButton_s,true) guiSetVisible(closeButton_o,false) elseif source == carColorButton then guiSetVisible(carColorButton_s,true) guiSetVisible(carColorButton_o,false) end end) addEventHandler( "onClientMouseEnter", root, function() if source == Button_VS_sn then guiSetVisible(Button_VS_sn_s,false) guiSetVisible(Button_VS_sn_o,true) elseif source == Button_VS_dy then guiSetVisible(Button_VS_dy_s,false) guiSetVisible(Button_VS_dy_o,true) elseif source == Button_VS_Warp then guiSetVisible(Button_VS_Warp_s,false) guiSetVisible(Button_VS_Warp_o,true) guiSetVisible(Button_VS_Warp_info,true) elseif source == Button_VS_Fix then guiSetVisible(Button_VS_Fix_s,false)--Button_VS_Fix_info guiSetVisible(Button_VS_Fix_o,true) guiSetVisible(Button_VS_Fix_info,true) elseif source == Button_VS_lk then guiSetVisible(Button_VS_lk_s,false) guiSetVisible(Button_VS_lk_o,true) elseif source == Button_VS_sl then guiSetVisible(Button_VS_sl_s,false) guiSetVisible(Button_VS_sl_o,true) elseif source == Button_VS_give then guiSetVisible(Button_VS_give_s,false) guiSetVisible(Button_VS_give_o,true) elseif source == Button_VS_give then guiSetVisible(Button_VS_give_s,false) guiSetVisible(Button_VS_give_o,true) elseif source == carButton then guiSetVisible(carButton_s,false) guiSetVisible(carButton_o,true) elseif source == closeButton then guiSetVisible(closeButton_s,false) guiSetVisible(closeButton_o,true) elseif source == carColorButton then guiSetVisible(carColorButton_s,false) guiSetVisible(carColorButton_o,true) end end) for i, M in ipairs(ShopTable) do ShopMarker = createMarker(M["PosX"], M["PosY"], M["PosZ"], "cylinder", 2, 38, 122, 216) ShopMarkerShader = createMarker(M["PosX"], M["PosY"], M["PosZ"], "cylinder", 2, 38, 122, 216) ShopMarkersTable[ShopMarker] = true setElementData ( ShopMarker, "shopID", i ) setElementID(ShopMarker, tostring(i)) createBlipAttachedTo(ShopMarker, 55, 2, 255, 255, 255, 255, 0, 400) end function getVehicleModelFromNewName (name) for i,v in pairs ( customCarNames ) do if v == name then return i end end return false end addEventHandler("onClientGUIClick", resourceRoot, function() if (source == carGrid) then local carName = guiGridListGetItemText(carGrid, guiGridListGetSelectedItem(carGrid), 1) local carprice = guiGridListGetItemText(carGrid, guiGridListGetSelectedItem(carGrid), 2) if guiGridListGetSelectedItem(carGrid) ~= -1 then guiSetText(CarName, carName) guiSetText(CarPrice, "$"..carprice) local carID = getVehicleModelFromNewName(carName) or getVehicleModelFromName(carName) if isElement(veh) then setElementModel(veh, carID) return end veh = createVehicle(carID, ShopTable[i]["vPosX"], ShopTable[i]["vPosY"], ShopTable[i]["vPosZ"]) setVehicleDamageProof(veh, true) setElementFrozen(veh, true) setVehicleColor(veh, r1, g1, b1, r2, g2, b2) timer = setTimer(function() local x, y, z = getElementRotation(veh) setElementRotation(veh, x, y, z+3) end, 50, 0) else guiSetText(CarName, "Noun") guiSetText(CarPrice, "Noun") r1, g1, b1, r2, g2, b2 = math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255) if isElement(veh) then destroyElement(veh) end if isTimer(timer) then killTimer(timer) end end elseif (source == carColorButton) then openColorPicker() elseif (source == carButton) then if guiGridListGetSelectedItem(carGrid) then local carName = guiGridListGetItemText(carGrid, guiGridListGetSelectedItem(carGrid), 1) local carID = getVehicleModelFromNewName(carName) or getVehicleModelFromName(carName) local carCost = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem(carGrid), 2) local r1, g1, b1, r2, g2, b2 = getVehicleColor(veh, true) triggerServerEvent("onBuyNewVehicle", localPlayer, carID, carCost, r1, g1, b1, r2, g2, b2) outputMessage("#c1c1c1Você acabou de comprar um: #00FF66"..carName, 38, 122, 216, true) guiSetVisible(VehicleShop_Window, false) showCursor(false) setElementFrozen(localPlayer, false) fadeCamera(false, 1.0) setTimer(function() fadeCamera(true, 0.5) setCameraTarget(localPlayer) end, 1000, 1) if isElement(veh) then destroyElement(veh) end if isTimer(timer) then killTimer(timer) end end elseif (source == closeButton) then if guiGetVisible(VehicleShop_Window) then guiSetVisible(VehicleShop_Window, false) showCursor(false) setElementFrozen(localPlayer, false) fadeCamera(false, 1.0) setElementData ( localPlayer, "atVehShop", false) setTimer(function() fadeCamera(true, 0.5) setCameraTarget(localPlayer) end, 1000, 1) if isElement(veh) then destroyElement(veh) end if isTimer(timer) then killTimer(timer) end end end end) function openColorPicker() if (colorPicker.isSelectOpen) or not isElement(veh) then return end colorPicker.openSelect(colors) end function closedColorPicker() end function updateColor() if (not colorPicker.isSelectOpen) then return end local r, g, b = colorPicker.updateTempColors() if (veh and isElement(veh)) then r1, g1, b1, r2, g2, b2 = getVehicleColor(veh, true) if (guiCheckBoxGetSelected(checkColor1)) then r1, g1, b1 = r, g, b end if (guiCheckBoxGetSelected(checkColor2)) then r2, g2, b2 = r, g, b end setVehicleColor(veh, r1, g1, b1, r2, g2, b2) end end addEventHandler("onClientRender", root, updateColor) --[[addCommandHandler("xx", function() local x, y, z, lx, ly, lz = getCameraMatrix() setCameraMatrix(x, y, z, lx, ly, lz) outputChatBox(x..", "..y..", "..z..", "..lx..", "..ly..", "..z) end)]] addEventHandler("onClientMarkerHit", resourceRoot, function(player) if getElementType(player) ~= "player" or player ~= localPlayer or isPedInVehicle(player) then return end if ShopMarkersTable[source] then i = tonumber(getElementID(source)) guiGridListClear(carGrid) for i, v in ipairs(ShopTable[i]["ID"]) do local carName = customCarNames[ v[1] ] or getVehicleNameFromModel(v[1]) local row = guiGridListAddRow(carGrid) guiGridListSetItemText(carGrid, row, 1, carName, false, true) guiGridListSetItemText(carGrid, row, 2, tostring(v[2]), false, true) end setCameraMatrix(ShopTable[i]["CamX"], ShopTable[i]["CamY"], ShopTable[i]["CamZ"], ShopTable[i]["lookAtX"], ShopTable[i]["lookAtY"], ShopTable[i]["lookAtZ"]) guiSetVisible(VehicleShop_Window, true) showCursor(true) setElementData ( player, "atVehShop", getElementData ( source, "shopID")) guiGridListSetSelectedItem(carGrid, 0, 1) setTimer(function() setElementFrozen(localPlayer, true) local carName = guiGridListGetItemText(carGrid, 0, 1) local carID = getVehicleModelFromNewName(carName) or getVehicleModelFromName(carName) local x, y, z = ShopTable[i]["vPosX"], ShopTable[i]["vPosY"], ShopTable[i]["vPosZ"] if isElement(veh) then destroyElement(veh) end if isTimer(timer) then killTimer(timer) end r1, g1, b1, r2, g2, b2 = math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255) veh = createVehicle(carID, x, y, z) setVehicleDamageProof(veh, true) setElementFrozen(veh, true) setVehicleColor(veh, r1, g1, b1, r2, g2, b2) timer = setTimer(function() local x, y, z = getElementRotation(veh) setElementRotation(veh, x, y, z+3) end, 50, 0) end, 100, 1) end end) addEventHandler("onClientRender", getRootElement(), function() local x2, y2, z2 = getElementPosition(localPlayer) for index, car in pairs(getElementsByType('vehicle')) do if(getElementData(car,'ownercar')) then local x, y, z = getElementPosition(car) z = z+1 local sx, sy = getScreenFromWorldPosition(x, y, z) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 20) then local fontbig = 2-(distance/10) local owner = getElementData(car, "ownercar") if(owner) then dxDrawBorderedCarText("Proprietário: "..(owner), sx, sy, sx, sy, tocolor(255, 255, 255, 255), fontbig, "default-bold", "center") end end end end end for i, v in ipairs ( ShopTable ) do local sx, sy = getScreenFromWorldPosition(v.PosX, v.PosY, v.PosZ+1) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D ( x2, y2, z2,v.PosX, v.PosY, v.PosZ ) if distance < 30 then local fontbig = 3-(distance/10) --dxDrawBorderedCarText("", sx, sy, sx, sy, tocolor(212, 179, 17, 200), fontbig, "default-bold", "center") end end end end) function dxDrawBorderedCarText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) end function outputMessage (text, r, g, b) return exports["scr-Lib"]:outputMessage(text, r, g, b); end Server: customCarNames = -- новые названия { } shopsVehSpawns = { [1] = { 2131, -1133, 25.6, 0,0,359 }, [2] = { 555, -1278, 18, 0,0,100 }, [3] = { 1941, 2097, 10.8, 0,0,350 }, [4] = { -1988, 272, 36, 0,0,259 }, [5] = { -1642, 1213, 7.17, 0,0, 227 }, } function getFreeID() local result = dbPoll(dbQuery(db, "SELECT ID FROM VehicleList ORDER BY ID ASC"), -1) newID = false for i, id in pairs (result) do if id["ID"] ~= i then newID = i break end end if newID then return newID else return #result + 1 end end function getVehicleByID(id) v = false for i, veh in ipairs (getElementsByType("vehicle")) do if getElementData(veh, "ID") == id then v = veh break end end return v end function updateVehicleInfo(player) if isElement(player) then local result = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(player))), -1) if type(result) == "table" then setElementData(player, "VehicleInfo", result) end end end addEventHandler("onResourceStart", resourceRoot, function() db = dbConnect("sqlite", "database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS VehicleList (ID, Account, Model, X, Y, Z, RotZ, Colors, Upgrades, Paintjob, Cost, HP, new_hydr)") for i, player in ipairs(getElementsByType("player")) do updateVehicleInfo(player) end end) addEvent("onOpenGui", true) addEventHandler("onOpenGui", root, function() updateVehicleInfo(source) end) function destroyVehicle(theVehicle) if isElement(theVehicle) then local Owner = getElementData(theVehicle, "Owner") if Owner then local x, y, z = getElementPosition(theVehicle) local _, _, rz = getElementRotation(theVehicle) local r1, g1, b1, r2, g2, b2 = getVehicleColor(theVehicle, true) local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2 upgrade = "" for _, upgradee in ipairs (getVehicleUpgrades(theVehicle)) do if upgrade == "" then upgrade = upgradee else upgrade = upgrade..","..upgradee end end local Paintjob = getVehiclePaintjob(theVehicle) or 3 local id = getElementData(theVehicle, "ID") dbExec(db, "UPDATE VehicleList SET X = ?, Y = ?, Z = ?, RotZ = ?, HP = ?, Colors = ?, Upgrades = ?, Paintjob = ?, new_hydr = ? WHERE Account = ? AND ID = ?", x, y, z, rz, getElementHealth(theVehicle), color, upgrade, Paintjob, getElementData ( theVehicle, "NewHydr") and 1 or 0, getAccountName(getPlayerAccount(Owner)), id) updateVehicleInfo(Owner) local attached = getAttachedElements(theVehicle) if (attached) then for k,element in ipairs(attached) do if getElementType(element) == "blip" then destroyElement(element) end end end end destroyElement(theVehicle) end end addEvent("onBuyNewVehicle", true) addEventHandler("onBuyNewVehicle", root, function(Model, cost, r1, g1, b1, r2, g2, b2) abc = false local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1) for i, data in ipairs (data) do if data["Model"] == Model then abc = true break end end if #data >= 10 then outputMessage("#c1c1c1Desculpe, mas você só pode comprar #00FF6610#FFFFFF veiculos.", source, 38, 122, 216, true) return end if abc then outputMessage("#c1c1c1Você já tem este veiculo.", source, 38, 122, 216, true) return end if getPlayerMoney(source) >= tonumber(cost) then takePlayerMoney ( source, cost ) local x, y, z = getElementPosition(source) local _, _, rz = getElementRotation(source) local shopID = getElementData ( source, "atVehShop") local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2 if shopID and shopsVehSpawns[shopID] then vehicle = createVehicle(Model, shopsVehSpawns[shopID][1], shopsVehSpawns[shopID][2], shopsVehSpawns[shopID][3], shopsVehSpawns[shopID][4], shopsVehSpawns[shopID][5], shopsVehSpawns[shopID][6]) else vehicle = createVehicle(Model, x-5, y+5, z, 0, 0, rz) end setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2) setElementData(vehicle, "Owner", source) local NewID = getFreeID() setElementData(vehicle, "ID", NewID) dbExec(db, "INSERT INTO VehicleList VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", NewID, getAccountName(getPlayerAccount(source)), Model, x-5, y+5, z, rz, color, "", 3, cost, 1000, 0) outputMessage("#c1c1c1Por: #00FF66$"..cost, source, 38, 122, 216, true) updateVehicleInfo(source) setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source))) warpPedIntoVehicle ( source, vehicle ) vv[vehicle] = setTimer(function(source) if not isElement(source) then killTimer(vv[source]) vv[source] = nil end if isElement(source) and getElementHealth(source) <= 255 then setElementHealth(source, 255.5) setVehicleDamageProof(source, true) setVehicleEngineState(source, false) end end, 150, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) else outputMessage("#c1c1c1Você não tem grana para comprar este veiculo.", source, 38, 122, 216, true) end end) vv = {} addEvent("SpawnMyVehicle", true) addEventHandler("SpawnMyVehicle", root, function(id) local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then if getVehicleByID(id) then outputMessage("#c1c1c1O seu veiculo #00FF66"..(customCarNames[data[1]["Model"]] or getVehicleNameFromModel(data[1]["Model"])).." #c1c1c1já está spawnado.", source, 38, 122, 216, true) else local color = split(data[1]["Colors"], ',') r1 = color[1] or 255 g1 = color[2] or 255 b1 = color[3] or 255 r2 = color[4] or 255 g2 = color[5] or 255 b2 = color[6] or 255 vehicle = createVehicle(data[1]["Model"], data[1]["X"], data[1]["Y"], data[1]["Z"], 0, 0, data[1]["RotZ"]) setElementData(vehicle, "ID", id) local upd = split(tostring(data[1]["Upgrades"]), ',') for i, upgrade in ipairs(upd) do addVehicleUpgrade(vehicle, upgrade) end local Paintjob = data[1]["Paintjob"] or 3 setVehiclePaintjob(vehicle, Paintjob) setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2) if tonumber(data[1]["HP"]) <= 255.5 then data[1]["HP"] = 255 end if data[1]["new_hydr"] and data[1]["new_hydr"] == 1 then setElementData(vehicle, "NewHydr", true) else setElementData(vehicle, "NewHydr", false) end setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source))) setElementHealth(vehicle, data[1]["HP"]) setElementData(vehicle, "Owner", source) vv[vehicle] = setTimer(function(source) if not isElement(source) then killTimer(vv[source]) vv[source] = nil end if isElement(source) and getElementHealth(source) <= 255 then setElementHealth(source, 255.5) setVehicleDamageProof(source, true) setVehicleEngineState(source, false) end end, 50, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) outputMessage("#c1c1c1O seu veiculo #00FF66"..(customCarNames[data[1]["Model"]] or getVehicleNameFromModel(data[1]["Model"])).." #c1c1c1foi spawnado.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1Há um problema com o veiculo, notifique o administrador.", source, 38, 122, 216, true) end end) addEvent("DestroyMyVehicle", true) addEventHandler("DestroyMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then destroyVehicle(vehicle) outputMessage ("#c1c1c1O seu veiculo #00FF66"..(customCarNames[data[1]["Model"]] or getVehicleNameFromModel(data[1]["Model"])).." #c1c1c1foi removido.", source, 38, 122, 216, true) else outputMessage("#c1c1c1Selecione um veiculo.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1O seu veiculo não foi spawnado.", source, 38, 122, 216, true) end end) addEvent("LightsMyVehicle", true) addEventHandler("LightsMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then local Vehicle = getPedOccupiedVehicle(source) if Vehicle == vehicle then if getVehicleOverrideLights(vehicle) ~= 2 then setVehicleOverrideLights(vehicle, 2) outputMessage("#c1c1c1Seu veiculo #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1teve as luzes acesas.", source, 38, 122, 216, true) elseif getVehicleOverrideLights(vehicle) ~= 1 then setVehicleOverrideLights(vehicle, 1) outputMessage("#c1c1c1Seu veiculo #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1teve as luzes apagadas.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1Você não está no veiculo!", source, 38, 122, 216, true) end else outputMessage("#c1c1c1O seu veiculo não está spawnado.", source, 38, 122, 216, true) end end) addEvent("LockMyVehicle", true) addEventHandler("LockMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then if not isVehicleLocked(vehicle) then setVehicleLocked(vehicle, true) setVehicleDoorsUndamageable(vehicle, true) setVehicleDoorState(vehicle, 0, 0) setVehicleDoorState(vehicle, 1, 0) setVehicleDoorState(vehicle, 2, 0) setVehicleDoorState(vehicle, 3, 0) outputMessage("#c1c1c1O seu transporte #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1foi #00FF66fechado.", source, 38, 122, 216, true) elseif isVehicleLocked(vehicle) then setVehicleLocked(vehicle, false) setVehicleDoorsUndamageable(vehicle, false) outputMessage("#c1c1c1O seu transporte #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1foi #00FF66aberto.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1O seu veiculo não foi spawnado.", source, 38, 122, 216, true) end end) addEvent("BlipMyVehicle", true) addEventHandler("BlipMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then if not getElementData(vehicle, "ABlip") then setElementData(vehicle, "ABlip", true) createBlipAttachedTo(vehicle, 41, 2, 255, 0, 0, 255, 0, 65535, source) outputMessage("#c1c1c1O seu transporte #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1foi marcado no mapa, usar #00FF66F11#c1c1c1 para encontrá-lo.", source, 38, 122, 216, true) else local attached = getAttachedElements(vehicle) if (attached) then for k,element in ipairs(attached) do if getElementType(element) == "blip" then destroyElement(element) end end end setElementData(vehicle, "ABlip", false) outputMessage("#c1c1c1O seu veículo #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1teve o blip removido.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1O seu veiculo não está spawnado.", source, 38, 122, 216, true) end end) addEvent("FixMyVehicle", true) addEventHandler("FixMyVehicle", root, function(id) if getPlayerMoney(source) >= tonumber(500) then takePlayerMoney ( source, 500 ) local vehicle = getVehicleByID(id) if isElement(vehicle) then fixVehicle(vehicle) setVehicleEngineState(vehicle, true) if isVehicleDamageProof(vehicle) then setVehicleDamageProof(vehicle, false) end end dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND ID = ?", 1000, getAccountName(getPlayerAccount(source)), id) updateVehicleInfo(source) outputMessage ("#c1c1c1O seu transporte foi reparado.", source, 38, 122, 216, true) else outputMessage("#c1c1c1Você não tem dinheiro suficiente para reparar.", source, 38, 122, 216, true) outputMessage("#c1c1c1Preço: #00FF66$500.", source, 38, 122, 216, true) end end) addEvent("WarpMyVehicle", true) addEventHandler("WarpMyVehicle", root, function(id) if not isPedInVehicle (source) then if getElementInterior(source) == 0 then if getPlayerMoney(source) >= tonumber(500) then local vehicle = getVehicleByID(id) if isElement(vehicle) then takePlayerMoney ( source, 500 ) local x, y, z = getElementPosition(source) setElementPosition(vehicle, x, y, z) warpPedIntoVehicle ( source, vehicle ) outputMessage ("#c1c1c1O seu veiculo #00FF66"..(customCarNames[getElementModel(vehicle)] or getVehicleNameFromModel(getElementModel(vehicle))).." #c1c1c1foi entregue a você.", source, 38, 122, 216, true) else outputMessage("#c1c1c1O seu veiculo não está spawnado.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1Você não tem os meios de se teletransportar para o veiculo.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1Você só poderá mudar de veiculo se sair do atual.", source, 38, 122, 216, true) end else outputMessage("#c1c1c1Nós não podemos dirigir seu veiculo. Por favor, sair do outro veiculo.", source, 38, 122, 216, true) end end) addEvent("SellMyVehicle", true) addEventHandler("SellMyVehicle", root, function(id) local vehicle = getVehicleByID(id) local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then local Money = math.ceil((data[1]["Cost"]*.9)*math.floor(data[1]["HP"])/100/10) givePlayerMoney (source, Money) if isElement(vehicle) then destroyElement(vehicle) end dbExec(db, "DELETE FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id) updateVehicleInfo(source) outputMessage("#c1c1c1Você vendeu o seu veiculo por #00FF66$"..Money, source, 38, 122, 216, true) end end) function getDataOnLogin(_, account) updateVehicleInfo(source) end addEventHandler("onPlayerLogin", root, getDataOnLogin) function SaveVehicleDataOnQuit() for i, veh in ipairs (getElementsByType("vehicle")) do if getElementData(veh, "Owner") == source then destroyVehicle(veh) end end end addEventHandler("onPlayerQuit", root,SaveVehicleDataOnQuit) addEvent("inviteToBuyCarSended", true) addEventHandler("inviteToBuyCarSended", root, function(player, price, veh_name, veh_id) if player and price and veh_name and veh_id then local pl = getPlayerFromName ( player ) if pl then triggerClientEvent ( pl, "recieveInviteToBuyCar", pl, getPlayerName (source), getAccountName(getPlayerAccount(source)), price, veh_name, veh_id ) else outputMessage ( "#c1c1c1O jogador não foi encontrado, a venda foi cancelada", source, 250, 10, 10, true) triggerClientEvent ( source, "cleanCarInvitations", source ) end end end) addEvent("invitationBuyCarNotAccepted", true) addEventHandler("invitationBuyCarNotAccepted", root, function(player, acc, price, veh_name, veh_id) local pl = getPlayerFromName ( player ) if pl then triggerClientEvent ( pl, "cleanCarInvitations", pl ) outputMessage ( "#c1c1c1O jogador recusou-se a comprar o seu carro", pl, 250, 10, 10,true) end end) addEvent("invitationBuyCarAccepted", true) addEventHandler("invitationBuyCarAccepted", root, function(player, acc, price, veh_name, veh_id) local pl = getPlayerFromName ( player ) local avail = false if pl and getAccountName ( getPlayerAccount (pl)) == acc then avail = true triggerClientEvent ( pl, "cleanCarInvitations", pl ) --outputMessage ( "Игрок отказался покупать ваше авто", pl, 250, 10, 10) else for i, v in ipairs( getElementsByType ( 'player' ) ) do if getAccountName(getPlayerAccount ( v )) == acc then avail = true pl = v break end end end price = tonumber(price) or 0 if avail then if isGuestAccount ( getPlayerAccount ( source ) ) then triggerClientEvent ( pl, "cleanCarInvitations", pl ) outputMessage ( "#c1c1c1Você não está logado em sua conta, a transação foi cancelada", source, 250, 10, 10,true ) outputMessage ( "#c1c1c1O jogador não entrou na conta, a transação foi cancelada", pl, 250, 10, 10,true ) return true end if getPlayerMoney ( source ) >= price then local vehicle = getVehicleByID(tonumber(veh_id)) local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(pl)), veh_id), -1) if type(data) == "table" and #data ~= 0 and isElement ( vehicle ) then givePlayerMoney ( pl, price ) takePlayerMoney ( source, price ) dbExec(db, "UPDATE VehicleList SET Account = ? WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), getAccountName(getPlayerAccount(pl)), veh_id) updateVehicleInfo(source) updateVehicleInfo(pl) setElementData(vehicle, "Owner", source) setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source))) outputMessage("#c1c1c1Você vendeu o seu veiculo por #00FF66$"..price, pl, 38, 122, 216, true) outputMessage("#c1c1c1Você comprou um carro por #00FF66$"..price, source, 38, 122, 216, true) triggerClientEvent ( pl, "cleanCarInvitations", pl ) else outputMessage ( "#c1c1c1A máquina não pode ser encontrado, o negócio é cancelado", source, 250, 10, 10,true ) outputMessage ( "#c1c1c1A máquina não pode ser encontrado, o negócio é cancelado. Tente carro desova.", pl, 250, 10, 10,true ) triggerClientEvent ( pl, "cleanCarInvitations", pl ) end else outputMessage ( "#c1c1c1Você não tem dinheiro suficiente, a transação foi cancelada", source, 250, 10, 10,true ) end else outputMessage ( "#c1c1c1O jogador não foi encontrado, a operação foi cancelada", source, 250, 10, 10,true) end end) function outputMessage (text, player, r, g, b) return exports["scr-Lib"]:outputMessage(player, text, r, g, b); end
  24. Olá pessoal, tudo bom ? Coloquei um radar no meu servidor e queria saber como faço para a Area-Verde aparecer nele! Ja tenho as areas verdes criadas! Pórem quero saber como faz para elas aparecerem no radar, pois no radar elas nao aparecem. Agradeço muito se poderem tirar um tempinho pra me ajudar Script do Radar: -------------------------------------------------------------------------------------------------- -- Distributed under the Creative Commons Attribution-NonCommercial 4.0 International license -- -- Version: (release) 1.0.0 -- -- Original author: Kacper "MrTasty (aka Addon)" Stasiak -- -- Special thanks to: Doomed_Space_Marine (useful functions) -- -- robhol (useful functions) -- -------------------------------------------------------------------------------------------------- --Features local enableBlips = true local renderNorthBlip = true local alwaysRenderMap = false --true = always render map, false = only render when in interior world 0 (radar will stay, only the map will stop rendering) local alwaysRenderOxygen = false --true = always render oxygen, false = only when oxygen not full/local player in water local disableGTASAhealth = true --Disable GTASA's HUD health display local disableGTASAarmor = true --Disable GTASA's HUD armour display local disableGTASAoxygen = true --Disable GTASA's HUD oxygen display --Dimensions & Sizes local worldW, worldH = 3072, 3072 --map image dimensions - if map image changed, please edit appropriately local blip = 12 --Blip size, pixels relative to 1366x768 resolution --Colours - Notice: Health colours smoothly according it local player's HP. local healthOkayR, healthOkayG, healthOkayB = 102, 204, 102 --RGB for health which is 'okay' (50% or more) local healthBadR, healthBadG, healthBadB = 200, 200, 0 --RGB for health which is 'bad' (25%) local healthCriticalR, healthCriticalG, healthCriticalB = 200, 0, 0 --RGB for health which is 'critically low' (near/at 0%) local armorColorR, armorColorG, armorColorB = 0, 102, 255 local oxygenColorR, oxygenColorG, oxygenColorB = 255, 255, 0 ------------------------------------------------------------------------------------ --Do not modify anything below unless you're absolutely sure of what you're doing.-- ------------------------------------------------------------------------------------ local sx, sy = guiGetScreenSize() local rt = dxCreateRenderTarget(290, 175) local xFactor, yFactor = sx/1366, sy/768 local yFactor = xFactor --otherwise the radar looses it's 2:3 ratio. -- Useful functions -- function findRotation(x1,y1,x2,y2) --Author: Doomed_Space_Marine & robhol local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getPointFromDistanceRotation(x, y, dist, angle) --Author: robhol local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then local mW, mH = dxGetMaterialSize(rt) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxSetRenderTarget(rt, true) if alwaysRenderMap or getElementInterior(localPlayer) == 0 then dxDrawRectangle(0, 0, mW, mH, 0xFF7CA7D1) --render background dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/mapa.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) end dxSetRenderTarget() dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (200)*yFactor, tocolor(0, 0, 0, 175)) dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 150)) local health = math.max(math.min(getElementHealth(localPlayer)/(0.232018558500192*getPedStat(localPlayer, 24) -32.018558511152), 1), 0) local armor = math.max(math.min(getPedArmor(localPlayer)/100, 1), 0) local oxygen = math.max(math.min(getPedOxygenLevel(localPlayer)/(1.5*getPedStat(localPlayer, 225) +1000), 1), 0) local r, g, b if health >= 0.25 then r, g, b = interpolateBetween(healthBadR, healthBadG, healthBadB, healthOkayR, healthOkayG, healthOkayB, math.floor(health*20)/10, "InOutQuad") else r, g, b = interpolateBetween(healthCriticalR, healthCriticalB, healthCriticalB, healthBadR, healthBadG, healthBadB, math.floor(health*20)/10, "InOutQuad") end local col = tocolor(r, g, b, 190) local bg = tocolor(r, g, b, 100) dxDrawRectangle((15)*xFactor, sy-(25)*yFactor, (142.5)*xFactor, (10)*yFactor, bg) dxDrawRectangle((15)*xFactor, sy-(25)*yFactor, (142.5*health)*xFactor, (10)*yFactor, col) if alwaysRenderOxygen or (oxygen < 1 or isElementInWater(localPlayer)) then dxDrawRectangle((162.5)*xFactor, sy-(25)*yFactor, (67.5)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 100)) dxDrawRectangle((162.5)*xFactor, sy-(25)*yFactor, (67.5*armor)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 190)) dxDrawRectangle((237.5)*xFactor, sy-(25)*yFactor, (67.5)*xFactor, (10)*yFactor, tocolor(oxygenColorR, oxygenColorG, oxygenColorB, 100)) dxDrawRectangle((237.5)*xFactor, sy-(25)*yFactor, (67.5*oxygen)*xFactor, (10)*yFactor, tocolor(oxygenColorR, oxygenColorG, oxygenColorB, 190)) else dxDrawRectangle((162.5)*xFactor, sy-(25)*yFactor, (142.5)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 100)) dxDrawRectangle((162.5)*xFactor, sy-(25)*yFactor, (142.5*armor)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 190)) end local rx, ry, rz = getElementRotation(localPlayer) local lB = (15)*xFactor local rB = (15+290)*xFactor local tB = sy-(205)*yFactor local bB = tB + (175)*yFactor local cX, cY = (rB+lB)/2, (tB+bB)/2 +(35)*yFactor local toLeft, toTop, toRight, toBottom = cX-lB, cY-tB, rB-cX, bB-cY for k, v in ipairs(getElementsByType("blip")) do local bx, by = getElementPosition(v) local actualDist = getDistanceBetweenPoints2D(x, y, bx, by) local maxDist = getBlipVisibleDistance(v) if actualDist <= maxDist and getElementDimension(v)==getElementDimension(localPlayer) and getElementInterior(v)==getElementInterior(localPlayer) then local dist = actualDist/(6000/((worldW+worldH)/2)) local rot = findRotation(bx, by, x, y)-camZ local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.min(dist, math.sqrt(toTop^2 + toRight^2)), rot) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) local bid = getElementData(v, "customIcon") or getBlipIcon(v) local _, _, _, bcA = getBlipColor(v) local bcR, bcG, bcB = 255, 255, 255 if getBlipIcon(v) == 0 then bcR, bcG, bcB = getBlipColor(v) end local bS = getBlipSize(v) dxDrawImage(bpx -(blip*bS)*xFactor/2, bpy -(blip*bS)*yFactor/2, (blip*bS)*xFactor, (blip*bS)*yFactor, "image/blip/"..bid..".png", 0, 0, 0, tocolor(bcR, bcG, bcB, bcA)) end end if renderNorthBlip then local rot = -camZ+180 local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.sqrt(toTop^2 + toRight^2), rot) --get position local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position to screen local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) --get distance to the capped position local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) --re-calculate position based on new distance if bpx and bpy then --if position was obtained successfully local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position just in case dxDrawImage(bpx -(blip*2)/2, bpy -(blip*2)/2, blip*2, blip*2, "image/blip/4.png", 0, 0, 0) --draw north (4) blip end end dxDrawImage(cX -(blip*2)*xFactor/2, cY -(blip*2)*yFactor/2, (blip*2)*xFactor, (blip*2)*yFactor, "image/player.png", camZ-rz, 0, 0) end end addEventHandler("onClientRender", root, drawRadar) addEventHandler("onClientResourceStop", resourceRoot, function() showPlayerHudComponent("radar", true) if disableGTASAhealth then showPlayerHudComponent("health", true) end if disableGTASAarmor then showPlayerHudComponent("armour", true) end if disableGTASAoxygen then showPlayerHudComponent("breath", true) end end)
  25. Olá pessoal do forum, tenho um ''DX Money'' no meu servidor, abaixo mostrarei a imagem dele pelo print https://prnt.sc/kytkfg Eu escrevi no print, onde quero mais ou menos q ele apareça, caso possam me ajudar! No print, ele esta entre o velocimetro não sei se conseguiram ver escrito "- $799,200", eu queria que ele aparecesse mais ou menos a partir dali onde esta a seta do mta, não muito perto do hud, porque ele esta praticamente dentro do velocimetro, o script dele esta abaixo, OBS:Ele tem só´1 arquivo.lua q é o client ------------------------------------------------------------------------- Client: local playerMoney = getPlayerMoney ( localPlayer ) local messages = { } local sx, sy = guiGetScreenSize ( ) addEventHandler ( "onClientRender", root, function ( ) local tick = getTickCount ( ) if ( playerMoney ~= getPlayerMoney ( localPlayer ) ) then local pM = getPlayerMoney ( localPlayer ) if ( pM > playerMoney ) then local diff = pM - playerMoney table.insert ( messages, { diff, true, tick + 5000, 180 } ) else local diff = playerMoney - pM table.insert ( messages, { diff, false, tick + 5000, 180 } ) end playerMoney = pM end if ( #messages > 7 ) then table.remove ( messages, 1 ) end for index, data in ipairs ( messages ) do local v1 = data[1] local v2 = data[2] local v3 = data[3] local v4 = data[4] dxDrawRectangle ( sx - 220, (sy-20)-(index*25), 200, 20, tocolor ( 0, 0, 0, v4 ) ) if ( v2 ) then dxDrawText ( "+ $"..convertNumber ( v1 ), sx - 200, (sy-18)-(index*25), 50, 20, tocolor ( 0, 255, 0, v4+75 ), 1, 'default-bold' ) else dxDrawText ( "- $"..convertNumber ( v1 ), sx - 200, (sy-18)-(index*25), 50, 20, tocolor ( 255, 0, 0, v4+75 ), 1, 'default-bold' ) end if ( tick >= v3 ) then messages[index][4] = v4-2 if ( v4 <= 25 ) then table.remove ( messages, index ) end end end end ) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end
×
×
  • Create New...