[FOTL]Aphex Posted February 1, 2013 Posted February 1, 2013 (edited) So I want to change a gui image when you hit a marker, so far I have this... server function omg_ramptest() CP1 = createMarker (2445, -1660, 13, "cylinder", 4, 255, 0, 0, 255) omgMover1(1) end function randomCar(player, dimension) if source == CP1 then if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh then triggerClientEvent ( "triggered", getRootElement(), 1 ) end end end end addEventHandler('onMarkerHit', getRootElement(), randomCar) client function makeicon() local x,y = guiGetScreenSize() local iconimg = guiCreateStaticImage( (x/2)-25, y/15, 50, 50, "icon5.png", false ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), makeicon) function changeicon() guiStaticImageLoadImage ( iconimg, icon2.png ) end function trigger ( message ) outputChatBox ( "The server says: " .. message ) changeicon end addEvent( "triggered", true ) addEventHandler( "triggered", getRootElement(), trigger ) The initial image (icon5.png) displays and when you hit the marker I get the "The server says:" message, but ONLY when I delete the trigger function and contain it in it's own lua file. I can't get it to trigger the guiStaticImageLoadImage function. Any ideas? Edited February 1, 2013 by Guest
Castillo Posted February 1, 2013 Posted February 1, 2013 function makeicon() local x,y = guiGetScreenSize() local iconimg = guiCreateStaticImage( (x/2)-25, y/15, 50, 50, "icon5.png", false ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), makeicon) function changeicon() guiStaticImageLoadImage ( iconimg, "icon2.png" ) end function trigger ( message ) outputChatBox ( "The server says: " .. message ) changeicon ( ) end addEvent( "triggered", true ) addEventHandler( "triggered", getRootElement(), trigger )
[FOTL]Aphex Posted February 1, 2013 Author Posted February 1, 2013 Thanks I also had to delete the "local" from local iconimg = guiClientStaticImage...
Castillo Posted February 1, 2013 Posted February 1, 2013 That's right, I didn't notice. You're welcome.
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