Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 13/09/20 in all areas

  1. Funcionou perfeitamente, obrigado!
    1 point
  2. Eu fiz o seguinte teste e funcionou aqui: addEventHandler('onClientPlayerDamage', root, function () local vidaAtual = getElementHealth(source) if (vidaAtual <= 1) then print('Travado em 1%') if (vidaAtual ~= 1) then setElementHealth(source, 1) end cancelEvent() end end )
    1 point
  3. Testei aqui e está funcionando normal. Certifique-se de ter deixado seu script como client-side e que ele está ativado.
    1 point
  4. Bom dia irmão, o seu código está 100% certo; não entendo o motivo de não estar funcionando para você.
    1 point
  5. To see errors and warnings from your script, use /debugscript 3. The problem here is you are parsing a resource element into triggerClientEvent where it expects a player. function ShowImage (player) The player here is a resource, because you have bound it to onResourceStart. If you want to send this image to everyone on the server, use root as "sendTo" parameter. triggerClientEvent ( root, "onClientGotImage", root, response ) I've made a few changes to it, see the comments here: -- server function ShowImage() outputChatBox ( "event called, fetching image..." ) fetchRemote ( "https://img.icons8.com/cotton/2x/baby.png", function ( response, error ) if error == 0 then triggerClientEvent ( root, "onClientGotImage", resourceRoot, response ) -- Use resourceRoot as the source of the event outputChatBox ( "data sucessfully send to the player" ) else outputChatBox ( "error "..error.." when fetching image." ) end end ) end addEventHandler("onResourceStart", resourceRoot, ShowImage) -- Use resourceRoot otherwise it triggers when any resource starts -- client local myTexture addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, -- resourceRoot as source function( pixels ) outputChatBox ( "client: ok." ) if myTexture and isElement ( myTexture ) then destroyElement( myTexture ) end myTexture = dxCreateTexture( pixels ) end ) addEventHandler("onClientRender", root, function() if myTexture then local w,h = dxGetMaterialSize( myTexture ) dxDrawImage( 200, 100, w, h, myTexture ) end end ) This code works for you on your local server, but you will run into issues doing this with other players, because they won't have loaded the clientside script before you send the image to them. Let me know if you need more explanation.
    1 point
  6. وليه مسوي للجميع #Edited addEventHandler("onPlayerSpawn", root, function() setTimer(setPedStat,1000, 1, source, 72, 0) end)
    1 point
  7. ملاحظة بسيطة عشان تستفيد اللوب هنا ما تحتاجه ابدًا وغلط تستعمله لأن كل الاعبين مالهم علاقة إذا لاعب واحد رسبن
    1 point
  8. @85242 you could try aswell changing 2nd argument of dxUpdateScreenSource. As far i remember that's how i solved it.
    1 point
×
×
  • Create New...