-
Posts
35 -
Joined
-
Last visited
About Looktovask
- Birthday 04/01/1993
Details
-
Location
Brasil
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Looktovask's Achievements
Rat (9/54)
6
Reputation
-
thank you!
-
I am unable to update the elementdata of the generator marker when calling the serverEvent LigarGerador or DesligarGerador. local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() if getElementData( localPlayer, "AbrirGerador" ) == true then local generatorID = getElementData( localPlayer, "generatorID") local currentFuelLevel = getElementData( localPlayer, "currentFuelLevel") local fuelLevel = getElementData( localPlayer, "fuelLevel") local maxFuelLevel = getElementData( localPlayer, "maxFuelLevel") local Estado = EstadoMotor( generatorID ) dxDrawImage(screenW * 0.4103, screenH * 0.4401, screenW * 0.0235, screenH * 0.2734, ":[Looktovask]RevendaCarros/imagens/cube.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Combustivel:", 412, 459, 548, 491, tocolor(255, 255, 255, 255), 1.00, "default", "right", "bottom", false, false, false, false, false) --progress gasolina local imageWidth = screenW * 0.0147 local maxHeight = screenH * 0.2617 local imageHeight = maxHeight * fuelLevel / maxFuelLevel dxDrawImage(screenW * 0.4147, screenH * 0.4453 + maxHeight - imageHeight, imageWidth, imageHeight, ":[Looktovask]RevendaCarros/imagens/cube.png", 0, 0, 0, tocolor(195, 181, 32, 206), false) if Estado == true then r,g,b = 74, 255, 80 dxDrawText("Desligar", screenW * 0.3206, screenH * 0.6602, screenW * 0.3963, screenH * 0.7018, tocolor(255, 255, 255, 255), 1.00, "arial", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.3132, screenH * 0.6471, screenW * 0.0941, screenH * 0.0664, ":[Looktovask]RevendaCarros/imagens/cube.png", 0, 0, 0, tocolor(r, g, b, 217), false) elseif Estado == false then r,g,b = 147, 74, 60 dxDrawText("Ligar", screenW * 0.3206, screenH * 0.6602, screenW * 0.3963, screenH * 0.7018, tocolor(255, 255, 255, 255), 1.00, "arial", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.3132, screenH * 0.6471, screenW * 0.0941, screenH * 0.0664, ":[Looktovask]RevendaCarros/imagens/cube.png", 0, 0, 0, tocolor(r, g, b, 217), false) end end end ) function AbrirGeradorM( generatorID, currentFuelLevel, fuelLevel, maxFuelLevel, state, x, y, z ) setElementData( localPlayer, "generatorID", generatorID ) setElementData( localPlayer, "currentFuelLevel", currentFuelLevel ) setElementData( localPlayer, "fuelLevel", fuelLevel ) setElementData( localPlayer, "maxFuelLevel", maxFuelLevel ) setElementData(localPlayer, "x", x) setElementData(localPlayer, "y", y) setElementData(localPlayer, "z", z) setElementData( localPlayer, "AbrirGerador", true ) end addEvent( "AbrirGerador", true ) addEventHandler( "AbrirGerador", root, AbrirGeradorM ) function fecharGeradorM( generatorID, currentFuelLevel, fuelLevel, maxFuelLevel, state ) setElementData( localPlayer, "AbrirGerador", false ) end addEvent( "fecharGerador", true ) addEventHandler( "fecharGerador", root, fecharGeradorM ) -- clique addEventHandler( "onClientClick", root, function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) if button == "left" then if state == "down" then if getElementData( localPlayer, "AbrirGerador" ) == true then if isCursorOnElement(screenW * 0.3206, screenH * 0.6602, screenW * 0.3963, screenH * 0.7018) then local state = getElementData( localPlayer, "state") local x = getElementData(localPlayer, "x") local y = getElementData(localPlayer, "y") local z = getElementData(localPlayer, "z") local id = getElementData( localPlayer, "generatorID" ) if EstadoMotor( id ) == true then triggerServerEvent( "desligarGerador", resourceRoot, localPlayer, generatorID ) elseif EstadoMotor( id ) == false then playSound3D( "start.mp3", x, y, z ) triggerServerEvent( "ligarGerador", resourceRoot, localPlayer, generatorID ) end end end end end end) ---- Função Mouse ---- local x,y = guiGetScreenSize() function isCursorOnElement(x, y, w, h) if (not isCursorShowing()) then return false end local mx, my = getCursorPosition() local fullx, fully = guiGetScreenSize() cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end addEventHandler("onClientElementDataChange", root, function(dataName, oldValue) if (getElementData(source, "generatorID")) then if (dataName == "state") then if getElementData(source, "state") == true then local x,y,z = getElementPosition(source) local soundidle = playSound3D("idle.mp3", x, y, z, true) else destroyElement( soundidle ) end end end end) function EstadoMotor( generatorID ) local markers = getElementsByType("marker") for i, marker in ipairs(markers) do local id = getElementData(marker, "generatorID") if id == generatorID then estadomotor = getElementData( marker, "state" ) return estadomotor end end end server: -- Crie uma tabela contendo as informações de cada gerador local geradores = { {id = 1, fuelLevel = 50, maxFuelLevel = 200, state = false, position = {2397.336, -2472.24, 12.8}}, {id = 2, fuelLevel = 50, maxFuelLevel = 200, state = false, position = {150, 250, 10}}, {id = 3, fuelLevel = 50, maxFuelLevel = 200, state = false, position = {200, 300, 10}}, } -- Crie os marcadores para cada gerador na tabela for _, gerador in ipairs(geradores) do local marker = createMarker(gerador.position[1], gerador.position[2], gerador.position[3], "cylinder", 1, 255, 0, 0, 20) setElementData(marker, "generatorID", gerador.id) setElementData(marker, "fuelLevel", gerador.fuelLevel) setElementData(marker, "maxFuelLevel", gerador.maxFuelLevel) setElementData(marker, "state", gerador.state) end addEventHandler("onPlayerMarkerHit", root, function (markerHit, matchingDimension) local generatorID = getElementData(markerHit, "generatorID") local fuelLevel = getElementData(markerHit, "fuelLevel") local maxFuelLevel = getElementData(markerHit, "maxFuelLevel") local state = getElementData(markerHit, "state") local x,y,z = getElementPosition( markerHit ) triggerClientEvent(source, "AbrirGerador", root, generatorID, currentFuelLevel, fuelLevel, maxFuelLevel, state, x, y, z ) end) addEventHandler("onPlayerMarkerLeave", root, function (markerLeft, matchingDimension) local generatorID = getElementData(markerLeft, "generatorID") triggerClientEvent(source, "fecharGerador", root, generatorID) end) function desligarGeradorS( player, generatorID ) local markers = getElementsByType("marker") for i, marker in ipairs(markers) do local id = getElementData(marker, "generatorID") if id == generatorID then setElementData(marker, "state", false) end end end addEvent( "desligarGerador", true ) addEventHandler( "desligarGerador", root, desligarGeradorS ) function ligarGeradorS( player, generatorID ) local markers = getElementsByType("marker") for i, marker in ipairs(markers) do local id = getElementData(marker, "generatorID") if id == generatorID then setElementData(marker, "state", true) end end end addEvent( "ligarGerador", true ) addEventHandler( "ligarGerador", root, ligarGeradorS )
-
function PuxarTodosPlayers( playerSource, commandName ) for _,player in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition( playerSource ) setElementPosition( player, x, y, z ) end end addCommandHandler( "puxartodos", PuxarTodosPlayers )
-
addEventHandler( "onPlayerDamage", root, function (attacker, damage_causing, bodypart, loss) local Vida = getElementHealth( source ) local Dinheiro = getPlayerMoney( source ) local DinheiroRemover = 500 -- quantidade a remover local QntdVidaMin = 80 -- quantidade minima para começar a remover dinheiro if Vida < QntdVidaMin then takePlayerMoney( source, Dinheiro-DinheiroRemover ) end end)
-
addEventHandler( "onPlayerDamage", root, function (attacker, damage_causing, bodypart, loss) local Dano = damage_causing local Dinheiro = getPlayerMoney( source ) local Multiplicador = 2 takePlayerMoney( source, Dinheiro-Dano*Multiplicador ) end) não testei, deve ser adicionado num script server side, ele pega quanto tem de dinheiro, quanto de dano foi feito, multiplica o dano e remove este valor de dinheiro do player
-
baixa o painel de handling e edita do jeito que vc gostar mais
-
Boa tarde, estou com um problema com sqlite, ele salva os veículos quando é comprado e a posição atualiza assim que desligo o resouce, porem se nessa partida eu comprar um carro ele não salva a posição só nas vezes que não compro nenhum carro, só mexo os que já existem. segue o código server --[[ __ __ __ __ /\ \ /\ \ /\ \__ /\ \ \ \ \ ___ ___\ \ \/'\\ \ ,_\ ___ __ __ __ ____\ \ \/'\ \ \ \ __ / __`\ / __`\ \ , < \ \ \/ / __`\/\ \/\ \ /'__`\ /',__\\ \ , < \ \ \L\ \/\ \L\ \/\ \L\ \ \ \\`\\ \ \_/\ \L\ \ \ \_/ |/\ \L\.\_/\__, `\\ \ \\`\ \ \____/\ \____/\ \____/\ \_\ \_\ \__\ \____/\ \___/ \ \__/.\_\/\____/ \ \_\ \_\ \/___/ \/___/ \/___/ \/_/\/_/\/__/\/___/ \/__/ \/__/\/_/\/___/ \/_/\/_/ --]] local db function CarregarCarros( queryHandle ) local carrospawnar = dbPoll( queryHandle, 0 ) for i, v in pairs(carrospawnar) do CarroRespawn = createVehicle( v["ModeloC"], v["PosX"], v["PosY"], v["PosZ"] , v["RotX"], v["RotY"], v["RotZ"]) setVehicleColor( CarroRespawn, v["Cor1"], v["Cor2"], v["Cor3"], v["Cor4"]) setElementHealth ( CarroRespawn, v["Dano"] ) setVehicleVariant( CarroRespawn , v["V1"], v["V2"] ) setVehiclePaintjob( CarroRespawn, v["Paintjob"] ) setVehiclePanelState( CarroRespawn, 5, v["ParachoqueD"] ) setVehiclePanelState( CarroRespawn, 6, v["ParachoqueT"] ) setVehiclePanelState( CarroRespawn, 4, v["Parabrisa"] ) setElementData(CarroRespawn, "ownercar", v["NomeDono"]) setElementData(CarroRespawn, "Owner", v["IDdono"]) end end addEventHandler( "onResourceStart", resourceRoot, function (startedResource) db = dbConnect( "sqlite", "carros.db" ) dbExec(db, "CREATE TABLE IF NOT EXISTS carros (IDdono, NomeDono, ModeloC, Cor1, Cor2, Cor3, Cor4, Paintjob, PosX, PosY, PosZ, RotX, RotY, RotZ, Dano, ParachoqueD, ParachoqueT, Parabrisa, V1, V2 )") dbQuery( CarregarCarros , db , "SELECT * FROM carros" ) for i,v in ipairs (VagasMotos) do local Vehmotos =createVehicle( ModeloMoto[math.random(1, #ModeloMoto)], v[1], v[2], v[3], v[4], v[5], v[6] ) setElementHealth ( Vehmotos, math.random(600,950) ) setElementData( Vehmotos, "MotoRevenda", true ) setVehicleDamageProof ( Vehmotos, true ) setTimer(function() setElementFrozen( Vehmotos, true ) end,2000,1) end for i,v in ipairs (VagasCarrosRuins) do local Veh:~box = createVehicle( ModeloCarroRuins[math.random(1, #ModeloCarroRuins)], v[1], v[2], v[3], v[4], v[5], v[6] ) setElementHealth ( Veh:~box, math.random(600,950) ) setVehiclePanelState ( Veh:~box, 4, math.random(0,2) ) setVehiclePanelState ( Veh:~box, math.random(5,6), math.random(0,2) ) setElementData( Veh:~box, "CarroRevenda", true ) setVehicleDamageProof ( Veh:~box, true ) setTimer(function() setElementFrozen( Veh:~box, true ) end,2000,1) end for i,v in ipairs (VagasCaminhao) do local VehTruck = createVehicle( ModeloCaminhao[math.random(1, #ModeloCaminhao)], v[1], v[2], v[3], v[4], v[5], v[6] ) setElementHealth ( VehTruck, math.random(600,950) ) setVehiclePanelState ( VehTruck, 4, math.random(0,2) ) setVehiclePanelState ( VehTruck, math.random(5,6), math.random(0,2) ) setElementData( VehTruck, "CaminhaoRevenda", true ) setVehicleDamageProof ( VehTruck, true ) setTimer(function() setElementFrozen( VehTruck, true ) end,2000,1) end end) addEventHandler( "onPlayerVehicleEnter", root, function (theVehicle, seat, jacked) if getElementData( theVehicle, "MotoRevenda") == true then local IDCarro = getElementID( theVehicle ) triggerClientEvent ( "Mostrarhud", resourceRoot ) setElementFrozen( theVehicle, true ) end if getElementData( theVehicle, "CarroRevenda") == true then local IDCarro = getElementID( theVehicle ) triggerClientEvent ( "Mostrarhud", resourceRoot ) setElementFrozen( theVehicle, true ) end if getElementData( theVehicle, "CaminhaoRevenda") == true then local IDCarro = getElementID( theVehicle ) triggerClientEvent ( "Mostrarhud", resourceRoot ) setElementFrozen( theVehicle, true ) end end) addEventHandler( "onVehicleExit", root, function (thePlayer, seat, jacker, forcedByScript) if getElementData( source, "MotoRevenda") == true then local MotoOFF = (source) triggerClientEvent ( "Esconderhud", resourceRoot ) setTimer(function() setVehicleEngineState( MotoOFF, false ) end,10000,1) end if getElementData( source, "CarroRevenda") == true then local CarroOFF = (source) triggerClientEvent ( "Esconderhud", resourceRoot ) setTimer(function() setVehicleEngineState( CarroOFF, false ) end,10000,1) end if getElementData( source, "CaminhaoRevenda") == true then local CaminOFF = (source) triggerClientEvent ( "Esconderhud", resourceRoot ) setTimer(function() setVehicleEngineState( CaminOFF, false ) end,10000,1) end if getElementData( source, "TestDriving") == true then local veiculoarmazenado = (source) setTimer(function() destroyElement( veiculoarmazenado ) outputChatBox( "A Revenda pegou o carrro" ) end,3000,1) end end) function TestarVeiculo() local CarroAcopiar = getPedOccupiedVehicle( client ) local IDcarroCopiar = getElementModel( CarroAcopiar ) local C1, C2, C3, C4 = getVehicleColor( CarroAcopiar , false) local Vidacarro = getElementHealth( CarroAcopiar ) local ParachoqueD = getVehiclePanelState( CarroAcopiar, 5 ) local ParachoqueT = getVehiclePanelState( CarroAcopiar, 6 ) local Parabrisa = getVehiclePanelState( CarroAcopiar, 4 ) local Paintjob = getVehiclePaintjob( CarroAcopiar ) local V1, V2 = getVehicleVariant ( CarroAcopiar ) local CopiaCarroTesteDriver = createVehicle( IDcarroCopiar, 2124.699, -1130.406, 26.56 , 0, 0, 358.863 ) setVehiclePaintjob( CopiaCarroTesteDriver, Paintjob ) setVehicleVariant( CopiaCarroTesteDriver , V1, V2 ) setVehicleColor(CopiaCarroTesteDriver , C1, C2, C3, C4 ) setVehiclePanelState( CopiaCarroTesteDriver, 5, ParachoqueD ) setVehiclePanelState( CopiaCarroTesteDriver, 6, ParachoqueT ) setVehiclePanelState( CopiaCarroTesteDriver, 4, Parabrisa ) setElementHealth( CopiaCarroTesteDriver, Vidacarro ) triggerClientEvent ( "Esconderhud", resourceRoot ) warpPedIntoVehicle( client, CopiaCarroTesteDriver ) setVehicleEngineState( CarroAcopiar, false ) setVehicleOverrideLights ( CarroAcopiar, 1 ) outputChatBox( "Test Drive 1 Minuto de duração" ) setElementData( CopiaCarroTesteDriver, "TestDriving", true ) setVehicleDamageProof ( CopiaCarroTesteDriver, true ) setTimer(function() if isElement ( CopiaCarroTesteDriver ) then destroyElement( CopiaCarroTesteDriver ) outputChatBox( "A Revenda pegou o carrro" ) end end,60000,1) end addEvent( "TestDrive", true ) addEventHandler( "TestDrive", resourceRoot, TestarVeiculo ) function ComprarVeiculoUsado() local CarroAcopiar = getPedOccupiedVehicle( client ) local IDcarroCopiar = getElementModel( CarroAcopiar ) local C1, C2, C3, C4 = getVehicleColor( CarroAcopiar , false) local Vidacarro = getElementHealth( CarroAcopiar ) local ParachoqueD = getVehiclePanelState( CarroAcopiar, 5 ) local ParachoqueT = getVehiclePanelState( CarroAcopiar, 6 ) local Parabrisa = getVehiclePanelState( CarroAcopiar, 4 ) local Paintjob = getVehiclePaintjob( CarroAcopiar ) local V1, V2 = getVehicleVariant ( CarroAcopiar ) local CarroComprado = createVehicle( IDcarroCopiar, 2124.699, -1130.406, 26.56 , 0, 0, 358.863 ) local X1, Y1, Z1 = getElementPosition( CarroComprado ) local RX1, RY1, RZ1 = getElementRotation( CarroComprado ) setVehicleVariant( CarroComprado , V1, V2 ) setVehiclePaintjob( CarroComprado, Paintjob ) setVehicleColor(CarroComprado , C1, C2, C3, C4 ) setVehiclePanelState( CarroComprado, 5, ParachoqueD ) setVehiclePanelState( CarroComprado, 6, ParachoqueT ) setVehiclePanelState( CarroComprado, 4, Parabrisa ) setElementHealth( CarroComprado, Vidacarro ) triggerClientEvent ( "Esconderhud", resourceRoot ) warpPedIntoVehicle( client, CarroComprado ) setVehicleEngineState( CarroAcopiar, false ) setVehicleOverrideLights ( CarroAcopiar, 1 ) setElementData(CarroComprado, "ownercar", getAccountName(getPlayerAccount(client))) setElementData(CarroComprado, "Owner", client) setElementData(client, "IDValido", IDcarroCopiar) dbExec(db, "INSERT INTO carros VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )", getAccountID( getPlayerAccount(client) ), getAccountName(getPlayerAccount(client)), IDcarroCopiar, C1, C2, C3, C4, Paintjob, X1, Y1, Z1, RX1, RY1, RZ1, Vidacarro, ParachoqueD, ParachoqueT, Parabrisa, V1, V2 ) local x, y, z = getElementPosition( CarroAcopiar ) local rx, ry, rz = getElementRotation( CarroAcopiar ) if getElementData( CarroAcopiar, "MotoRevenda") then destroyElement( CarroAcopiar ) local RespawnarMoto = createVehicle( ModeloMoto[math.random(1, #ModeloMoto)], x, y, z, rx, ry, rz ) setElementHealth ( RespawnarMoto, math.random(600,950) ) setElementData( RespawnarMoto, "MotoRevenda", true ) setVehicleDamageProof ( RespawnarMoto, true ) setTimer(function() if isElement(RespawnarMoto) then setElementFrozen( RespawnarMoto, true ) end end,2000,1) elseif getElementData( CarroAcopiar, "CarroRevenda") then destroyElement( CarroAcopiar ) local RespawnarCarro = createVehicle( ModeloCarroRuins[math.random(1, #ModeloCarroRuins)], x, y, z, rx, ry, rz ) setElementHealth ( RespawnarCarro, math.random(600,950) ) setVehiclePanelState ( RespawnarCarro, 4, math.random(0,2) ) setVehiclePanelState ( RespawnarCarro, math.random(5,6), math.random(0,2) ) setElementData( RespawnarCarro, "CarroRevenda", true ) setVehicleDamageProof ( RespawnarCarro, true ) setTimer(function() if isElement(RespawnarCarro) then setElementFrozen( RespawnarCarro, true ) end end,2000,1) elseif getElementData( CarroAcopiar, "CaminhaoRevenda") then destroyElement( CarroAcopiar ) local RespawnarCaminhao = createVehicle( ModeloCaminhao[math.random(1, #ModeloCaminhao)], x, y, z, rx, ry, rz ) setElementHealth ( RespawnarCaminhao, math.random(600,950) ) setVehiclePanelState ( RespawnarCaminhao, 4, math.random(0,2) ) setVehiclePanelState ( RespawnarCaminhao, math.random(5,6), math.random(0,2) ) setElementData( RespawnarCaminhao, "CaminhaoRevenda", true ) setVehicleDamageProof ( RespawnarCaminhao, true ) setTimer(function() if isElement(RespawnarCaminhao) then setElementFrozen( RespawnarCaminhao, true ) end end,2000,1) end end addEvent( "ComprarCarro", true ) addEventHandler( "ComprarCarro", resourceRoot, ComprarVeiculoUsado ) addEventHandler( "onResourceStop", resourceRoot, function (stoppedResource, resourceRoot) for i, v in ipairs (getElementsByType("vehicle")) do local X, Y, Z = getElementPosition( v ) local ROTX, ROTY, ROTZ = getElementRotation( v ) local C11, C22, C33, C44 = getVehicleColor( v , false) local Vvidacarro = getElementHealth( v ) local PParachoqued = getVehiclePanelState( v, 5 ) local PParachoquet = getVehiclePanelState( v, 6 ) local pparabrisa = getVehiclePanelState( v, 4 ) local ppaintjob = getVehiclePaintjob( v ) local Va1, Va2 = getVehicleVariant ( v ) dbExec(db, "UPDATE carros SET PosX = ?, PosY = ?, PosZ = ?, RotX = ?, RotY = ?, RotZ = ?, Cor1 = ?, Cor2 = ?, Cor3 = ?, Cor4 = ?, Dano = ?, ParachoqueD = ?, ParachoqueT = ?, Parabrisa = ?, Paintjob = ?, V1 = ?, V2 = ? WHERE IDdono = ? AND NomeDono = ? AND ModeloC = ? ", X, Y, Z, ROTX, ROTY, ROTZ, C11, C22, C33, C44, Vvidacarro, PParachoqued, PParachoquet, pparabrisa, ppaintjob, Va1, Va2, (getElementData( v, "Owner" )), (getElementData( v, "ownercar" )), (getElementModel( v )) ) end end)
-
onClientPlayerVoiceStart onClientPlayerVoiceStop podes usar esses eventos para fazer a função do icone DX
-
setVehicleColor( Veiculo, r, g, b ) acredito que seria com essa função, especificando o veiculo e depois a cor em rgb
-
i got another ploblem, the markethit dont detect player in server --[[ __ __ __ __ /\ \ /\ \ /\ \__ /\ \ \ \ \ ___ ___\ \ \/'\\ \ ,_\ ___ __ __ __ ____\ \ \/'\ \ \ \ __ / __`\ / __`\ \ , < \ \ \/ / __`\/\ \/\ \ /'__`\ /',__\\ \ , < \ \ \L\ \/\ \L\ \/\ \L\ \ \ \\`\\ \ \_/\ \L\ \ \ \_/ |/\ \L\.\_/\__, `\\ \ \\`\ \ \____/\ \____/\ \____/\ \_\ \_\ \__\ \____/\ \___/ \ \__/.\_\/\____/ \ \_\ \_\ \/___/ \/___/ \/___/ \/_/\/_/\/__/\/___/ \/__/ \/__/\/_/\/___/ \/_/\/_/ --]] MarkerInicio = createMarker(238.088, 73.331, 1004 ,"cylinder", 1, 0, 56, 255, 100 ) setElementInterior( MarkerInicio , 6 ) setElementVisibleTo( MarkerInicio, root, false ) function CompraPorte() setPlayerMoney( client, getPlayerMoney(client)-30000 ) setElementVisibleTo( MarkerInicio, client, true ) end addEvent( "ComproPorte", true ) addEventHandler( "ComproPorte", root, CompraPorte ) function MarkerHIT(hitElement, matchingDimension) setElementVisibleTo( MarkerInicio, hitElement, false ) setAccountData( hitElement, "Porte1", true ) triggerClientEvent( "Conversar", player ) end addEventHandler( "onMarkerHit", MarkerInicio, MarkerHIT )
-
really haha, I ended up not paying attention to this because I was pretty tired of the script already, thank you
-
i cant make ped imortal in this script --[[ __ __ __ __ /\ \ /\ \ /\ \__ /\ \ \ \ \ ___ ___\ \ \/'\\ \ ,_\ ___ __ __ __ ____\ \ \/'\ \ \ \ __ / __`\ / __`\ \ , < \ \ \/ / __`\/\ \/\ \ /'__`\ /',__\\ \ , < \ \ \L\ \/\ \L\ \/\ \L\ \ \ \\`\\ \ \_/\ \L\ \ \ \_/ |/\ \L\.\_/\__, `\\ \ \\`\ \ \____/\ \____/\ \____/\ \_\ \_\ \__\ \____/\ \___/ \ \__/.\_\/\____/ \ \_\ \_\ \/___/ \/___/ \/___/ \/_/\/_/\/__/\/___/ \/__/ \/__/\/_/\/___/ \/_/\/_/ --]] local AmmuEntrada = createMarker( 1367.837, -1279.836, 12 ,"cylinder", 1.5, 255, 0, 0, 170 ) local AmmuSaida = createMarker( 315.8203125,-143.3, 1000 -1.6 ,"cylinder", 1.2, 255, 0, 0, 170 ) local Vendedor = createPed( 179, 308.36, -143.3 , 999.602 , 0 ) local Vendedor1 = createPed( 179, 316.48, -133.333, 999.602 , 90 ) local MenuComprar = createMarker( 308.36, -141.14, 998.4 ,"cylinder", 1, 0, 56, 255, 170 ) local MenuComprar1 = createMarker( 313.734, -133.333, 998.4 ,"cylinder", 1, 0, 56, 255, 170 ) setPedAnimation(Vendedor, "dealer", "dealer_idle") setPedAnimation(Vendedor1, "ped", "idle_armed") givePedWeapon( Vendedor1, 33, 30, true ) createBlipAttachedTo( AmmuEntrada, 6 ) setElementInterior( AmmuSaida , 7 ) setElementInterior( Vendedor, 7 ) setElementInterior( Vendedor1, 7 ) setElementInterior( MenuComprar, 7 ) setElementInterior( MenuComprar1, 7 ) local menuAmmu = false local menuAmmu1 = false --cancelar danos NPC addEventHandler( "onClientPlayerStealthKill", root, function (targetPlayer) if targetPlayer == vendedor then cancelEvent() elseif targetPlayer == vendedor1 then cancelEvent() end end) addEventHandler( "onClientPedDamage", root, function (attacker, weapon, bodypart, loss) if source == vendedor then cancelEvent() elseif source == vendedor1 then cancelEvent() end end) addEventHandler( "onClientPedWasted", root, function (killer, weapon, bodypart, loss, stealth) if source == vendedor then cancelEvent() elseif source == vendedor1 then cancelEvent() end end) --Funções dos markers addEventHandler( "onClientMarkerHit", root, function (hitPlayer, matchingDimension) local x,y,z = getElementPosition( localPlayer ) if (matchingDimension) then -- checa dimensão if source == AmmuEntrada then setElementInterior(hitPlayer, 7) setElementPosition (hitPlayer, 313.6630859375,-142.9970703125,999.6015625) setElementRotation( hitPlayer, -0, 0, 25.519 ) setPedCameraRotation( hitPlayer, 21 ) end if source == AmmuSaida then setElementInterior(hitPlayer, 0) setElementDimension( hitPlayer, 0 ) setElementPosition(hitPlayer, 1365.741, -1279.792, 13.547 ) setElementRotation( hitPlayer, -0, 0, 90 ) setPedCameraRotation( hitPlayer, 90 ) end if source == MenuComprar and z < 1000 then addEventHandler( "onClientRender", root, MenuCompra1) showCursor( true ) menuAmmu = true end if source == MenuComprar1 and z < 1000 then addEventHandler( "onClientRender", root, MenuCompra2) showCursor( true ) menuAmmu1 = true end end end) -- Se sair do marker remove o menu addEventHandler( "onClientMarkerLeave", root, function (leftPlayer, matchingDimension) if source == MenuComprar then removeEventHandler( "onClientRender", root, MenuCompra1 ) showCursor( false ) menuAmmu = false end if source == MenuComprar1 then removeEventHandler( "onClientRender", root, MenuCompra2 ) showCursor( false ) menuAmmu1 = false end end) local screenW, screenH = guiGetScreenSize() local CorIMG = tocolor(255, 255, 255, 255) local CorTXT = tocolor(0, 0, 0, 255) local CorIMG1 = tocolor(255, 255, 255, 255) local CorTXT1 = tocolor(0, 0, 0, 255) local CorIMG2 = tocolor(255, 255, 255, 255) local CorTXT2 = tocolor(0, 0, 0, 255) local CorIMG3 = tocolor(255, 255, 255, 255) local CorTXT3 = tocolor(0, 0, 0, 255) -- Menu DX function MenuCompra1() dxDrawLine((screenW * 0.2260) - 1, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, screenH * 0.7259, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.2260) - 1, screenH * 0.7259, screenW * 0.3812, screenH * 0.7259, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, screenH * 0.7259, screenW * 0.3812, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.2260, screenH * 0.2815, screenW * 0.1552, screenH * 0.4444, tocolor(1, 0, 0, 193), false) faquinha = dxDrawImage(screenW * 0.2313, screenH * 0.3833, screenW * 0.0469, screenH * 0.0833, "imgs/KABAR.png", 0, 0, 0, CorIMG, false) dxDrawLine((screenW * 0.2260) - 1, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, screenH * 0.3741, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.2260) - 1, screenH * 0.3741, screenW * 0.3812, screenH * 0.3741, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, screenH * 0.3741, screenW * 0.3812, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.2260, screenH * 0.2815, screenW * 0.1552, screenH * 0.0926, tocolor(201, 0, 0, 100), false) dxDrawText("Loja De Armas", (screenW * 0.2323) - 1, (screenH * 0.2907) - 1, (screenW * 0.3760) - 1, (screenH * 0.3648) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", (screenW * 0.2323) + 1, (screenH * 0.2907) - 1, (screenW * 0.3760) + 1, (screenH * 0.3648) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", (screenW * 0.2323) - 1, (screenH * 0.2907) + 1, (screenW * 0.3760) - 1, (screenH * 0.3648) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", (screenW * 0.2323) + 1, (screenH * 0.2907) + 1, (screenW * 0.3760) + 1, (screenH * 0.3648) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", screenW * 0.2323, screenH * 0.2907, screenW * 0.3760, screenH * 0.3648, tocolor(254, 254, 254, 254), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.2313, screenH * 0.4667, screenW * 0.0469, screenH * 0.0833, "imgs/ColtM1911.png", 0, 0, 0, CorIMG1, false) dxDrawImage(screenW * 0.2313, screenH * 0.5500, screenW * 0.0469, screenH * 0.0833, "imgs/M29.png", 0, 0, 0, CorIMG2, false) dxDrawImage(screenW * 0.2313, screenH * 0.6333, screenW * 0.0469, screenH * 0.0833, "imgs/Glock-17.png", 0, 0, 0, CorIMG3, false) dxDrawText("Faca R$250", (screenW * 0.2781) - 1, (screenH * 0.3833) - 1, (screenW * 0.3771) - 1, (screenH * 0.4667) - 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Faca R$250", (screenW * 0.2781) + 1, (screenH * 0.3833) - 1, (screenW * 0.3771) + 1, (screenH * 0.4667) - 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Faca R$250", (screenW * 0.2781) - 1, (screenH * 0.3833) + 1, (screenW * 0.3771) - 1, (screenH * 0.4667) + 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Faca R$250", (screenW * 0.2781) + 1, (screenH * 0.3833) + 1, (screenW * 0.3771) + 1, (screenH * 0.4667) + 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Faca R$250", screenW * 0.2781, screenH * 0.3833, screenW * 0.3771, screenH * 0.4667, tocolor(254, 254, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Colt .45 R$1500", (screenW * 0.2781) - 1, (screenH * 0.4667) - 1, (screenW * 0.3771) - 1, (screenH * 0.5500) - 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Colt .45 R$1500", (screenW * 0.2781) + 1, (screenH * 0.4667) - 1, (screenW * 0.3771) + 1, (screenH * 0.5500) - 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Colt .45 R$1500", (screenW * 0.2781) - 1, (screenH * 0.4667) + 1, (screenW * 0.3771) - 1, (screenH * 0.5500) + 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Colt .45 R$1500", (screenW * 0.2781) + 1, (screenH * 0.4667) + 1, (screenW * 0.3771) + 1, (screenH * 0.5500) + 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Colt .45 R$1500", screenW * 0.2781, screenH * 0.4667, screenW * 0.3771, screenH * 0.5500, tocolor(254, 254, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Revolver .357 R$2500", (screenW * 0.2781) - 1, (screenH * 0.5500) - 1, (screenW * 0.3771) - 1, (screenH * 0.6333) - 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Revolver .357 R$2500", (screenW * 0.2781) + 1, (screenH * 0.5500) - 1, (screenW * 0.3771) + 1, (screenH * 0.6333) - 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Revolver .357 R$2500", (screenW * 0.2781) - 1, (screenH * 0.5500) + 1, (screenW * 0.3771) - 1, (screenH * 0.6333) + 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Revolver .357 R$2500", (screenW * 0.2781) + 1, (screenH * 0.5500) + 1, (screenW * 0.3771) + 1, (screenH * 0.6333) + 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Revolver .357 R$2500", screenW * 0.2781, screenH * 0.5500, screenW * 0.3771, screenH * 0.6333, tocolor(254, 255, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Glock 9mm Automatica R$4000", (screenW * 0.2781) - 1, (screenH * 0.6333) - 1, (screenW * 0.3771) - 1, (screenH * 0.7167) - 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Glock 9mm Automatica R$4000", (screenW * 0.2781) + 1, (screenH * 0.6333) - 1, (screenW * 0.3771) + 1, (screenH * 0.7167) - 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Glock 9mm Automatica R$4000", (screenW * 0.2781) - 1, (screenH * 0.6333) + 1, (screenW * 0.3771) - 1, (screenH * 0.7167) + 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Glock 9mm Automatica R$4000", (screenW * 0.2781) + 1, (screenH * 0.6333) + 1, (screenW * 0.3771) + 1, (screenH * 0.7167) + 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Glock 9mm Automatica R$4000", screenW * 0.2781, screenH * 0.6333, screenW * 0.3771, screenH * 0.7167, tocolor(254, 255, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) end function MenuCompra2() dxDrawLine((screenW * 0.2260) - 1, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, screenH * 0.7259, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.2260) - 1, screenH * 0.7259, screenW * 0.3812, screenH * 0.7259, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, screenH * 0.7259, screenW * 0.3812, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.2260, screenH * 0.2815, screenW * 0.1552, screenH * 0.4444, tocolor(1, 0, 0, 193), false) faquinha = dxDrawImage(screenW * 0.2313, screenH * 0.3833, screenW * 0.0469, screenH * 0.0833, "imgs/Sawn-offShotgun.png", 0, 0, 0, CorIMG, false) dxDrawLine((screenW * 0.2260) - 1, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, screenH * 0.3741, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, (screenH * 0.2815) - 1, (screenW * 0.2260) - 1, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.2260) - 1, screenH * 0.3741, screenW * 0.3812, screenH * 0.3741, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.3812, screenH * 0.3741, screenW * 0.3812, (screenH * 0.2815) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.2260, screenH * 0.2815, screenW * 0.1552, screenH * 0.0926, tocolor(201, 0, 0, 100), false) dxDrawText("Loja De Armas", (screenW * 0.2323) - 1, (screenH * 0.2907) - 1, (screenW * 0.3760) - 1, (screenH * 0.3648) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", (screenW * 0.2323) + 1, (screenH * 0.2907) - 1, (screenW * 0.3760) + 1, (screenH * 0.3648) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", (screenW * 0.2323) - 1, (screenH * 0.2907) + 1, (screenW * 0.3760) - 1, (screenH * 0.3648) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", (screenW * 0.2323) + 1, (screenH * 0.2907) + 1, (screenW * 0.3760) + 1, (screenH * 0.3648) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Loja De Armas", screenW * 0.2323, screenH * 0.2907, screenW * 0.3760, screenH * 0.3648, tocolor(254, 254, 254, 254), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.2313, screenH * 0.4667, screenW * 0.0469, screenH * 0.0833, "imgs/Mossberg590.png", 0, 0, 0, CorIMG1, false) dxDrawImage(screenW * 0.2313, screenH * 0.5500, screenW * 0.0469, screenH * 0.0833, "imgs/MP5A3.png", 0, 0, 0, CorIMG2, false) dxDrawImage(screenW * 0.2313, screenH * 0.6333, screenW * 0.0469, screenH * 0.0833, "imgs/M14.png", 0, 0, 0, CorIMG3, false) dxDrawText("12 Cano Duplo R$3000", (screenW * 0.2781) - 1, (screenH * 0.3833) - 1, (screenW * 0.3771) - 1, (screenH * 0.4667) - 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Cano Duplo R$3000", (screenW * 0.2781) + 1, (screenH * 0.3833) - 1, (screenW * 0.3771) + 1, (screenH * 0.4667) - 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Cano Duplo R$3000", (screenW * 0.2781) - 1, (screenH * 0.3833) + 1, (screenW * 0.3771) - 1, (screenH * 0.4667) + 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Cano Duplo R$3000", (screenW * 0.2781) + 1, (screenH * 0.3833) + 1, (screenW * 0.3771) + 1, (screenH * 0.4667) + 1, CorTXT, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Cano Duplo R$3000", screenW * 0.2781, screenH * 0.3833, screenW * 0.3771, screenH * 0.4667, tocolor(254, 254, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Punheteira R$4000", (screenW * 0.2781) - 1, (screenH * 0.4667) - 1, (screenW * 0.3771) - 1, (screenH * 0.5500) - 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Punheteira R$4000", (screenW * 0.2781) + 1, (screenH * 0.4667) - 1, (screenW * 0.3771) + 1, (screenH * 0.5500) - 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Punheteira R$4000", (screenW * 0.2781) - 1, (screenH * 0.4667) + 1, (screenW * 0.3771) - 1, (screenH * 0.5500) + 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Punheteira R$4000", (screenW * 0.2781) + 1, (screenH * 0.4667) + 1, (screenW * 0.3771) + 1, (screenH * 0.5500) + 1, CorTXT1, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("12 Punheteira R$4000", screenW * 0.2781, screenH * 0.4667, screenW * 0.3771, screenH * 0.5500, tocolor(254, 254, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("HK MP5 R$6000", (screenW * 0.2781) - 1, (screenH * 0.5500) - 1, (screenW * 0.3771) - 1, (screenH * 0.6333) - 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("HK MP5 R$6000", (screenW * 0.2781) + 1, (screenH * 0.5500) - 1, (screenW * 0.3771) + 1, (screenH * 0.6333) - 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("HK MP5 R$6000", (screenW * 0.2781) - 1, (screenH * 0.5500) + 1, (screenW * 0.3771) - 1, (screenH * 0.6333) + 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("HK MP5 R$6000", (screenW * 0.2781) + 1, (screenH * 0.5500) + 1, (screenW * 0.3771) + 1, (screenH * 0.6333) + 1, CorTXT2, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("HK MP5 R$6000", screenW * 0.2781, screenH * 0.5500, screenW * 0.3771, screenH * 0.6333, tocolor(254, 255, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("BAR M1918 R$10000", (screenW * 0.2781) - 1, (screenH * 0.6333) - 1, (screenW * 0.3771) - 1, (screenH * 0.7167) - 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("BAR M1918 R$10000", (screenW * 0.2781) + 1, (screenH * 0.6333) - 1, (screenW * 0.3771) + 1, (screenH * 0.7167) - 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("BAR M1918 R$10000", (screenW * 0.2781) - 1, (screenH * 0.6333) + 1, (screenW * 0.3771) - 1, (screenH * 0.7167) + 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("BAR M1918 R$10000", (screenW * 0.2781) + 1, (screenH * 0.6333) + 1, (screenW * 0.3771) + 1, (screenH * 0.7167) + 1, CorTXT3, 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("BAR M1918 R$10000", screenW * 0.2781, screenH * 0.6333, screenW * 0.3771, screenH * 0.7167, tocolor(254, 255, 254, 255), 1.00, "default", "center", "center", false, false, false, false, false) end -- função clique function Clicar (_,state) local money= getPlayerMoney( thePlayer ) if state == "down" then if menuAmmu == true then local ArmaMeele = getPedWeapon ( localPlayer, 1 ) -- checa slot de meele if isCursorOnElement ( screenW * 0.2292, screenH * 0.3806, screenW * 0.1479, screenH * 0.0880 ) and money >= 250 and tonumber(ArmaMeele) ~= 4 then -- se não tem faca playSound("sounds/cash.mp3") CorIMG = tocolor(0, 255, 0, 100) CorTXT = tocolor(0, 0, 0, 10) triggerServerEvent("ComproFaca", localPlayer) setTimer(function() CorIMG = tocolor(255, 255, 255, 255) CorTXT = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement ( screenW * 0.2292, screenH * 0.3806, screenW * 0.1479, screenH * 0.0880 ) and money < 250 and tonumber(ArmaMeele) ~= 4 then playSound("sounds/dont.mp3") CorIMG = tocolor(255, 0, 0, 100) CorTXT = tocolor(0, 0, 0, 10) setTimer(function() CorIMG = tocolor(255, 255, 255, 255) CorTXT = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement ( screenW * 0.2292, screenH * 0.3806, screenW * 0.1479, screenH * 0.0880 ) and money >= 250 and tonumber(ArmaMeele) == 4 then -- se ja tem faca playSound("sounds/dont.mp3") CorIMG = tocolor(255, 255, 0, 100) CorTXT = tocolor(0, 0, 0, 10) setTimer(function() CorIMG = tocolor(255, 255, 255, 255) CorTXT = tocolor(0, 0, 0, 255) end,500,1) end if isCursorOnElement (screenW * 0.2292, screenH * 0.4685, screenW * 0.1479, screenH * 0.0833 ) and money >= 1500 then playSound("sounds/cash.mp3") CorIMG1 = tocolor(0, 255, 0, 100) CorTXT1 = tocolor(0, 0, 0, 10) triggerServerEvent("ComproPistola", localPlayer) setTimer(function() CorIMG1 = tocolor(255, 255, 255, 255) CorTXT1 = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement (screenW * 0.2292, screenH * 0.4685, screenW * 0.1479, screenH * 0.0833 ) and money < 1500 then playSound("sounds/dont.mp3") CorIMG1 = tocolor(255, 0, 0, 100) CorTXT1 = tocolor(0, 0, 0, 10) setTimer(function() CorIMG1 = tocolor(255, 255, 255, 255) CorTXT1 = tocolor(0, 0, 0, 255) end,500,1) end if isCursorOnElement (screenW * 0.2292, screenH * 0.5519, screenW * 0.1479, screenH * 0.0833 ) and money >= 2500 then playSound("sounds/cash.mp3") CorIMG2 = tocolor(0, 255, 0, 100) CorTXT2 = tocolor(0, 0, 0, 10) triggerServerEvent("ComproRevolver", localPlayer) setTimer(function() CorIMG2 = tocolor(255, 255, 255, 255) CorTXT2 = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement (screenW * 0.2292, screenH * 0.5519, screenW * 0.1479, screenH * 0.0833 ) and money < 2500 then playSound("sounds/dont.mp3") CorIMG2 = tocolor(255, 0, 0, 100) CorTXT2 = tocolor(0, 0, 0, 10) setTimer(function() CorIMG2 = tocolor(255, 255, 255, 255) CorTXT2 = tocolor(0, 0, 0, 255) end,500,1) end if isCursorOnElement (screenW * 0.2292, screenH * 0.6352, screenW * 0.1479, screenH * 0.0833 ) and money >= 4000 then playSound("sounds/cash.mp3") CorIMG3 = tocolor(0, 255, 0, 100) CorTXT3 = tocolor(0, 0, 0, 10) triggerServerEvent("ComproGlock", localPlayer) setTimer(function() CorIMG3 = tocolor(255, 255, 255, 255) CorTXT3 = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement (screenW * 0.2292, screenH * 0.6352, screenW * 0.1479, screenH * 0.0833 ) and money < 4000 then playSound("sounds/dont.mp3") CorIMG3 = tocolor(255, 0, 0, 100) CorTXT3 = tocolor(0, 0, 0, 10) setTimer(function() CorIMG3 = tocolor(255, 255, 255, 255) CorTXT3 = tocolor(0, 0, 0, 255) end,500,1) end end if menuAmmu1 == true then if isCursorOnElement ( screenW * 0.2292, screenH * 0.3806, screenW * 0.1479, screenH * 0.0880 ) and money >= 3000 then playSound("sounds/cash.mp3") CorIMG = tocolor(0, 255, 0, 100) CorTXT = tocolor(0, 0, 0, 10) triggerServerEvent("Compro12Dupla", localPlayer) setTimer(function() CorIMG = tocolor(255, 255, 255, 255) CorTXT = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement ( screenW * 0.2292, screenH * 0.3806, screenW * 0.1479, screenH * 0.0880 ) and money < 3000 then playSound("sounds/dont.mp3") CorIMG = tocolor(255, 0, 0, 100) CorTXT = tocolor(0, 0, 0, 10) setTimer(function() CorIMG = tocolor(255, 255, 255, 255) CorTXT = tocolor(0, 0, 0, 255) end,500,1) end if isCursorOnElement (screenW * 0.2292, screenH * 0.4685, screenW * 0.1479, screenH * 0.0833 ) and money >= 4000 then playSound("sounds/cash.mp3") CorIMG1 = tocolor(0, 255, 0, 100) CorTXT1 = tocolor(0, 0, 0, 10) triggerServerEvent("Compro12", localPlayer) setTimer(function() CorIMG1 = tocolor(255, 255, 255, 255) CorTXT1 = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement (screenW * 0.2292, screenH * 0.4685, screenW * 0.1479, screenH * 0.0833 ) and money < 4000 then playSound("sounds/dont.mp3") CorIMG1 = tocolor(255, 0, 0, 100) CorTXT1 = tocolor(0, 0, 0, 10) setTimer(function() CorIMG1 = tocolor(255, 255, 255, 255) CorTXT1 = tocolor(0, 0, 0, 255) end,500,1) end if isCursorOnElement (screenW * 0.2292, screenH * 0.5519, screenW * 0.1479, screenH * 0.0833 ) and money >= 6000 then playSound("sounds/cash.mp3") CorIMG2 = tocolor(0, 255, 0, 100) CorTXT2 = tocolor(0, 0, 0, 10) triggerServerEvent("ComproMP5", localPlayer) setTimer(function() CorIMG2 = tocolor(255, 255, 255, 255) CorTXT2 = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement (screenW * 0.2292, screenH * 0.5519, screenW * 0.1479, screenH * 0.0833 ) and money < 6000 then playSound("sounds/dont.mp3") CorIMG2 = tocolor(255, 0, 0, 100) CorTXT2 = tocolor(0, 0, 0, 10) setTimer(function() CorIMG2 = tocolor(255, 255, 255, 255) CorTXT2 = tocolor(0, 0, 0, 255) end,500,1) end if isCursorOnElement (screenW * 0.2292, screenH * 0.6352, screenW * 0.1479, screenH * 0.0833 ) and money >= 10000 then playSound("sounds/cash.mp3") CorIMG3 = tocolor(0, 255, 0, 100) CorTXT3 = tocolor(0, 0, 0, 10) triggerServerEvent("ComproBAR", localPlayer) setTimer(function() CorIMG3 = tocolor(255, 255, 255, 255) CorTXT3 = tocolor(0, 0, 0, 255) end,500,1) elseif isCursorOnElement (screenW * 0.2292, screenH * 0.6352, screenW * 0.1479, screenH * 0.0833 ) and money < 10000 then playSound("sounds/dont.mp3") CorIMG3 = tocolor(255, 0, 0, 100) CorTXT3 = tocolor(0, 0, 0, 10) setTimer(function() CorIMG3 = tocolor(255, 255, 255, 255) CorTXT3 = tocolor(0, 0, 0, 255) end,500,1) end end end end addEventHandler ("onClientClick", root, Clicar ) -- importante função para pegar posição do mouse -- creditos da função da posição do mouse: Croack function isCursorOnElement ( x, y, w, h ) local mx, my = getCursorPosition () local fullx, fully = guiGetScreenSize () cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end npc damage part addEventHandler( "onClientPlayerStealthKill", root, function (targetPlayer) if targetPlayer == vendedor then cancelEvent() elseif targetPlayer == vendedor1 then cancelEvent() end end) addEventHandler( "onClientPedDamage", root, function (attacker, weapon, bodypart, loss) if source == vendedor then cancelEvent() elseif source == vendedor1 then cancelEvent() end end) addEventHandler( "onClientPedWasted", root, function (killer, weapon, bodypart, loss, stealth) if source == vendedor then cancelEvent() elseif source == vendedor1 then cancelEvent() end end)
-
splendid, not only did you ask me a big question, but you also taught me how to optimize with tables. thank you very much friend
-
function PegarVaso( source ) local Px, Py, Pz = getElementPosition( source ) Vaso = createObject( 2203, Px, Py, Pz ) setPedAnimation( source, "CARRY", "crry_prtial", 4.1, true, true, true ) exports.pAttach:attach(Vaso, source, 1.7, 0, 0.4, 0.4, 90, 0, 0 ) end addCommandHandler( "pegarvaso", PegarVaso ) function LargarVaso( source ) local Px, Py, Pz = getElementPosition( source ) setPedAnimation( source, "CARRY", "putdwn", 1.0, false, false, false, true ) setTimer(function() setPedAnimation( source ) destroyElement( Vaso ) Planta = createObject( 2203, Px , Py , Pz -0.85) setElementData( Planta, "Planta", true ) end, 1200, 1) end addCommandHandler( "soltarvaso", LargarVaso ) function Planta( button, state, player ) -- Add the function if button == "left" and state == "down" then if getElementData(Planta, "Planta") == true then triggerClientEvent( "MenuPlantar", player ) end end end addEventHandler( "onElementClicked", root, Planta ) i trying to use elementdata for recognize the object, but the client event is triggered clicking in every element, how i can properly make the function recognize the object element data?
-
hello, i created this script, but i dont know how i can make to show only the items the player have, and how to save and load the player item list, someone can help me? client.lua --[[ __ __ __ __ /\ \ /\ \ /\ \__ /\ \ \ \ \ ___ ___\ \ \/'\\ \ ,_\ ___ __ __ __ ____\ \ \/'\ \ \ \ __ / __`\ / __`\ \ , < \ \ \/ / __`\/\ \/\ \ /'__`\ /',__\\ \ , < \ \ \L\ \/\ \L\ \/\ \L\ \ \ \\`\\ \ \_/\ \L\ \ \ \_/ |/\ \L\.\_/\__, `\\ \ \\`\ \ \____/\ \____/\ \____/\ \_\ \_\ \__\ \____/\ \___/ \ \__/.\_\/\____/ \ \_\ \_\ \/___/ \/___/ \/___/ \/_/\/_/\/__/\/___/ \/__/ \/__/\/_/\/___/ \/_/\/_/ By Looktovask, Mantenha os creditos! --]] Items = { {"Cachorro Quente"}, {"Pizza"}, {"Biscoitos"}, {"Marmitex"}, {"Agua Mineral"}, {"Refrigerante"}, {"Primeiros Socorros"} } addEventHandler("onClientResourceStart", resourceRoot, function () JanelaInventario = guiCreateWindow(0.80, 0.56, 0.19, 0.42, "Inventario", true) guiWindowSetSizable(JanelaInventario, false) guiSetAlpha(JanelaInventario, 0.90) ListaInventario = guiCreateGridList(0.03, 0.07, 0.94, 0.79, true, JanelaInventario) guiGridListAddColumn(ListaInventario, "Items", 0.9) for i = 1, 23 do guiGridListAddRow(ListaInventario) end for i,v in ipairs(Items) do local Nome = Items[i][1] local row = guiGridListAddRow ( ListaInventario ) guiGridListSetItemText ( ListaInventario, row, 1, ""..tostring(Nome).."", false, false ) end guiSetAlpha(ListaInventario, 0.90) BotaoUsar = guiCreateButton(0.03, 0.87, 0.45, 0.11, "Usar", true, JanelaInventario) guiSetAlpha(BotaoUsar, 0.90) BotaoLixo = guiCreateButton(0.52, 0.87, 0.45, 0.11, "Jogar Fora", true, JanelaInventario) guiSetAlpha(BotaoLixo, 0.90) guiSetVisible(JanelaInventario,false) -- importante pra não iniciar ligada end) -- esse codigo é pica pra mostrar a tela bindKey ( "f1", "down", function( ) local tostate = not guiGetVisible ( JanelaInventario ) guiSetVisible ( JanelaInventario, tostate ) showCursor ( tostate ) end ) -- função dos botões addEventHandler ("onClientGUIClick",root, function () if ( source == BotaoUsar ) then local itemselecionado = guiGridListGetItemText(ListaInventario, guiGridListGetSelectedItem(ListaInventario), 1) -- a lista, a linha escolhida, e a coluna if itemselecionado == "Cachorro Quente" then local Px, Py, Pz = getElementPosition( localPlayer ) local Burger = createObject( 2880, Px, Py, Pz ) setPedAnimation(localPlayer, "food", "eat_burger") exports.pAttach:attach(Burger, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("CachorroQ", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( Burger ) end, 3500, 1 ) elseif itemselecionado == "Pizza" then local Px, Py, Pz = getElementPosition( localPlayer ) local Pizza = createObject( 2702, Px, Py, Pz ) setPedAnimation(localPlayer, "food", "eat_pizza") exports.pAttach:attach(Pizza, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("Pizza", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( Pizza ) end, 3500, 1 ) elseif itemselecionado == "Biscoitos" then local Px, Py, Pz = getElementPosition( localPlayer ) local Biscoito = createObject( 2663, Px, Py, Pz ) setPedAnimation(localPlayer, "food", "eat_burger") exports.pAttach:attach(Biscoito, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("Biscoitos", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( Biscoito ) end, 3500, 1 ) elseif itemselecionado == "Marmitex" then local Px, Py, Pz = getElementPosition( localPlayer ) local Marmita = createObject( 2768, Px, Py, Pz ) setPedAnimation(localPlayer, "food", "eat_burger") exports.pAttach:attach(Marmita, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("Marmitex", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( Marmita ) end, 3500, 1 ) elseif itemselecionado == "Agua Mineral" then local Px, Py, Pz = getElementPosition( localPlayer ) local Agua = createObject( 1509, Px, Py, Pz ) setPedAnimation(localPlayer, "food", "eat_burger") exports.pAttach:attach(Agua, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("AguaM", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( Agua ) end, 3500, 1 ) elseif itemselecionado == "Refrigerante" then local Px, Py, Pz = getElementPosition( localPlayer ) local Refri = createObject( 2601, Px, Py, Pz ) setPedAnimation(localPlayer, "food", "eat_burger") exports.pAttach:attach(Refri, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("Refrigerante", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( Refri ) end, 3500, 1 ) elseif itemselecionado == "Primeiros Socorros" then local Px, Py, Pz = getElementPosition( localPlayer ) local KitS = createObject( 1575, Px, Py, Pz ) setPedAnimation(localPlayer, "misc", "scratchballs_01") exports.pAttach:attach(KitS, localPlayer, 25, 0, 0, 0, 0, 0, 0 ) triggerServerEvent("PrimeirosS", localPlayer) setTimer ( function() setPedAnimation(localPlayer) destroyElement( KitS ) end, 3500, 1 ) end elseif ( source == BotaoLixo ) then local itemselecionado = guiGridListGetItemText(ListaInventario, guiGridListGetSelectedItem(ListaInventario), 1) -- a lista, a linha escolhida, e a coluna outputChatBox( "Jogou Fora " ..itemselecionado ) triggerServerEvent("Lixo", localPlayer) -- Chama Função Lixo (Jogar Fora) end end) server.lua --[[ __ __ __ __ /\ \ /\ \ /\ \__ /\ \ \ \ \ ___ ___\ \ \/'\\ \ ,_\ ___ __ __ __ ____\ \ \/'\ \ \ \ __ / __`\ / __`\ \ , < \ \ \/ / __`\/\ \/\ \ /'__`\ /',__\\ \ , < \ \ \L\ \/\ \L\ \/\ \L\ \ \ \\`\\ \ \_/\ \L\ \ \ \_/ |/\ \L\.\_/\__, `\\ \ \\`\ \ \____/\ \____/\ \____/\ \_\ \_\ \__\ \____/\ \___/ \ \__/.\_\/\____/ \ \_\ \_\ \/___/ \/___/ \/___/ \/_/\/_/\/__/\/___/ \/__/ \/__/\/_/\/___/ \/_/\/_/ By Looktovask, Mantenha os creditos! --]] function jogarfora() outputChatBox( "test" ) end addEvent( "Lixo", true ) addEventHandler( "Lixo", root, jogarfora ) function SalvarItems() -- função end function CarregarItems() -- função end function Cachorro(source) outputChatBox( "1" ) end addEvent( "CachorroQ", true ) addEventHandler( "CachorroQ", root, Cachorro ) function Pitsa(source) outputChatBox( "2" ) end addEvent( "Pizza", true ) addEventHandler( "Pizza", root, Pitsa ) function Biscoito(source) outputChatBox( "3" ) end addEvent( "Biscoitos", true ) addEventHandler( "Biscoitos", root, Biscoito ) function Marmita(source) outputChatBox( "4" ) end addEvent( "Marmitex", true ) addEventHandler( "Marmitex", root, Marmita ) function Agua(source) outputChatBox( "5" ) end addEvent( "AguaM", true ) addEventHandler( "AguaM", root, Agua ) function Refri(source) outputChatBox( "6" ) end addEvent( "Refrigerante", true ) addEventHandler( "Refrigerante", root, Refri ) function Socorros(source) outputChatBox( "7" ) end addEvent( "PrimeirosS", true ) addEventHandler( "PrimeirosS", root, Socorros ) and i have another question, how i can make the player need to wait the function end to click again on "Usar"