Leaderboard
Popular Content
Showing content with the highest reputation on 02/01/20 in all areas
-
Bom para você fazer isto tem alguns passos a serem seguidos vamos lá: 1- posições: nesse "fundo" temos as posições: x = 48 y = 565 w = 210 h = 134 O importante desses números todos é a posição y ou seja o 565, que é onde deverá ocorrer a animação. Se você viu as linhas comentadas acho que sabe do que estou falando! 2 - Valores em tabela: Temos duas tabelas, a tabela onde tem a posição do radar ( up ) e a outra onde tem as posições acima do radar ( down ) Primeiro vamos adicionar o valor na tabela ( up ) dessa forma: local up = { [1] = {y*634}, [2] = {y*677}, [3] = {y*718}, [4] = {y*565}, -- valor y do dxDrawImage } Ok, temos o valor na primeira tabela. Agora vamos a segunda: Como eu não tenho o valor exato de onde ficaria vamos ter que fazer um conta simples, para obtê-lo Para isso eu pego o valor Y do primeiro retângulo menos o valor Y do "fundo" ficaria assim 634 - 565 o resultado é 69 px ( px é pixels) Agora, na tabela ( down ) o que temos que fazer é subtrair o valor do primeiro retângulo menos a nossa diferença: local down = { [1] = {y*426}, [2] = {y*464}, [3] = {y*502}, } 426 - 69 que é igual a 357 px ( px é pixels) e fica assim a tabela 2 ( down ) local down = { [1] = {y*426}, [2] = {y*464}, [3] = {y*502}, [4] = {y*357}, } Agora que obtemos os dois valores vamos as funções. 3 - Variáveis e interpolate: Perceba que para cada retângulo temos um interpolate novo, isto se deve ao fato de que cada retângulo possui sua própria posição. Nas duas functions ( onVeh e onFoot ) teremos que adicionar novos interpolates Vamos fazer assim: onVeh: local x1, y1, z1 = interpolate(0, up[1][1], 0, 0, down[1][1], 0, inicio2, 1000, "Linear") local x2, y2, z2 = interpolate(0, up[2][1], 0, 0, down[2][1], 0, inicio2, 1000, "Linear") local x3, y3, z3 = interpolate(0, up[3][1], 0, 0, down[3][1], 0, inicio2, 1000, "Linear") local x4, y4, z4 = interpolate(0, up[4][1], 0, 0, down[4][1], 0, inicio2, 1000, "Linear") -- interpolate do dxDrawImage (o fundo) onFoot: local x1, y1, z1 = interpolate(0, down[1][1], 0, 0, up[1][1], 0, inicio, 1000, "Linear") local x2, y2, z2 = interpolate(0, down[2][1], 0, 0, up[2][1], 0, inicio, 1000, "Linear") local x3, y3, z3 = interpolate(0, down[3][1], 0, 0, up[3][1], 0, inicio, 1000, "Linear") local x4, y4, z4 = interpolate(0, down[4][1], 0, 0, up[4][1], 0, inicio, 1000, "Linear") -- interpolate do "fundo" Criamos 6 novas variáveis, 3 em cada function, agora vamos adicionar o dxDrawImage: 4 - Adicionando o dx: pegamos o dx que você tem e colocamos ele ACIMA dos demais dessa forma: OBS: DX FUNCIONAM COMO CAMADAS ex: Se temos um retângulo e embaixo desse retângulo temos uma imagem, a imagem irá cobrir, irá se sobrepor ao retângulo! ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 5 - Adicionando a animação: Aqui iremos apagar o valor x*565 do dxDrawImage e substituir pela variável y4, dessa forma: dxDrawImage(x*48, y4, x*210, y*134, "files/images/interface.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) Motivo: como dito anteriormente variáveis possuem valores ( ex: oi = tchau, se eu der print(oi) o que aparecerá no console é a palavra "tchau"). Quando eu tiro o valor y*565 e substituo pela variável y4 o que estou fazendo é colocar a animação no dxDrawImage ( o fundo). Obs: Não se esqueça de adicionar o interpolate e o dx nas duas functions onVeh e onFoot!! Feito todos esses passos, esta pronto! Agora temos um fundo com animação. Caso não entenda alguma parte leia novamente! rs, mas caso ainda reste duvidas só perguntar. @Mopped1 point
-
1 point
-
Always English in this section. An addition translation in Polish is fine. Thanks you!1 point
-
Thank you TUT ! This is what i was searching for ! Nice information !1 point
-
Check the "Extracting game assets" section on this thread, if that's what you're after https://forum.multitheftauto.com/topic/119240-mta-modding-in-3d/1 point
-
1 point
-
Só copiar os três getElementData (fome, sede, sono) E colar dentro das funções onVeh e onFoot, tipo assim -> http://prntscr.com/qiagk71 point
-
Hm, estranho essa parte de ficar duplicando, pois tem a verificação e a remoção do evento mas enfim. Tente o código abaixo. Obs: na hora de copiar clique neste botão > http://prntscr.com/qi9y1p Assim é certeza que você copiou o código corretamente! local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local font1 = dxCreateFont('files/fonts/font.ttf', 37, false); local font2 = dxCreateFont('files/fonts/font.ttf', 25, false); local font3 = dxCreateFont('files/fonts/font3.ttf', 20, false); local font4 = dxCreateFont('files/fonts/font3.ttf', 25, false); local font5 = dxCreateFont('files/fonts/font.ttf', 25, false); local fontprice = dxCreateFont('files/fonts/pricedownbl.ttf', 25, false); local font10 = dxCreateFont('files/fonts/font10.ttf', 25, false); local font11 = dxCreateFont('files/fonts/font11.ttf', 25, false); function hud() if (not isPlayerMapVisible()) then local money = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local job = getElementData(getLocalPlayer(), "Emprego") or "Desempregado" local cargo = getElementData(localPlayer, "DNL:Cargo") or "Civil" local level = getElementData(getLocalPlayer(), "Level") or 0 local banco = ("%008d"):format(getElementData(getLocalPlayer(), "Bank:Royal")) or 0 local xp = getElementData(getLocalPlayer(), "LSys:EXP") or 0 local fome = getElementData(getLocalPlayer(), "AirNewSCR_Fome") local sede = getElementData(getLocalPlayer(), "AirNewSCR_Sede") local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local color1 = tocolor(0,255,0,90) local Sono = getElementData(getLocalPlayer(), "sono") local vehicle = getPedOccupiedVehicle( getLocalPlayer() ) local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second local years = time.year + 1900 local month = time.month + 1 local day = time.monthday if (hours >= 0 and hours < 10) then hours = "0"..time.hour end if (minutes >= 0 and minutes < 10) then minutes = "0"..time.minute end if (seconds >= 0 and seconds < 10) then seconds = "0"..time.second end dxDrawText(job, x*1495, y*110, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.60, fontprice, "center", "center", false, false, false, false, false) dxDrawText('Level: '..level, x*1490, y*185, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.60, fontprice,"center", "center", false, false, false, false, false) dxDrawText('EXP: '..xp, x*1490, y*220, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.60, fontprice,"center", "center", false, false, false, false, false) dxDrawText(''..money, x*1505, y*275, x*1026, y*90, tocolor(144,238,144), x*0.70, fontprice, "center", "center", false, false, false, false, false) dxDrawText(''..banco, x*1505, y*325, x*1026, y*90, tocolor(30, 144, 255, 255), x*0.70, fontprice, "center", "center", false, false, false, false, false) dxDrawText(""..hours..":"..minutes..":"..seconds.."", x*1498, y*380, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.45, font10, "center", "center", false, false, false, false, false) dxDrawText(""..day.."/"..month.."/"..years.."", x*1498, y*420, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.40, font10, "center", "center", false, false, false, false, false) dxDrawText('KMKRP', x*1445, y*-10, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.70, font3, "center", "center", false, false, false, false, false) dxDrawText('#', x*1360, y*-10, x*1026, y*90, tocolor(255, 255, 255, 255), x*0.70, font10, "center", "center", false, false, false, false, false) dxDrawImage(x*1153, y*597, x*210, y*134, "files/images/interface.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1275, y*-4, x*80, y*85, "files/images/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1185, y*196, x*24, y*24, "files/images/card.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1185, y*172, x*24, y*24, "files/images/money.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Arma: "..arma.. " || Munição: " ..tostring (showammo1).." / "..tostring (showammo2), x*216, y*1480, x*132, y*20, tocolor(255, 255, 255, 255), 0.40, font10, "center", "center", false, false, false, false, false) end end local up = { [1] = {y*634}, [2] = {y*677}, [3] = {y*718}, } local down = { [1] = {y*426}, [2] = {y*464}, [3] = {y*502}, } function onVeh() local x1, y1, z1 = interpolate(0, up[1][1], 0, 0, down[1][1], 0, inicio2, 1000, "Linear") local x2, y2, z2 = interpolate(0, up[2][1], 0, 0, down[2][1], 0, inicio2, 1000, "Linear") local x3, y3, z3 = interpolate(0, up[3][1], 0, 0, down[3][1], 0, inicio2, 1000, "Linear") dxDrawImage(x*54, y1, x*36, y*36, "files/images/comida.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y1, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y1, x*150/100*fome, y*35, tocolor(255, 165, 0), false) dxDrawImage(x*54, y2, x*36, y*36, "files/images/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y2, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y2, x*150/100*sede, y*35, tocolor(16, 102, 231, 200), false) dxDrawImage(x*54, y3, x*36, y*36, "files/images/iconeSONO.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y3, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y3, x*150/100*Sono, y*35, tocolor(138, 43, 226, 200), false) end function onFoot() if inicio then local x1, y1, z1 = interpolate(0, down[1][1], 0, 0, up[1][1], 0, inicio, 1000, "Linear") -- animação retangulo 1 local x2, y2, z2 = interpolate(0, down[2][1], 0, 0, up[2][1], 0, inicio, 1000, "Linear") -- animação retangulo 2 local x3, y3, z3 = interpolate(0, down[3][1], 0, 0, up[3][1], 0, inicio, 1000, "Linear") -- animação retangulo 3 dxDrawImage(x*54, y1, x*36, y*36, "files/images/comida.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y1, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y1, x*150/100*fome, y*35, tocolor(255, 165, 0), false) dxDrawImage(x*54, y2, x*36, y*36, "files/images/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y2, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y2, x*150/100*sede, y*35, tocolor(16, 102, 231, 200), false) dxDrawImage(x*54, y3, x*36, y*36, "files/images/iconeSONO.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y3, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y3, x*150/100*Sono, y*35, tocolor(138, 43, 226, 200), false) else dxDrawImage(x*54, y*634, x*36, y*36, "files/images/comida.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y*634, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y*634, x*150/100*fome, y*35, tocolor(255, 165, 0), false) dxDrawImage(x*54, y*677, x*36, y*36, "files/images/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y*677, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y*677, x*150/100*sede, y*35, tocolor(16, 102, 231, 200), false) dxDrawImage(x*54, y*718, x*36, y*36, "files/images/iconeSONO.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*100, y*718, x*150, y*35, tocolor(0, 0, 0, 140), false) dxDrawRectangle(x*100, y*718, x*150/100*Sono, y*35, tocolor(138, 43, 226, 200), false) end end addEventHandler("onClientRender", root, onFoot, false) function onVehEnter(p) if p == getLocalPlayer() then if (not inicio2) then inicio2 = getTickCount() addEventHandler("onClientRender", root, onVeh, false) if isEventHandlerAdded( 'onClientRender', root, onFoot) then removeEventHandler('onClientRender', root, onFoot, false) end if inicio then inicio = nil end end end end addEventHandler ("onClientVehicleEnter", root, onVehEnter) function onVehExit(p) if p == getLocalPlayer() then if (not inicio) then inicio = getTickCount() addEventHandler("onClientRender", root, onFoot, false) if isEventHandlerAdded( 'onClientRender', root, onVeh) then removeEventHandler('onClientRender', root, onVeh, false) end if inicio2 then inicio2 = nil end end end end addEventHandler ("onClientVehicleExit", root, onVehExit) local components = { "area_name", "radio", "vehicle_name" } local hud_components = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo", "radar"} function setHud() addEventHandler("onClientRender", getRootElement(), hud) for _, hud_component in ipairs( hud_components) do setPlayerHudComponentVisible( hud_component, false ) end for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), setHud) function removeHud() for _, hud_component in ipairs( hud_components) do setPlayerHudComponentVisible( hud_component, true ) end end addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), removeHud) function interpolate(varX1, varY1, varZ1, varX2, varY2, varZ2, inicio, timer, animation) local tempo = getTickCount() local fim = inicio + timer local tempoDecorrido = tempo - inicio local duracao = fim - inicio local progresso = tempoDecorrido / duracao if (progresso > 1) then progresso = 1 end local varX1, varY1, varZ1 = interpolateBetween (varX1, varY1, varZ1, varX2, varY2, varZ2, progresso, animation) return varX1, varY1, varZ1 end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1.%2') if ( k==0 ) then break end end return formatted end1 point
-
Im really thankful to you Bilal135, you are really helpful and good person ! Thank you1 point
-
Tente isto: InteriorDP = 6 DimensaoDP = 0 Cmd01 = "a" -- Algema Cmd02 = "d" -- Desalgema Cmd03 = "c" -- Retira Armas Grupo = "Policial" Distancia_Comandos = 7 Deixar_Preso = createMarker ( 1535.73486, -1672.03137, 13.38281 -1, "cylinder", 10, 255, 255, 255, 0 ) Local_Preso = createMarker ( 264.08435, 77.60955, 1001.03906 -1, "cylinder", 2.5, 255, 255, 255, 0 ) setElementInterior ( Local_Preso, InteriorDP ) setElementDimension ( Local_Preso, DimensaoDP ) function emarker ( marker, md ) if md then if marker == Deixar_Preso then if getElementData ( source, "ocupacao" ) == "Policial" then setElementData ( source, "AirNewSCR_PrisaoArea", "Sim" ) exports.Scripts_OnMarkerMsgs_:create ( source, "Aviso: Aperte F9 para Abrir / Fechar o Painel de Prender do DP" ) end end end end addEventHandler ( "onPlayerMarkerHit", getRootElement ( ), emarker ) function lmarker ( marker, md ) if md then if marker == Deixar_Preso then setElementData ( source, "AirNewSCR_PrisaoArea", "Não" ) exports.Scripts_OnMarkerMsgs_:delete(source) end end end addEventHandler ( "onPlayerMarkerLeave", getRootElement ( ), lmarker ) function Algemar_Jogador ( thePlayer, _, nick ) if nick then if getPlayerFromID ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( Grupo ) ) then local player_a_ser_algemado = getPlayerFromID ( nick ) local nick_do_jogador = getPlayerName ( player_a_ser_algemado ) local nick_do_policial = getPlayerName ( thePlayer ) local jX, jY, jZ = getElementPosition (player_a_ser_algemado) local pX, pY, pZ = getElementPosition (thePlayer) local dist = getDistanceBetweenPoints3D ( pX, pY, pZ, jX, jY, jZ) if thePlayer == player_a_ser_algemado then return exports.Scripts_Textos:createNewDxMessage ( "Erro: Você não pode algemar você mesmo!", thePlayer, 255, 255, 255 ) end local Verificar = getElementData ( player_a_ser_algemado, "algemado" ) or false if Verificar == true then exports.Scripts_Textos:createNewDxMessage ( "Erro: Esse Jogador ja Esta Algemado!", thePlayer, 255, 255, 255 ) else if dist <= Distancia_Comandos then setElementData(player_a_ser_algemado,"algemado", true ) setElementFrozen( player_a_ser_algemado, true ) toggleControl(player_a_ser_algemado, "fire", false) setPedAnimation( player_a_ser_algemado, "GRAVEYARD", "mrnM_loop", -1, true, false, false, false) exports.Scripts_Textos:createNewDxMessage ( "Aviso: Você foi Algemado pelo Policial "..nick_do_policial, player_a_ser_algemado, 255, 255, 255 ) exports.Scripts_Textos:createNewDxMessage ( "Aviso: Você algemou o Jogador "..nick_do_jogador.." com Sucesso!", thePlayer, 255, 255, 255 ) else exports.Scripts_Textos:createNewDxMessage ( "Erro: Você esta Muito longe do Jogador! chegue mais Perto para poder Algema-lo!", thePlayer, 255, 255, 255 ) end end end end end end addCommandHandler( Cmd01, Algemar_Jogador) function Desalgemar_Jogador ( thePlayer, _, nick ) if nick then if getPlayerFromID ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( Grupo) ) then local player_a_ser_desalgemado = getPlayerFromID ( nick ) local nick_do_jogador = getPlayerName ( player_a_ser_desalgemado ) local nick_do_policial = getPlayerName ( thePlayer ) if thePlayer == player_a_ser_desalgemado then return exports.Scripts_Textos:createNewDxMessage ( "Erro: Você não pode desalgemar você mesmo!", thePlayer, 255, 255, 255 ) end local Verificar = getElementData ( player_a_ser_desalgemado, "algemado" ) or false if Verificar == false then exports.Scripts_Textos:createNewDxMessage ( "Erro: Esse Jogador não esta Algemado!", thePlayer, 255, 255, 255 ) else setElementData ( player_a_ser_desalgemado, "algemado", false ) setPedAnimation ( player_a_ser_desalgemado ) setElementFrozen ( player_a_ser_desalgemado, false ) toggleControl ( player_a_ser_desalgemado, "fire", true ) exports.Scripts_Textos:createNewDxMessage ( "Aviso: Você foi Desalgemado pelo Policial "..nick_do_policial, player_a_ser_desalgemado, 255, 255, 255 ) exports.Scripts_Textos:createNewDxMessage ( "Aviso: Você desalgemou o Jogador "..nick_do_jogador.." com Sucesso!", thePlayer, 255, 255, 255 ) end end end end end addCommandHandler( Cmd02, Desalgemar_Jogador) function Retirar_Armas ( source, cmd, pname ) if getElementData(source, "ocupacao" ) == "Policial" then local cliente = getPlayerFromID(pname) if isElement(cliente) then if cliente == source then exports.Scripts_Dxmessages:outputDx(source, "Erro: Você não pode Retirar suas Proprias Armas!", "error") return end local cx,cy,cz = getElementPosition(cliente) local x,y,z = getElementPosition(source) local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz) if dist <= 7 then takeAllWeapons ( cliente ) exports.Scripts_Dxmessages:outputDx(source, "Aviso: Você removeu todas as Armas do Jogador #ffffff"..getPlayerName(cliente).." #ffffffcom Sucesso!", "success") exports.Scripts_Dxmessages:outputDx(cliente, "Aviso: O Policial #ffffff"..getPlayerName(source).."#ffffff Confiscou todas as suas Armas!", "warning") end else exports.Scripts_Dxmessages:outputDx(source, "Erro: O Jogador Não Foi Encontrado!", "error") end end end addCommandHandler ( Cmd03, Retirar_Armas ) function Verificar_Emprego_Atual ( ) for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if acc and not isGuestAccount(acc) then local job = getElementData(player,'ocupacao') local accName = getAccountName (acc) if isObjectInACLGroup ("user."..accName, aclGetGroup ( Grupo ) ) then setElementData ( player, "ocupacao", "Policial" ) setElementData ( player, "AirNewSCR_Entrada_PortaoDP", "Sim" ) setElementData ( player, "AirNew_Perm_Prender", "Sim" ) else setElementData ( player, "ocupacao", "Criminoso" ) setElementData ( player, "AirNewSCR_Entrada_PortaoDP", "Não" ) setElementData ( player, "AirNew_Perm_Prender", "Não" ) end end end end setTimer ( Verificar_Emprego_Atual, 1500, 0 ) local Prisao_Blip = createBlip ( 1535.89856, -1672.66479, 13.38281 ) setElementVisibleTo ( Prisao_Blip, root, false ) function Nivel_de_Procurado ( source, int ) if int == 0 then setPlayerWantedLevel ( source, int ) else local wl = getPlayerWantedLevel ( source ) if wl + int <= 6 then setPlayerWantedLevel ( source, wl+int ) else setPlayerWantedLevel ( source, 6 ) end end end addEvent("AirNewSCR_Nivel_de_Procurado", true) addEventHandler("AirNewSCR_Nivel_de_Procurado", getRootElement ( ), Nivel_de_Procurado ) function Mensagens_Exports ( source, msg ) exports.Scripts_Textos:createNewDxMessage ( msg, source, 255, 255, 255 ) end addEvent ( "AirNewSCR_Mensagens_Exports", true) addEventHandler ( "AirNewSCR_Mensagens_Exports", getRootElement ( ), Mensagens_Exports ) function Enviar_Prisao_Servidor ( Jogador, Numero, Formato, Motivo ) outputChatBox ( "#58ACFAPolicia: O Policial #ffffff"..getPlayerName(source).." #58ACFAPrendeu o Jogador #ffffff"..Jogador.."!", root, 255, 255, 255, true ) outputChatBox ( "#58ACFAPolicia: Pelo tempo de "..Numero.." "..Formato..", Motivo: "..Motivo.."!", root, 255, 255, 255, true ) Jogador_Func = getPlayerFromName ( Jogador ) Estrelas_Preso = getPlayerWantedLevel ( Jogador_Func ) givePlayerMoney ( source, Estrelas_Preso*1000 ) if Formato == "Segundo(s)" then Multiplicador = 1 elseif Formato == "Minuto(s)" then Multiplicador = 60 elseif Formato == "Hora(s)" then Multiplicador = 3600 elseif Formato == "Dia(s)" then Multiplicador = 86400 end TempoPrisao = Numero*Multiplicador setElementData ( Jogador_Func, "AirNew_Tempo_Prisao", TempoPrisao ) setElementData ( Jogador_Func, "AirNew_Preso", "Sim" ) setPlayerWantedLevel ( Jogador_Func, 0 ) takeAllWeapons ( Jogador_Func ) setElementData ( Jogador_Func, "Policia:Captura", false ) setElementData ( Jogador_Func, "Player:Msg", "" ) showCursor ( Jogador_Func, false) setControlState ( Jogador_Func, "sprint", false) setControlState ( Jogador_Func, "walk", false) setControlState ( Jogador_Func, "forwards", false) toggleAllControls ( Jogador_Func, true ) triggerClientEvent ( source, "CancelTimeParaPrender:Time", source ) if getElementData ( Jogador_Func, "algemado" ) == true then setElementData ( Jogador_Func, "algemado", false ) setPedAnimation ( Jogador_Func ) setElementFrozen ( Jogador_Func, false ) toggleControl ( Jogador_Func, "fire", true ) end end addEvent( "AirNew_Enviar_Prisao", true ) addEventHandler( "AirNew_Enviar_Prisao", getRootElement(), Enviar_Prisao_Servidor ) function Capturar_Jogador ( source, wantedlevel, vitima ) local x, y, z = getElementPosition ( vitima ) if x < -518 and y < 0 then -- SF time = 4 end if x >= -518 and y < 510 then -- LS time = 2 end if x >= -518 and y >= 510 then -- LV time = 4 end setElementData ( source, "PoliceToPrision:Time", tonumber(time*60) ) setTimer ( triggerClientEvent, 10000, 1, source, "ShowTimeParaPrender:Time", source ) exports.Scripts_Textos:createNewDxMessage ( "Você foi Capturado pelo Policial "..getPlayerName(source), vitima, 255, 255, 255 ) exports.Scripts_Textos:createNewDxMessage ( "Você tem "..time.." Minutos para Levar o Jogador para a Prisão!", source, 255, 255, 255 ) toggleAllControls ( vitima, false ) setElementVisibleTo ( Prisao_Blip, source, true ) end addEvent("AirNewSCR_Capturar_Jogador", true) addEventHandler("AirNewSCR_Capturar_Jogador", getRootElement(), Capturar_Jogador ) function Teleportar_Capturado_Veiculo ( state, player , vehicle , seat ) if state == true then if seat and isElement ( vehicle ) then warpPedIntoVehicle ( player, vehicle, seat ) end else removePedFromVehicle ( player ) end end addEvent ( "AirNewSCR_TeleportarVeiculo", true ) addEventHandler ( "AirNewSCR_TeleportarVeiculo", getRootElement ( ), Teleportar_Capturado_Veiculo ) function Remover_Jogador_Veiculo ( player ) removePedFromVehicle ( player ) end addEvent ( "AirNewSCR_Remover_Jogador_Veiculo", true ) addEventHandler ( "AirNewSCR_Remover_Jogador_Veiculo", getRootElement ( ), Remover_Jogador_Veiculo ) function Teleportar_Capturado_Player ( source, type, value, x, y ,z) local Policial = getElementData ( source, "Policia:Captura" ) if isElement ( Policial ) and not isPedInVehicle ( source ) then if type == "INT" then setElementInterior ( source, value ) elseif type == "DIM" then setElementDimension ( source, value ) end setElementPosition ( source, x, y ,z ) end end addEvent ( "AirNewSCR_TeleportarPlayer", true ) addEventHandler ( "AirNewSCR_TeleportarPlayer", getRootElement ( ), Teleportar_Capturado_Player ) function Liberar_Capturado ( source ) for p, player in ipairs ( getElementsByType ( "player" ) ) do job = getElementData ( player,"ocupacao" ) or "Nenhum" capturado = getElementData ( player, "Policia:Captura" ) if job == "Criminoso" and isElement ( capturado ) then if capturado == source then Soltar_Fail_Captura ( source, player ) end end end end addEvent ( "AirNewSCR_FalharCapturaLiberar", true ) addEventHandler ( "AirNewSCR_FalharCapturaLiberar", getRootElement ( ), Liberar_Capturado ) function Soltar_Fail_Captura ( policial, vitima ) exports.Scripts_Textos:createNewDxMessage ( "O policial falhou e voce está solto novamnte, fuja",vitima, 255, 255, 255 ) exports.Scripts_Textos:createNewDxMessage ( "Voce falhou e o criminoso está solto novamente",policial, 255, 255, 255 ) setElementVisibleTo ( Prisao_Blip, policial, false ) setElementData ( vitima, "Policia:Captura", false ) setElementData ( vitima, "Player:Msg", "" ) showCursor ( vitima, false ) setControlState ( vitima, "sprint", false ) setControlState ( vitima, "walk", false ) setControlState ( vitima, "forwards", false ) toggleAllControls ( vitima, true ) end --- // Salvamento - Carregamento // --- addEventHandler("onPlayerLogin", root, function( _, acc ) CarregarLoginPlay ( acc ) end ) function CarregarLoginPlay ( conta ) if not isGuestAccount ( conta ) then if conta then local source = getAccountPlayer ( conta ) local AirNew_Tempo_Prisao = getAccountData ( conta, "AirNew_Tempo_Prisao" ) or 0 setElementData ( source, "AirNew_Tempo_Prisao", AirNew_Tempo_Prisao ) local AirNew_Preso = getAccountData ( conta, "AirNew_Preso" ) or "Não" setElementData ( source, "AirNew_Preso", AirNew_Preso ) end end end function ReiniciarScript ( res ) if res == getThisResource ( ) then for i, player in ipairs ( getElementsByType ( "player" ) ) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then CarregarLoginPlay ( acc ) end end end end addEventHandler ( "onResourceStart", getRootElement ( ), ReiniciarScript ) -- function SalvarLoginPlay ( conta ) if conta then local source = getAccountPlayer ( conta ) local AirNew_Tempo_Prisao = getElementData ( source, "AirNew_Tempo_Prisao" ) or 0 setAccountData ( conta, "AirNew_Tempo_Prisao", AirNew_Tempo_Prisao ) local AirNew_Preso = getElementData ( source, "AirNew_Preso" ) or "Não" setAccountData ( conta, "AirNew_Preso", AirNew_Preso ) end end function DesligarScript ( res ) if res == getThisResource ( ) then for i, player in ipairs ( getElementsByType ( "player" ) ) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then SalvarLoginPlay ( acc ) end end end end addEventHandler ( "onResourceStop", getRootElement ( ), DesligarScript ) function JogadorQuit ( quitType ) local acc = getPlayerAccount ( source ) if not isGuestAccount ( acc ) then if acc then SalvarLoginPlay ( acc ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), JogadorQuit ) function getPlayerFromID( id ) for _, player in next, getElementsByType("player") do if tonumber(id) and (getElementData(player, "ID") or -1) == tonumber(id) then return player end end return false end Quando for testar deixe o debug ativado /debugscript 3.1 point
-
Tá quase, você só mudou o nome da função por getPlayerFromID, você tem que substituir ela inteira por esta: function getPlayerFromID( id ) for _, player in next, getElementsByType("player") do if tonumber(id) and (getElementData(player, "ID") or -1) == tonumber(id) then return player end end return false end Feliz ano novo pra você.1 point
-
Você precisa colar meu código dentro do script, fora isso é só substituir getPlayerFromPartialName por getPlayerFromID nos três addCommands. Lembre-se de remover a função do código, pois ela não será mais utilizada. Se tiver alguma dificuldade mostre aqui seu código.1 point
-
function getPlayerFromID( id ) for _, player in next, getElementsByType("player") do if tonumber(id) and (getElementData(player, "ID") or -1) == tonumber(id) then return player end end return false end Tenta usando essa função1 point
-
1 point
-
Thank you. I'll test it. The function is writed in the code, yah? ~Tak, Polak.1 point
-
1 point
-
Salutări. Motivul principal pentru care cealaltă platformă de multiplayer este atât de cunoscută este datorat faptului că, față de Multi Theft Auto, are o denumire mult mai sugestivă și mai 'naturală' referitor la ceea ce este. Orice persoană, inclusiv eu și cu tine, atunci când am vrut pentru prima dată să ne jucăm San Andreas pe o platformă multiplayer am scris în motorul de căutare 'San Andreas Multiplayer', care e tocmai denumirea celelaltei platforme. Nu sunt singurul care este de părere că această parte de SEO a tras și trage destul de mult MTA în jos pentru că cei care au căutat și caută o platformă multiplayer pentru San Andreas mereu vor apela la cuvinte care inevitabil se regăsesc în denumirea SA-MP. Dacă nu cauți în mod special 'Multi Theft Auto' sau 'MTA', atunci cu siguranță vei găsi platforma undeva pe locul 6+ în listă, primele locuri fiind ocupate de către diverse părți/articole/videoclipuri aparținând sau având în prim plan SA-MP. Deoarece SA-MP se regăsește printre primele rezultate în cele mai populare și comune căutări pentru partea de multiplayer a San Andreas, inevitabil majoritatea se opresc la primul rezultat și nu se mai obosesc să caute alternative pe care să le compare. La început poate că nu a fost atât de evident, dar acum, după ani buni de la lansarea ambelor platforme, e destul de clar că la capitolul popularitate, SA-MP se află pe primul loc și motivele sunt evidente. Însă cam doar atât, la altceva decât popularitate, comparat cu ceea ce este MTA și ce oferă, SA-MP nu excelează și nu se remarcă cu absolut nimic. Din păcate pentru majoritatea jucătorilor tot ceea ce contează este popularitatea, exact capitolul în care MTA se află într-un dezavantaj, motiv pentru care ne regăsim în situația de acum. Problema denumirii nu este în totalitate vina celor care întrețin MTA. Pentru că, față de SA-MP, MTA a început de pe GTA 3 și a continuat pe Vice City ca într-un final să ajungă pe San Andreas, în timp ce SA-MP e doar o platformă bazată pe San Andreas. Cei de pe MTA nu cred că aveau de unde să știe cât de departe va ajunge proiectul și chiar și așa, e destul de dificil să găsești o denumire care să cuprindă toate cele trei jocuri și să aducă și în evidență partea de San Andreas în așa fel încât să atragă jucători. În afară de problema denumirii și a popularității, din discuțiile pe care le-am purtat cu diverse persoane și discuțiile pe care le-am urmărit, am observat că există multe concepții greșite și generalizări față de MTA. Multă lume se plânge că nu se menține atmosfera originală a jocului, ceea ce nu este în totalitate adevărat fiindcă asta ține de fiecare server în parte. La fel și legat de mărimea fișierelor custom și a timpului de așteptare la descărcare - SA-MP are în linii mari aceeași treabă de când cu 0.3DL, dar acolo nu e problemă, în schimb aici, da. Exemplele pot continua la nesfârșit dacă e să stăm și să aruncăm o privire detaliată asupra mentalității care s-a conturat în jurul MTA la nivel general. Iar dacă vii cu argumente și exemple bune către baza de jucători de pe SA-MP, persoane care fac astfel de afirmații despre MTA, te lovești de indiferență din partea lor. Pentru ei SA-MP e cel mai bun și gata, ceea ce e o absurditate imensă având în vedere că singurul lucru pozitiv, cum spuneam mai devreme, e popularitatea de care se bucură platforma. Faptul că oamenii în general, dar în speță jucătorii de pe SA-MP, sunt și reticienți la schimbare, la lucruri noi, adaugă un plus de dificultate la toată situația. Dacă se dorește redresarea situației, e oarecum destul de dificil, dar nu neapărat imposibil. Spun asta deoarece MTA ar trebui să depună eforturi și fonduri în așa fel încât să acapareze pozițiile principale din motoarele de căutare (astfel în timp persoanele noi vor afla mult mai ușor de platformă), ar trebui să-și crească prezența online (datorită popularității de care se bucură, SA-MP primește reclamă gratuită din partea celor care joacă pe platformă, ceea ce rezultă în atragerea de noi jucători, iar mai apoi întreg procesul se tot repetă, e ca un bulgăre de zăpadă care se rostogolește la vale, crește încontinuu), ar trebui să facă mai multe, acestea sunt doar două exemple destul de simple. Pe partea românească, dacă per general lucrurile stau prost pe MTA în prezent, inevitabil ne afectează și aici. Dar în acest caz sunt și alți factori care, din punctul meu de vedere, au dus la situația curentă, cum ar fi, de exemplu, comunitățile (în general, există și excepții și nu neapărat proiectul pe care eu și cu echipa mea am încercat să-l implementăm) din ultimii ani care s-au intitulat roleplay și care nu au făcut nimic altceva decât să fie RPG-uri cu o groază de moduri, bani în prostie și un nivel calitativ foarte prost. Persoanele care totuși au fost convinse și au acordat o șansă platformei MTA și care au venit aici să vadă cum stau lucrurile, evident că au găsit un haos și o dezordine care pe comunitățile de roleplay de acolo e mult mai scăzută. Nu au stat mult pe gânduri și s-au întors pe SA-MP considerând că nu există vreo speranță pe MTA și, mai rău, și-au relatat mai departe experiența prietenilor și cunoștințelor, scăzând astfel drastic imaginea și încrederea/abordarea/seriozitatea față de platformă. Am intrat în contact cu această platformă în 2011, deci mă pot considera suficient de vechi încât să spun că, eu cel puțin, încă mai am speranță pentru MTA, însă cu cât se scurge mai mult timp în care nu facem nimic, cu atât șansele de reușită scad treptat. În general popularitatea față de partea de multiplayer pe San Andreas, fie MTA sau SA-MP, începe să scadă drastic pe anumite segmente, însă sunt de părere că partea românească încă mai poate duce foarte mult timp din diferite considerente tehnice și contextuale. Nu spun că nu e ușor, dar nici imposibil, iar mai rău decât e acuma, nu știu dacă se poate ajunge, așa că singura direcție e înspre îmbunătățire. Acum, acestea sunt punctele mele de vedere și cu siguranță ar fi foarte benefic dacă și alții și-ar expune părerea pentru că ai avea mai multe perspective după care să te iei. Sper totuși că am reușit să îți răspund la întrebări, subiectele propuse de tine sunt cu spectru foarte larg și sunt mult mai complexe decât am acoperit eu aici, sunt lucruri pe care le-am simplificat și cu siguranță, involuntar, chiar omis, dar dacă ai întrebări sau sugestii, simte-te liber să le adresezi și atât eu, cât cu siguranță și ceilalți care mai frecventăm această secțiune, vom încerca să ți le răspundem așa cum și cât știm mai bine.1 point