Jump to content

please fix


HealthDown

Recommended Posts

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

Link to comment

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 ) 

Link to comment
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 ) 

Link to comment

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

Link to comment

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.

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...