Jump to content

Image appears only when you die and respawn time


off

Recommended Posts

How do I get the image to appear only when the player dies?

Script:

function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 

I want to know too, as I create a respawn time determined?

Link to comment
Show us where you added 'onClientPedWasted'

I tried these ways:

function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler( "onClientPedWasted", getResourceRootElement( getThisResource() ), showClientImage ) 

function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler( "onClientPedWasted", getRootElement(), showClientImage ) 

Link to comment
function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 

I'm not sure try this tho

Worked perfectly... and you know how I can create a specific time for all respawns?

Link to comment
function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
function showClientImage() 
setTimer ( function() 
    end, 5000, 1 ) 
end 

If that works it should set it to 5 seconds if that doesn't work try this

function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
  
setTimer ( showClientImage, 5000, 1 ) 

Link to comment
function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
function showClientImage() 
setTimer ( function() 
    end, 5000, 1 ) 
end 

If that works it should set it to 5 seconds if that doesn't work try this

function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
  
setTimer ( showClientImage, 5000, 1 ) 

It did not work. :(

Link to comment

any errors? /debugscript 3

function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
local seconds = 500 
    
setTimer ( showClientImage, ( seconds * 1000 ), 1 ) 

Try this

Link to comment
any errors? /debugscript 3
function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
local seconds = 500 
    
setTimer ( showClientImage, ( seconds * 1000 ), 1 ) 

Try this

Still does not work.

Well, if you can not solve it, at least tell me how I can create a respawn time for all spawns.

Link to comment
function showClientImage() 
   guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 
function showClientImage() 
    guiSetVisible (showClientImage, false) 
end 
  
local seconds = 50 
setTimer ( showClientImage, ( seconds * 100 ), 1 ) 

Don't know if this will work try this and ill try make the other one you wanted

Link to comment

Try this for respawn timer it set to 4 seconds

addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
        setTimer( spawnPlayer, 4000, 1 )   
         
  
    end 
) 

If that doesn't work do this

addEventHandler( "onPlayerWasted", getLocalPlayer( ), 
    function() 
        setTimer( spawnPlayer, 4000, 1 )   
         
  
    end 
  
) 
  

Link to comment
Try this for respawn timer it set to 4 seconds
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
        setTimer( spawnPlayer, 4000, 1 )   
         
  
    end 
) 

If that doesn't work do this

addEventHandler( "onPlayerWasted", getLocalPlayer( ), 
    function() 
        setTimer( spawnPlayer, 4000, 1 )   
         
  
    end 
  
) 
  

Thanks alot for the help, but it didn't work ... Tomorrow I will try again.

Link to comment

Image:

function showClientImage() 
   local img = guiCreateStaticImage( 0, 500, 59, 58, "image.png", false ) 
   setTimer(function() destroyElement(img) end, 5000, 1) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) 

Set the 5000 as you need ( its in milliseconds )

Link to comment

For the player spawn:

--client 
function onClientDied(killer, weapon, bodypart) 
    local thePlayer = getLocalPlayer() 
    triggerServerEvent('onPlayerDied', localPlayer, thePlayer) 
end 
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), onClientDied) 
  
--server 
addEvent('onPlayerDied', true) 
addEventHandler('onPlayerDied', getRootElement(), function ( thePlayer ) 
    setTimer(function() spawnPlayer(thePlayer, -2404.66943, -596.81165, 132.64844) end, 5000, 1) 
end) 

Set this "-2404.66943, -596.81165, 132.64844" to the position you want them to spawn and the '5000' after it ( again its in milliseconds )

Make sure you have them defined correctly in meta.xml. Like:

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...