Jump to content

Search the Community

Showing results for tags 'me'.

  • 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

Found 13 results

  1. Hello dear forum members, I am deeply interested in a persistent question regarding my shader for the effect of raindrops flowing down the sides of the car, as well as the effect of raindrops (spots) on the surface of the car (roof, bumper). I’ve been struggling with these issues for a long time and still can’t figure out how to solve my two problems. I hope someone can help me and explain to a beginner in HLSL how to properly implement the shader. The first problem is that I don’t understand how to make the raindrops flow down the different sides of the car. Essentially, I have a single texture applied to the car, and I can't figure out how to split it into multiple segments and adapt it to flow around the sides of the car. (I also need to account for the unique features of each car model so that the flow looks realistic on each vehicle.) The second problem is the effect of tiny raindrops on the roof, hood, and bumper of the car (the generation of small droplets that gradually appear and disappear). The issue is that I’m trying to apply both effects in one shader, but the problem is that either only one of them works under certain settings, or nothing works at all. I can't get both effects to work harmoniously together. I’ll also provide an example of the Lua script and the textures used for the shader. I really hope for your help. I've been spending too much time on this, and I can't seem to find a solution. float4x4 gWorld : WORLD; float4x4 gView : VIEW; float4x4 gProjection : PROJECTION; float gTime : TIME; // Rain parameters float gDropSpeed = 0.03; // Speed of droplet flow float2 noiseScale = float2(0.2, 0.8); // Noise texture scale float3 lightDirection = float3(1.0, 1.0, -1.0); // Light direction float gDropSpread = 0.3; // Droplet spread float gDropDepth = 0.3; // Droplet depth texture gTexture; // Main car texture texture texRain; // Raindrop texture texture texNormalRain; // Raindrop normals texture texNoise; // Noise texture // Variables for controlling the effect float gAlpha = 0.01; // Alpha channel for the car float rainAlpha = 1.8; // Alpha channel for raindrops sampler2D gTextureSampler = sampler_state { Texture = ( gTexture ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; sampler2D texRainSampler = sampler_state { Texture = ( texRain ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; sampler2D texNormalRainSampler = sampler_state { Texture = ( texNormalRain ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; sampler2D texNoiseSampler = sampler_state { Texture = ( texNoise ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; struct VertexShaderInput { float4 Position : POSITION; // Using standard POSITION semantics for the vertex shader float2 TextureCoordinate : TEXCOORD0; // Passing texture coordinates }; struct PixelShaderInput { float4 Position : POSITION; // Passing position as float4 for proper operation float3 WorldPos : TEXCOORD1; // Passing world coordinates for calculations float2 TextureCoordinate : TEXCOORD0; // Passing texture coordinates }; PixelShaderInput VertexShaderFunction(VertexShaderInput input) { PixelShaderInput output; // Position in world coordinates float4 worldPos = mul(input.Position, gWorld); // Storing position for further projection output.Position = mul(mul(input.Position, gWorld), gView); output.Position = mul(output.Position, gProjection); // Applying projection // Storing world coordinates (for droplet flow) output.WorldPos = worldPos.xyz; // Passing texture coordinates output.TextureCoordinate = input.TextureCoordinate; return output; } float4 PixelShaderFunction(PixelShaderInput output) : COLOR0 { float2 textureCoordinate = output.TextureCoordinate; // Main car texture float4 baseColor = tex2D(gTextureSampler, textureCoordinate); baseColor.rgb = max(baseColor.rgb, 0.1); // Brightening dark areas // Getting noise for random movement float noise = tex2D(texNoiseSampler, textureCoordinate * noiseScale).r; // World coordinates to determine droplet direction float3 worldPos = output.WorldPos; // Using world coordinates // Determining droplet direction based on normals and world position float3 normal = normalize(output.WorldPos); // Normal to the surface // Checking direction by normals to determine which side of the car we're on if (abs(normal.x) > abs(normal.y) && abs(normal.x) > abs(normal.z)) { // Side surfaces textureCoordinate.y += gDropSpeed * gTime; // Flowing down the sides } else if (normal.y > 0.5) { // Top surface (roof) textureCoordinate.y -= gDropSpeed * gTime; // Droplets flow down } else { // Other sides (front and back) textureCoordinate.x -= gDropSpeed * gTime; // Optionally add droplet flow forward/backward } // Reducing random offset for more precise flow float2 offset = gDropSpread * (noise * 4.0 - 0.5) * float2(1.0, 2.5); // Using float2 for offset textureCoordinate -= offset; // Applying deviation in both axes // Raindrop texture float4 rainColor = tex2D(texRainSampler, textureCoordinate); // Adjusting droplets to the car color rainColor.rgb = baseColor.rgb * 0.8 + float3(0.1, 0.1, 0.1); // Adding body tint to droplets rainColor.a = rainAlpha; // Alpha channel of droplets // Normals for droplets float4 tempRainNormal = tex2D(texNormalRainSampler, textureCoordinate); // Explicitly using float4 float3 rainNormal = normalize(tempRainNormal.rgb * 2.5 - 0.75); // Normalizing normals // Lighting on droplets float diffuse = saturate(dot(normalize(rainNormal), normalize(lightDirection))); // Correct lighting // Combining colors float4 finalColor = lerp(baseColor, rainColor, rainAlpha * diffuse); finalColor.a = lerp(gAlpha, rainAlpha, diffuse * 0.9); // Adding droplet depth finalColor.rgb += gDropDepth * 0.9; // Depth effect of droplets float3 v = float3(0.0, 0.0, 0.0); float Tr2 = gTime * 11000.0; float2 n = tex2D(texNoiseSampler, textureCoordinate * 0.5).rg; for (float r = 4.0; r > 0.0; r--) // Reducing the number of iterations { float2 x = 2100.0 * r * 0.015; float2 p = 6.28 * textureCoordinate * x + (n - 0.5) * 2.0; float4 d = tex2D(texNoiseSampler, round(textureCoordinate * x - 0.25) / x); float t = (sin(p.x) + sin(p.y)) * max(0.0, 1.0 - frac(Tr2 * (d.b + 0.1) + d.g) * 2.0); if (d.r < (2.0 - r) * 0.08 && t > 0.5) { v += normalize(float3(-cos(p.x), lerp(1.2, 2.0, t - 0.5), 0.0)); } } finalColor.rgb += v * rainAlpha; return finalColor; } technique Replace { pass P0 { DepthBias = -0.0001; AlphaBlendEnable = TRUE; SrcBlend = SRCALPHA; DestBlend = INVSRCALPHA; VertexShader = compile vs_1_1 VertexShaderFunction(); PixelShader = compile ps_3_0 PixelShaderFunction(); } } LUA CODE: local shader = dxCreateShader("fx/shader.fx", 2, 300, true, "vehicle"); local zapylyayushiesyaDetali = { "remap_body", }; local rainTexture = dxCreateTexture("assets/RainCar.png") local normalRainTexture = dxCreateTexture("assets/RainNormal.png") local noiseTexture = dxCreateTexture("assets/enbnoise.png") dxSetShaderValue(shader, "texRain", rainTexture) dxSetShaderValue(shader, "texNormalRain", normalRainTexture) dxSetShaderValue(shader, "texNoise", noiseTexture) -- Применение шейдера к машине local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then --engineApplyShaderToWorldTexture(shader, "vehiclegrunge256", vehicle) for _, name in ipairs(zapylyayushiesyaDetali) do engineRemoveShaderFromWorldTexture(shader, name, localPlayer.vehicle) engineApplyShaderToWorldTexture(shader, name, localPlayer.vehicle) end end renderTarget = dxCreateRenderTarget(512, 512, true) addEventHandler("onClientRender", root, function() iprint(shader) if shader then if renderTarget then dxSetRenderTarget(renderTarget, true) dxDrawImage(0, 0, 512, 512, shader) dxSetRenderTarget() dxDrawImage(50, 50, 256, 256, renderTarget) end end end)
  2. Hello these days i made a pretty beginner handling panel but unfortunately i got stuck as i can't load my handling.who can help please thx [Im noob :(] Script: local hand1 = "#1 Drift" local hand2 = "#2 Drift" local hand3 = "#3 Drift" local hand4 = "#4 Drift" local hand5 = "#5 Drift" local hand6 = "#6 Drift" local hand7 = "#7 Drift" local hand8 = "#8 Drift" local hand9 = "#9 Drift" local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local Font = dxCreateFont("gfx/Roboto-Condensed.ttf", 13) ---<< Criando a fonte .. cor = {} function PainelDc() --1sor cor[1] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*460, y*320, x*100, y*30) then cor[1] = tocolor(255, 109, 0, 240) end cor[2] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*460, y*370, x*100, y*30) then cor[2] = tocolor(255, 109, 0, 240) end cor[3] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*460, y*420, x*100, y*30) then cor[3] = tocolor(255, 109, 0, 240) end --2sor cor[4] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*580, y*320, x*100, y*30) then cor[4] = tocolor(255, 109, 0, 240) end cor[5] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*580, y*370, x*100, y*30) then cor[5] = tocolor(255, 109, 0, 240) end cor[6] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*580, y*420, x*100, y*30) then cor[6] = tocolor(255, 109, 0, 240) end --3sor cor[7] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*700, y*320, x*100, y*30) then cor[7] = tocolor(255, 109, 0, 240) end cor[8] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*700, y*370, x*100, y*30) then cor[8] = tocolor(255, 109, 0, 240) end cor[9] = tocolor(0, 0, 0, 180) if isCursorOnElement(x*700, y*420, x*100, y*30) then cor[9] = tocolor(255, 109, 0, 240) end dxDrawRectangle(x*450, y*312, x*400, y*150, tocolor(0, 0, 0, 180), false) dxDrawRectangle(x*450, y*290, x*400, y*22, tocolor(255, 109, 0, 240), false) dxDrawText("M.D.SZ - Handling Panel", x*520, y*291, x*800, y*312, tocolor(255, 255, 255, 255), x*0.9, Font, "center", "center", false, false, false, false, false) dxDrawRectangle(x*460, y*320, x*100, y*30, cor[1], false)--gomb 1 dxDrawRectangle(x*460, y*370, x*100, y*30, cor[2], false)--gomb 2 dxDrawRectangle(x*460, y*420, x*100, y*30, cor[3], false)--gomb 3 dxDrawRectangle(x*580, y*320, x*100, y*30, cor[4], false)--gomb 2sor 4 dxDrawRectangle(x*580, y*370, x*100, y*30, cor[5], false)--gomb 2sor 5 dxDrawRectangle(x*580, y*420, x*100, y*30, cor[6], false)--gomb 2sor 6 dxDrawRectangle(x*700, y*320, x*100, y*30, cor[7], false)--gomb 3sor 7 dxDrawRectangle(x*700, y*370, x*100, y*30, cor[8], false)--gomb 3sor 8 dxDrawRectangle(x*700, y*420, x*100, y*30, cor[9], false)--gomb 3sor 9 dxDrawText("#1 Drift", x*200, y*358, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 1 dxDrawText("#2 Drift", x*200, y*460, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2 dxDrawText("#3 Drift", x*200, y*560, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 3 dxDrawText("#4 Drift", x*445, y*358, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1 dxDrawText("#5 Drift", x*445, y*460, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1 dxDrawText("#6 Drift", x*445, y*560, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1 dxDrawText("#7 Drift", x*690, y*358, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1 dxDrawText("#8 Drift", x*690, y*460, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1 dxDrawText("#9 Drift", x*690, y*560, x*820, y*312, tocolor(255, 255, 255, 255), x*1.00, Font, "center", "center", false, false, false, true, false)-- kiiras gombra 2sor 1 end Painelstt = false --<<<< Status do painel(PainelDc) function OpenPainel() --<<<<< Todo if significa == se for .. if Painelstt == false then --<<<< Verifica se o painel está fechado e logo após o abre e poe seu status como true(aberto) addEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = true showCursor(true) else --<<<< else(significa o contrario) se não for .. removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) end end addCommandHandler("hpan", OpenPainel) local handlings1 = "1300 2979.7 2 0 0.1 -0.8 70 0.6 0.66 0.66 5 150 25 10 4 p 5 0.66 false 75 0.85 0.15 0 0.15 -0.16 0.5 0 0.37 0 35000 A02800 730000C 1 1 0" --1 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*460, y*320, x*100, y*30) then setVehicleHandling (element "429", string "property", "..handlings1..") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand1.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --2 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*460, y*370, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand2.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --3 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*460, y*430, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand3.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --4 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*580, y*320, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand4.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --5 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*580, y*370, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand5.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --6 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*580, y*420, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand6.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --7 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*700, y*320, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand7.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --8 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*700, y*370, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand8.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) --9 function onClientButtonClick(Button, State) if Painelstt == true and Button == "left" and State == "down" then if isCursorOnElement(x*700, y*420, x*100, y*30) then setClipboard(""..hand2.."") outputChatBox("[#ff8f00Handling - Info#ffffff] #82f9fc"..hand9.." #ffffffHandling betöltve!", 255, 255, 255, true) removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) elseif isCursorOnElement(x*797, y*290, x*23, y*22) then removeEventHandler("onClientRender", getRootElement(), PainelDc) Painelstt = false showCursor(false) else end end end addEventHandler("onClientClick", getRootElement(), onClientButtonClick) function isCursorOnElement( posX, posY, width, height ) --<< Funçao que verifica a posiçao do Cursor (mouse) 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
  3. No errors / warnings in debugscript 3... then what wrong in this script? Client: requestBrowserDomains({"www.convertmp3.io"}) local browser = createBrowser( 1, 1, false ) local currentSound = {} addEvent( 'Play' , true ) addEventHandler( 'Play' , root , function( link ) local vehicle = getPedOccupiedVehicle ( source ) local x, y, z = getElementPosition(vehicle) currentSound[source] = playSound3D( link, x, y, z ) attachElements(currentSound[source],vehicle) setSoundMaxDistance(currentSound[source],30) setSoundVolume(currentSound[source],50) end ) function fetch(_,url) if url and url ~= "" then fetchRemote("http://www.convertmp3.io/fetch/?format=JSON&video="..url, callback) end end addCommandHandler("p",fetch) 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 outputChatBox("Title: "..data.title) outputChatBox("Length: "..data.length) outputChatBox("Link: "..data.link) loadBrowserURL( browser, data.link ) end end addEventHandler( "onClientBrowserNavigate", browser, function( link ) if not link:find("www.convertmp3.io") then triggerServerEvent( 'play' , localPlayer , link ) -- trigger the event when the script actially gets the playable link! end end ) server: addEvent( 'play' , true ) addEventHandler( 'play' , root , function( link ) triggerClientEvent( root , 'Play' , client , link ) end )
  4. QUAL O MELHOR SISTEMA PARA RODAR UM SERVIDOR DE MULTI THEFT AUTO? CONFIG DA VPS Localização do datacenter Beauharnois, Canadá VPS 2018 Cloud 3 RAM 8 GB Cores 4 Disco 100 GB
  5. 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
  6. Guest

    help me

    No errors no warning in debugscript I wan't only vips can spawn hydra by typing /cv 520 or /cv Hydra function onPlayerCommand ( cmd, thePlayer ) local p = {getElementPosition(source)} for _,vehicle in ipairs(getElementsByType("vehicle")) do if getElementModel(vehicle) == 520 then local v = {getElementPosition(vehicle)} if getDistanceBetweenPoints3D(p[1], p[2], p[3], v[1], v[2], v[3]) < 10 then destroyElement(vehicle) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then outputChatBox ( "● You must be VIP to spawn this vehicle", thePlayer, 255, 0, 0 ) end end end end end addEventHandler("onPlayerCommand", root, onPlayerCommand)
  7. please give me a license system for RPG server Player go to checkpoints and recive driving license Please fast give me ☺
  8. [2018-01-12 14:55:12] ERROR: Could not load /home/gameservers/mta/turbo1/x64/./dbconmy.so - /home/gameservers/mta/turbo1/x64/./dbconmy.so: symbol __cxa_pure_virtual, version libmysqlclient_16 not defined in file libmysqlclient.so.16 with link time reference[2018-01-12 14:55:12] ERROR: san_mysql/server.lua:19: dbConnect failed; Could not connect [2018-01-12 14:55:12] INFO: [mysql]: Sikertelen MYSQL csatlakozás! please help me, how to fix this?
  9. Hi Everyone! Can someone help me, how can I make that, if a fire is created it outputs the chatbox the fire's position (example: "The LSPD is on fire" or "The Hospital is on fire" . The Script Files: FireC.lua local fireElement = {} addEvent("FireServer.rootFireCreate",true) addEventHandler("FireServer.rootFireCreate",getRootElement(),function(rand) local fire = createFire(FirePositions[rand][1], FirePositions[rand][2], FirePositions[rand][3], FirePositions[rand][4], FirePositions[rand][5], FirePositions[rand][6]) fireElement[#fireElement + 1] = fire end) addEventHandler ("onClientResourceStart", getRootElement(), function (res) if res ~= getThisResource() then return end triggerServerEvent("FireServer.loadMe", localPlayer, localPlayer) end) function draw() for k,v in ipairs(getElementsByType("object")) do if getElementData(v, "Fire->object") then local x, y ,z = getElementPosition(v) local wx, wy, wz = getScreenFromWorldPosition(x , y, z+1) if wx and wy then local playerx, playery, playerz = getElementPosition(getLocalPlayer()) if getDistanceBetweenPoints3D(playerx, playery, playerz, wx, wy, wz) <= 5 then dxDrawRectangle(wx-200/2,wy,200,30,tocolor(0,0,0,255/2)) dxDrawRectangle(wx-200/2+5,wy+5,190,20,tocolor(124, 197, 118,255/2)) end end end end end addEventHandler("onClientRender", root, draw) FireG.lua FirePositions = { -- X, Y, Z, Range(FireSize) [1] = {2114.1240234375, -1756.2508544922, 13.3984375, 800}, } FireS.lua local loadedPlayers = {} local fireBar = {} FireServer = {} function FireServer.start(player) loadedPlayers[#loadedPlayers + 1] = player end addEvent("FireServer.loadMe", true) addEventHandler("FireServer.loadMe", root, FireServer.start) function FireServer.FireCreate() if math.random(1, 3) == 2 then local rand = math.random(#FirePositions) if fireBar[rand] then return end for k,v in pairs(loadedPlayers) do triggerClientEvent(v, "FireServer.rootFireCreate", v, rand) fireBar[rand] = createObject(1337, FirePositions[rand][1], FirePositions[rand][2], FirePositions[rand][3] - 1) setElementAlpha(fireBar[rand], 0) setElementCollisionsEnabled(fireBar[rand], false) setElementData(fireBar[rand], "Fire->object", true) end end end setTimer(FireServer.FireCreate, 1000, 0)
  10. Hi everyone! Can someone help me that, if I click on specified object, then run a function named "startit1"
  11. local screenWidth, screenHeight = guiGetScreenSize() GUIEditor = { button = {} } addEventHandler("onClientResourceStart", resourceRoot, function showgui() if (vehicle) then GUIEditor.button[1] = guiCreateButton(981, 627, 39, 40, "1", false) guiSetAlpha(GUIEditor.button[1], 0.00) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF") GUIEditor.button[2] = guiCreateButton(1025, 627, 39, 40, "2", false) guiSetAlpha(GUIEditor.button[2], 0.00) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFFFFFF") GUIEditor.button[3] = guiCreateButton(981, 673, 39, 40, "4", false) guiSetAlpha(GUIEditor.button[3], 0.00) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFFFFFF") GUIEditor.button[4] = guiCreateButton(1025, 673, 39, 40, "5", false) guiSetAlpha(GUIEditor.button[4], 0.00) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFFFFFF") GUIEditor.button[5] = guiCreateButton(1069, 673, 39, 40, "6", false) guiSetAlpha(GUIEditor.button[5], 0.00) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFFFFFF") GUIEditor.button[6] = guiCreateButton(1069, 719, 39, 40, "9", false) guiSetAlpha(GUIEditor.button[6], 0.00) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFFFFFF") GUIEditor.button[7] = guiCreateButton(1025, 719, 39, 40, "8", false) guiSetAlpha(GUIEditor.button[7], 0.00) guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFFFFFFF") GUIEditor.button[8] = guiCreateButton(981, 719, 39, 40, "7", false) guiSetAlpha(GUIEditor.button[8], 0.00) guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFFFFFFF") GUIEditor.button[9] = guiCreateButton(1025, 765, 39, 40, "0", false) guiSetAlpha(GUIEditor.button[9], 0.00) guiSetProperty(GUIEditor.button[9], "NormalTextColour", "FFFFFFFF") GUIEditor.button[10] = guiCreateButton(892, 573, 39, 40, "CLEAR", false) guiSetAlpha(GUIEditor.button[10], 0.00) guiSetProperty(GUIEditor.button[10], "NormalTextColour", "FFF70000") GUIEditor.button[11] = guiCreateButton(892, 627, 39, 40, "DEMO", false) guiSetAlpha(GUIEditor.button[11], 0.00) guiSetProperty(GUIEditor.button[11], "NormalTextColour", "FF66F92C") GUIEditor.button[12] = guiCreateButton(892, 673, 39, 40, "AM", false) guiSetAlpha(GUIEditor.button[12], 0.00) guiSetProperty(GUIEditor.button[12], "NormalTextColour", "FFE7E53D") GUIEditor.button[13] = guiCreateButton(892, 719, 39, 40, "PM", false) guiSetAlpha(GUIEditor.button[13], 0.00) guiSetProperty(GUIEditor.button[13], "NormalTextColour", "FF8D9096") GUIEditor.button[14] = guiCreateButton(892, 765, 39, 40, "ENTER", false) guiSetAlpha(GUIEditor.button[14], 0.00) guiSetProperty(GUIEditor.button[14], "NormalTextColour", "FF3F4145") GUIEditor.button[15] = guiCreateButton(981, 765, 39, 40, "-", false) guiSetAlpha(GUIEditor.button[15], 0.27) guiSetProperty(GUIEditor.button[15], "NormalTextColour", "FFFFFFFF") GUIEditor.button[16] = guiCreateButton(1069, 627, 39, 40, "3", false) guiSetAlpha(GUIEditor.button[16], 0.00) guiSetProperty(GUIEditor.button[16], "NormalTextColour", "FFFFFFFF") GUIEditor.edit[1] = guiCreateEdit(951, 575, 192, 32, "MM-DD-YYYY-HH-MM-AMPM", false) guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FF000100") guiEditSetMaxLength ( GUIEditor.edit[1], 21 ) end ) local dxfont0_BTTF = dxCreateFont("fonts/BTTF.ttf", 10) addEventHandler("onClientRender", root, function showgui() if (vehicle) then dxDrawImage(444, 559, 433, 269, "images/time_circuits.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("By: CsaliHUN", 745 - 1, 810 - 1, 873 - 1, 828 - 1, tocolor(0, 0, 0, 255), 1.00, dxfont0_BTTF, "center", "center", false, false, false, false, false) dxDrawText("By: CsaliHUN", 745 + 1, 810 - 1, 873 + 1, 828 - 1, tocolor(0, 0, 0, 255), 1.00, dxfont0_BTTF, "center", "center", false, false, false, false, false) dxDrawText("By: CsaliHUN", 745 - 1, 810 + 1, 873 - 1, 828 + 1, tocolor(0, 0, 0, 255), 1.00, dxfont0_BTTF, "center", "center", false, false, false, false, false) dxDrawText("By: CsaliHUN", 745 + 1, 810 + 1, 873 + 1, 828 + 1, tocolor(0, 0, 0, 255), 1.00, dxfont0_BTTF, "center", "center", false, false, false, false, false) dxDrawText("By: CsaliHUN", 745, 810, 873, 828, tocolor(246, 92, 8, 255), 1.00, dxfont0_BTTF, "center", "center", false, false, false, false, false) dxDrawImage(878, 557, 275, 271, "images/buttons.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("", 951, 575, 1143, 607, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end ) addEventHandler ( "onClientGUIClick", GUIEditor.button[16], outputEditBox, false ) function outputEditBox ( button ) if button == "left" then local text = guiGetText ( GUIEditor.edit[1] ) outputChatBox("Uticél beállítva:",player,255,69,0) outputChatBox (( text ),player,255,69,0) outputChatBox("Érd el a 88 km/h sebességet az utazáshoz!",player,255,69,0) end end addEventHandler("onClientRender", root, showgui) addCommandHandler ( "bttf", showgui ) function HandleTheRendering ( ) addEventHandler("onClientRender", root, renderDisplay) end addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) SORRY FOR BAD ENGLISH Please help me, I made a GUI, that needs to show on when I enter a Tampa , but it didn't show on. And also can someone help me to make that if i click on a button it will write something to an edit box, then if i click on an other button it will send it to local chat. ((The buttons alpha = 0 because there's a picture behind them))
  12. Hey, is there a function or something to remove the color code of me, and change RGB?
×
×
  • Create New...