Jump to content

androksi

Other Languages Moderators
  • Posts

    542
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by androksi

  1. Na função setElementHealth, troque vehicle por source.
  2. Isso faz parte do resource "greenzone", verifique se esse recurso tá ligado e desative ou exclua a parte onde recebe dinheiro.
  3. Também optei por trabalhar com GUI, só algumas coisas que faço em DX. Enfim, vamos ao tópico. Primeiro, jamais crie um evento de renderização em painéis GUI, eles realmente irão recriar até você desligar. Para atualizar as informações, você irá sim precisar de um evento de renderização, porém apenas para alterar os textos, usando guiSetText. Assim como o progressBar e outros elementos que precisam serem atualizados de acordo com a velocidade do carro, que no caso é o que seu script faz. Então, dentro do evento onClientRender, você deverá atualizar as informações. Exemplo: function updateInfo ( ) veh = getPedOccupiedVehicle ( getLocalPlayer ( ) ); speedx, speedy, speedz = getElementVelocity ( veh ); actualspeed = ( speedx ^ 2 + speedy ^ 2 + speedz ^ 2 ) ^ ( 0.5 ); mps = math.floor ( actualspeed * 50 ); kmh = math.floor ( actualspeed * 180 ); mph = math.floor ( actualspeed * 111.847 ); curGear = getVehicleCurrentGear ( veh ); guiSetText ( kmhlabel, kmh .. " Km/h" ); end addEventHandler ( "onClientRender", root, updateInfo ) Lembre-se de ativar o evento de renderização apenas quando o jogador entrar no veículo, igual você fez no código.
  4. Nossa. Nunca imaginei usar setElementAlpha para fazer isso. Eu fiz diferente o meu sistema de skins de armas: criei uma textura e um modelo invisível e substituí todas as armas por ela. Sendo assim, depois é só criar o objeto da arma em minha mão e attachar.
  5. Isso é feito através de substituição de objetos pelas skins das armas. Dá pra criar diversas skins dessa forma, tanto de personagens, armas e veículos. Porém, o que é mais viável e fácil de fazer, são as armas. O resource que você precisa é o bone_attach.
  6. Basta criar uma variável. local Tabela_Senha = { "1234", "4321", "3421" }; function teste ( ) randomNumber = math.random ( #Tabela_Senha ); outputChatBox ( "< "..Tabela_Senha[randomNumber].." >" ); end addCommandHandler ( "a", teste ) function Dx_Portoes ( ) dxDrawImage ( x * 0, y * 0, x * 1366, y * 768, "Img/Digitos.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ); dxDrawImage ( x * 0, y * 0, x * 1366, y * 768, "Img/B_Block.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ); if ( getElementData ( nameBox, "text" ) == tostring ( Tabela_Senha[randomNumber] ) ) then -- Minha dúvida está nesta linha. dxDrawImage ( x * 0, y * 0, x * 1366, y * 768, "Img/B_Acesso.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ); end dxDrawEditBox ( " Digite a Senha", 553, 203, 281, 59, false, 4, nameBox ); end addEventHandler ( "onClientRender", root, Dx_Portoes )
  7. Não entendi muito bem, então irei responder de acordo com o que você disse. Funções para isso não existe, você pode usar o evento: onVehicleEnter Sendo assim, quando o jogador entrar em algum veículo, executa o código que você quiser.
  8. Para mim, o debugscript não apontou nenhum erro. Veja se você copiou direitinho, se tiver mais dúvidas, poste aqui o meta e o código completo, pois acho que você alterou algo.
  9. Caraca, mané. Muito bom! Isso irá ajudar muita gente que está começando. Parabéns pelo vídeo e pela edição.
  10. Entendi perfeitamente. É melhor você usar o evento onPlayerLogin, pois o evento onPlayerJoin sempre retornará a skin do CJ (ID: 0). Faça assim: local maleSkins = { [0] = true, [1] = true, [2] = true, [7] = true, [14] = true, [15] = true, [16] = true }; local femaleSkins = { [9] = true, [10] = true, [11] = true, [12] = true, [13] = true, [31] = true, [38] = true }; addEventHandler ( "onPlayerLogin", root, function ( _, account ) local id = getElementModel ( source ); if ( maleSkins[id] ) then setPedWalkingStyle ( source, 10 ); -- aqui o estilo de andar se for skin masculina. else setPedWalkingStyle ( source, 11 ); -- aqui o estilo de andar se for skin feminina. end end )
  11. O código não faz sentido, pois quando o jogador entra no servidor, a skin dele sempre será 0 (CJ). Está faltando a variável "id", que no caso teria de ser acompanhada do getPedSkin(). local id = getPedSkin ( source ); Porém, getPedSkin não é mais válido. Use getElementModel(). local id = getElementModel ( source );
  12. E aí, rapaz. Ninguém aqui lhe dará um script pronto. No entanto você pode começar o código e ao longo da criação, poste suas dúvidas aqui. Iremos lhe ajudar.
  13. O parâmetro 'source', no seu código, é o veículo. Naquele primeiro código que você postou está correto, porém no uso do getElementData ( ) está errado, ou seja, use player ao invés de source.
  14. local vipcar = { }; addEvent( "vgAcao03", true ); addEventHandler ( "vgAcao03", root, function ( item ) if ( getPedOccupiedVehicle ( source ) ) then return triggerClientEvent ( source, "exibirNotificacao", source, "desativado", item, "Saia do veiculo primeiro!" ); end if ( vipcar[source] and isElement ( vipcar[source] ) ) then destroyElement ( vipcar[source] ); end local rx, ry, rz = getElementRotation ( source ); local x, y, z = getElementPosition ( source ); vipcar[source] = createVehicle ( 451, x, y, z, rx, ry, rz ); warpPedIntoVehicle ( source, vipcar[source] ); triggerClientEvent ( source, "exibirNotificacao", source, "ativado", item, "Você pegou o carro VIP" ); end )
  15. Olá. Bom, fiz aqui para você, tá incompleto mas você pode adicionar mais coisas e fazer o que quiser com o código. Basta você chegar perto de um veículo, apertar 'M' para fazer o cursor aparecer e clicar em cima de um veículo. -- client-side addEventHandler ( "onClientClick", root, function ( _, _, _, _, _, _, _, clickedElement ) if ( clickedElement ) then if ( getElementType ( clickedElement ) == "vehicle" ) then triggerServerEvent ( "onClientRequestRepair", localPlayer, clickedElement ); end end end bindKey ( "M", "down", function ( ) showCursor ( not isCursorShowing ( ) ); end ) -- server-side addEvent ( "onClientRequestRepair", true ); addEventHandler ( "onClientRequestRepair", root, function ( element ) local ePos = getElementPosition ( element ); local pPos = getElementPosition ( source ); local distance = getDistanceBetweenPoints3D ( ePos[1], ePos[2], ePos[3], pPos[1], pPos[2], pPos[3] ); if ( distance > 3 ) then return outputChatBox ( "* ERRO: O veículo não está próximo de você.", source, 255, 0, 0 ); end fixVehicle ( element ); end ) Como eu disse, tá incompleto. Altere ou faça mais coisas no server-side, creio eu que não seja necessário mexer no client-side.
  16. local ACL_GROUP = "PMESP"; local VEH_ID = 411; local theMarker = createMarker ( 0, 0, 3, "cylinder", 1.80, 255, 255, 0, 185 ); local theVehicle = { }; addEventHandler ( "onMarkerHit", theMarker, function ( player, d ) if ( getElementType ( player ) == "player" and d ) then local vehicle = getPedOccupiedVehicle ( player ); if ( vehicle ) then return false; end if ( isGuestAccount ( getPlayerAccount ( player ) ) then return false; end if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( ACL_GROUP ) ) ) then if ( theVehicle[player] and isElement ( theVehicle[player] ) ) then destroyElement ( theVehicle[player] ); end local playerPosition = { getElementPosition ( player ) }; theVehicle[player] = createVehicle ( VEH_ID, playerPosition[1], playerPosition[2], playerPosition[3] ); warpPedIntoVehicle ( player, theVehicle[player] ); end end end ) addEventHandler ( "onPlayerQuit", root, function ( ) if ( theVehicle[source] and isElement ( theVehicle[source] ) ) then destroyElement ( theVehicle[source] ); end end )
  17. Exatamente. O código já faz tudo. OBS.: o resource "fortnitedances" deve estar ligado no seu servidor.
  18. local totalDances = 13; addCommandHandler ( "dance", function ( player, _, ... ) local _ARG = { ... }; local DANCE_ID = tonumber ( _ARG[1] ); if ( not DANCE_ID ) then return false; end if ( DANCE_ID > totalDances ) then return outputChatBox ( "* ERRO: Há apenas " .. totalDances .. " animações. Use /dance [1-" .. totalDances .. "].", player, 255, 0, 0 ); end exports.fortnitedances:setPedFortniteAnimation ( player, "baile " .. DANCE_ID, -1, true, false, false, false ); end ) Basta colocar esse código em qualquer arquivo server-side. O comando é simples, basta digitar /dance <id>. São 13 danças.
  19. -- Client-side local SCREEN = { guiGetScreenSize ( ) } local WIDTH = 180 local HEIGHT = 25 addEventHandler( "onClientResourceStart", resourceRoot, function ( ) theButton = guiCreateButton ( SCREEN[1] - ( WIDTH + 5 ), SCREEN[2] / 2 - HEIGHT / 2, WIDTH, HEIGHT, "Teste", false ) guiSetVisible ( theButton, false ) end ) addCommandHandler( "open", function ( ) local isVisible = guiGetVisible ( theButton ) guiSetVisible ( theButton, not isVisible ) triggerServerEvent( "checkACL", localPlayer ) end ) addEvent( "toggleButton", true ) addEventHandler( "toggleButton", root, function ( string ) local bool = string == "enableButton" and true or false guiSetEnabled ( theButton, bool ) end ) -- Server-side addEvent( "checkACL", true ) addEventHandler( "checkACL", root, function ( ) local account = getPlayerAccount ( source ) if isGuestAccount ( account ) then return false end local accountName = getAccountName ( account ) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup( "Console" ) ) then triggerClientEvent ( source, "toggleButton", source, "enableButton" ) else triggerClientEvent ( source, "toggleButton", source, "disableButton" ) end end )
  20. guiSetInputMode("no_binds_when_editing") guiSetInputEnabled(false) Os dois funcionam.
  21. Opa, e aí. Então, não sei se minha lógica tá correta, mas vamos lá. Você pode fazer uma gambiarra pra isso funcionar, com a seguinte receita de bolo: crie um pedestre, deixando-o com opacidade 0 (invisível), use também createFire para aplicar o fogo nesse pedestre. Feito isso, você pode verificar do lado client, usando onClientPedDamage se a arma que o jogador está usando para "atacar" (apagar o fogo) é o extintor. E, quando a vida do ped for menor que 0, você pode destruir o source(o pedestre) e o fogo, e então fazer um trigger para o lado server, dando uma recompensa ou sei lá o que você pretende. Nunca coloquei em prática essa lógica, então não sei se pode funcionar, mas teste-a.
×
×
  • Create New...