off Posted October 15, 2013 Posted October 15, 2013 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?
pa3ck Posted October 15, 2013 Posted October 15, 2013 'onClientPedWasted' https://wiki.multitheftauto.com/wiki/OnClientPedWasted
off Posted October 15, 2013 Author Posted October 15, 2013 'onClientPedWasted' https://wiki.multitheftauto.com/wiki/OnClientPedWasted It did not work... And as I create a respawn time determined?
off Posted October 15, 2013 Author Posted October 15, 2013 Shows us what you done This in the post...
off Posted October 16, 2013 Author Posted October 16, 2013 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 )
mint3d Posted October 16, 2013 Posted October 16, 2013 function showClientImage() guiCreateStaticImage( 0, 500, 800, 150, "image.png", false ) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) I'm not sure try this tho
off Posted October 16, 2013 Author Posted October 16, 2013 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?
off Posted October 16, 2013 Author Posted October 16, 2013 All player respawns or what? All... but the image does not disappear.
mint3d Posted October 16, 2013 Posted October 16, 2013 I am not understanding when a player dies they just die and images stays up?
off Posted October 16, 2013 Author Posted October 16, 2013 I am not understanding when a player dies they just die and images stays up? Yes, I want it to appear for a while and disappear after that.
mint3d Posted October 16, 2013 Posted October 16, 2013 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 )
off Posted October 16, 2013 Author Posted October 16, 2013 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.
mint3d Posted October 16, 2013 Posted October 16, 2013 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
off Posted October 16, 2013 Author Posted October 16, 2013 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.
mint3d Posted October 16, 2013 Posted October 16, 2013 What Spawns? You want to make something to respawn all players?
off Posted October 16, 2013 Author Posted October 16, 2013 What Spawns? You want to make something to respawn all players? I want to set a time for the player reappear. How to BF4, has a while before heading back into play.
mint3d Posted October 16, 2013 Posted October 16, 2013 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
mint3d Posted October 16, 2013 Posted October 16, 2013 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 )
off Posted October 16, 2013 Author Posted October 16, 2013 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.
mint3d Posted October 16, 2013 Posted October 16, 2013 Ye i will try tomorrow its pretty late its 4 am where i am
pa3ck Posted October 16, 2013 Posted October 16, 2013 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 )
pa3ck Posted October 16, 2013 Posted October 16, 2013 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:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now