HealthDown Posted September 8, 2011 Posted September 8, 2011 Client: rootElement = getRootElement () guiTGB = guiCreateWindow(236,380,332,190,"Ten Green Bottles",false) guiSetAlpha(guiTGB,1) guiTGBCoke = guiCreateButton(15,155,63,23,"Coke - 1$",false,guiTGB) guiTGBJuice = guiCreateButton(95,155,63,23,"Juice - 1$",false,guiTGB) guiTGBCokeImg = guiCreateStaticImage(16,29,58,114,"coke.png",false,guiTGB) guiTGBBeer = guiCreateButton(171,155,63,23,"Beer - 2$",false,guiTGB) guiTGBShake = guiCreateButton(248,155,63,23,"Shake - 2$",false,guiTGB) guiTGBJuiceImg = guiCreateStaticImage(100,33,53,110,"juice.png",false,guiTGB) guiTGBBeerImg = guiCreateStaticImage(173,34,58,112,"beer.png",false,guiTGB) guiTGBShakeImg = guiCreateStaticImage(248,36,59,111,"shake.png",false,guiTGB) guiSetVisible(guiTGB, false) addEvent ( "onSpecialEvent", true ) function specialEventHandler ( text ) guiSetVisible(guiTGB, true) end addEventHandler ( "onSpecialEvent", rootElement, specialEventHandler ) Server: local markerTGB = createMarker(495.71051025391,-75.590278625488,997.7578125,"cylinder",1,255,0,0) setElementInterior (markerTGB, 11) function markerTGBhit( ) triggerEvent ( "onSpecialEvent", rootElement, "test" ) end addEventHandler( "onMarkerHit", markerTGB, markerTGBhit ) it shows cylinder, but it doesnt show gui when i collision with cylinder
JR10 Posted September 8, 2011 Posted September 8, 2011 It's triggerClientEvent not triggerEvent. local markerTGB = createMarker(495.71051025391,-75.590278625488,997.7578125,"cylinder",1,255,0,0) setElementInterior (markerTGB, 11) function markerTGBhit( hitElement ) triggerClientEvent ( hitElement , "onSpecialEvent", hitElement, "test" ) end addEventHandler( "onMarkerHit", markerTGB, markerTGBhit )
MTA Team qaisjp Posted September 8, 2011 MTA Team Posted September 8, 2011 addEvent("onSpecialEvent", true) rootElement = getRootElement () guiTGB = guiCreateWindow(236,380,332,190,"Ten Green Bottles",false) guiSetAlpha(guiTGB,1) guiTGBCoke = guiCreateButton(15,155,63,23,"Coke - 1$",false,guiTGB) guiTGBJuice = guiCreateButton(95,155,63,23,"Juice - 1$",false,guiTGB) guiTGBCokeImg = guiCreateStaticImage(16,29,58,114,"coke.png",false,guiTGB) guiTGBBeer = guiCreateButton(171,155,63,23,"Beer - 2$",false,guiTGB) guiTGBShake = guiCreateButton(248,155,63,23,"Shake - 2$",false,guiTGB) guiTGBJuiceImg = guiCreateStaticImage(100,33,53,110,"juice.png",false,guiTGB) guiTGBBeerImg = guiCreateStaticImage(173,34,58,112,"beer.png",false,guiTGB) guiTGBShakeImg = guiCreateStaticImage(248,36,59,111,"shake.png",false,guiTGB) guiSetVisible(guiTGB, false) addEvent ( "onSpecialEvent", true ) function specialEventHandler ( text ) guiSetVisible(guiTGB, true) end addEventHandler ( "onSpecialEvent", rootElement, specialEventHandler )
JR10 Posted September 8, 2011 Posted September 8, 2011 Qaisjp, you just wrote another addEvent on top. Did you take my code again?
HealthDown Posted September 8, 2011 Author Posted September 8, 2011 yes i did it 3 times and no error
HealthDown Posted September 8, 2011 Author Posted September 8, 2011 i just tried to put this outside it worked, but inside interior no
JR10 Posted September 8, 2011 Posted September 8, 2011 That wasn't the problem, I tried it client side, without anything, the GUI showed. But using triggerClientEvent, server side, it didn't work, for some reason.
BinSlayer1 Posted September 8, 2011 Posted September 8, 2011 so debug it.. where you have this function specialEventHandler ( text ) guiSetVisible(guiTGB, true) end add a new line outputting something before the guiSetVisible outputChatBox('working') This way, you'll know the event was called. And if it does show 'working' in the chatbox then you have problems with the actual GUI which you need to fix by making sure syntax is correct according to the mta wiki
JR10 Posted September 8, 2011 Posted September 8, 2011 I tested his GUI, it's correct and it showed up. But something is wrong, with triggerClientEvent.
BinSlayer1 Posted September 8, 2011 Posted September 8, 2011 probably have to make sure hitElement is a player local markerTGB = createMarker(495.71051025391,-75.590278625488,997.7578125,"cylinder",1,255,0,0) setElementInterior (markerTGB, 11) function markerTGBhit( hitElement ) if getElementType(hitElement) == "player" then triggerClientEvent ( hitElement , "onSpecialEvent", hitElement, "test" ) end end addEventHandler( "onMarkerHit", markerTGB, markerTGBhit ) HealthDown, use this as your serverside file.
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