AcidDK Posted January 13, 2008 Share Posted January 13, 2008 Hi. I've been all over the wiki and this board now, and I can't find out how to create images and show them in game. Can some one possibly make a short guide for it? Thanks in advance. Link to comment
TmM_DEVIL Posted January 13, 2008 Share Posted January 13, 2008 i did this to add image to client side left lower part of screen but stuck on how remove it on client death heres is the code this in server side for event triggerClientEvent ( "onGreeting", getRootElement(), "" ) client function pic(toggle) local screenWidth, screenHeight = guiGetScreenSize() local player = guiCreateStaticImage(screenWidth/2 - -290, screenHeight - 80, 220, 100, 'lama.png', false, nil) end addEvent("onGreeting", true) addEventHandler("onGreeting", getRootElement(), pic) addEventHandler ( "onClientPlayerWasted", getRootElement(), picDied) i just need help with destroy on client death command Link to comment
50p Posted January 13, 2008 Share Posted January 13, 2008 I just made an example on wiki guiCreateStaticImage page: http://development.mtasa.com/index.php? ... ge#Example Link to comment
AcidDK Posted January 13, 2008 Author Share Posted January 13, 2008 I just made an example on wiki guiCreateStaticImage page: http://development.mtasa.com/index.php? ... ge#Example Yeah that's what I already have done, which doesn't work. Link to comment
TmM_DEVIL Posted January 13, 2008 Share Posted January 13, 2008 yes mine works i need it to remove image on client wasted Link to comment
50p Posted January 13, 2008 Share Posted January 13, 2008 Af far as I know, destroyElement should delete the image. destroyElement is used to remove vehicles, textdisplays, etc. Everything what's "element" Link to comment
TmM_DEVIL Posted January 13, 2008 Share Posted January 13, 2008 i cant figger out how destroy the element on my client script though could u give a example Link to comment
AcidDK Posted January 14, 2008 Author Share Posted January 14, 2008 i cant figger out how destroy the element on my client script though could u give a example Well.. store the element in a global variable and destroy it with destroyElement when needed? Link to comment
TmM_DEVIL Posted January 14, 2008 Share Posted January 14, 2008 yea but me a script noob how would i go about it with the cleint script above Link to comment
50p Posted January 14, 2008 Share Posted January 14, 2008 Try to do what I did: 1. make a global variable (at the top of script): local image 2. when you create static image use this variable to store the image element in it: image = guiCreateStaticImage(....) 3. if you want to delete the image use the "image" element as param in deleteElement func: deleteElement( image ) I had problems with onClientPlayerWasted and every event, but I tested events using functions that have the same param as the event. So if you want to use the event eg. onClientPlayerWasted add function to it with the params that event have (even if you don't need to use them): function funcName( killer, weapon, bodypart ) -- I don't use: killer, weapon, bodypart... but it must be included deleteElement( image ) end addEventHandler( "onClientPlayerWasted", getLocalPlayer(), funcName ) Note: This example is client-sided. Link to comment
darkdreamingdan Posted January 15, 2008 Share Posted January 15, 2008 you mean destroyElement, not deleteElement Link to comment
TmM_DEVIL Posted January 15, 2008 Share Posted January 15, 2008 great thx for the help just trying get used to this Link to comment
DazzaJay Posted January 15, 2008 Share Posted January 15, 2008 i have a question to ask about this. im just guessing as i dont really know... but it looks like this script Shows an image of the servers choice, then removes the image when the player gets killed.... so instead of removing the image when the player gets killed, is there a way to remove it after say a 20 second timer? Link to comment
TmM_DEVIL Posted January 15, 2008 Share Posted January 15, 2008 doesent work for some reason here is what i got if some one could help me local image function pic(toggle) local screenWidth, screenHeight = guiGetScreenSize() local image = guiCreateStaticImage(screenWidth/2 - -290, screenHeight - 80, 220, 100, 'lama.png', false, nil) end function picdel( killer, weapon, bodypart ) destroyElement( image ) end addEvent("onGreeting", true) addEventHandler("onGreeting", getRootElement(), pic) addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), picdel) Link to comment
kevuwk Posted January 15, 2008 Share Posted January 15, 2008 inside function pic, change local image = to image = Link to comment
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