Jump to content

[Solved] Small bug problem


justn

Recommended Posts

So yeah, the problem is, when the player hits 'LosSantosMarker' and clicks the button 'LosSantos' , when he hits the marker the first time, it outputs it in the chat once, but when he goes into the marker again and clicks the button again, it outputs it twice, and so on, can I have a little help please? thanks

addEventHandler("onClientMarkerHit",LosSantosMarker, 
        function(p) 
            if p == lp and not isPedInVehicle(lp) then 
                guiSetVisible(AirportWindow, true) 
                showCursor(true) 
            end 
        addEventHandler("onClientGUIClick",AirportWindow, 
        function (b,thePlayer) 
        if b == "left" then 
                if source == LosSantos then 
                cancelEvent() 
                outputChatBox("You are already in Los Santos!", thePlayer, 255, 0, 0) 
              end 
            end 
          end) 
        end) 

Edited by Guest
Link to comment

you can't cancel event onClientGUIClick

addEventHandler("onClientMarkerHit", LosSantosMarker, 
function(p) 
    if (p == lp) and not (isPedInVehicle(lp)) then 
        guiSetVisible(AirportWindow, true) 
        showCursor(true) 
    end 
end) 
        
addEventHandler("onClientGUIClick", AirportWindow, 
function (b) 
    if (b == "left") and (source == LosSantos) then 
        outputChatBox("You are already in Los Santos!", 255, 0, 0) 
    end 
end) 

Edited by Guest
Link to comment
addEventHandler ( "onClientMarkerHit", LosSantosMarker, 
    function ( p ) 
        if ( p == lp and not isPedInVehicle ( lp ) ) then 
            guiSetVisible ( AirportWindow, true ) 
            showCursor ( true ) 
        end 
    end 
) 
  
addEventHandler ( "onClientGUIClick", AirportWindow, 
    function ( b ) 
        if isElementWithinMarker ( localPlayer, LosSantosMarker ) then 
            if ( b == "left" ) then 
                if ( source == LosSantos ) then 
                    outputChatBox ( "You are already in Los Santos!", 255, 0, 0 ) 
                end 
            end 
        end 
    end 
) 

onClientGUIClick can't be cancelled.

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