Jump to content

Function no Work


JuniorMelo

Recommended Posts

hello, I have this function that is not working :shock::? ,

function MouseClick(button,state) 
    if button == "left" and state == "down" then 
        if ( source == f1 ) then 
               triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo) 
              ori9 = on 
        else 
              triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), garagem) 
              ori9 = off 
        end 
    end 
end 
addEventHandler("onClientClick",getRootElement(),MouseClick) 

Link to comment

No Have erros in /debugscript 3

function guiPart() 
f1 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-47,okX-70, recY-375, "", false) 
f2 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-2,okX-70, recY-375, "F2", false) 
f3 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3+43,okX-70, recY-375, "F2", false) 
guiSetAlpha ( f1, 0 ) 
guiSetAlpha ( f2, 0 ) 
guiSetAlpha ( f3, 0 ) 
end 
  
function MouseClick(button,state) 
    if button == "left" and state == "down" then 
        if ( source == f1 ) then 
            triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo) --Event GiveCar 
            ori9 = on --Image ON 
        else 
            triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), Garagem) --Event Destroy Car 
            ori9 = off --image OFF 
        end 
    end 
end 
addEventHandler("onClientClick",getRootElement(),MouseClick) 

Edited by Guest
Link to comment

Ok, so you're looking for something like this, however it's not going to work unless you have the following variables defined somewhere else in the script:

- on

- Ativo

- off

- Garagem

function guiPart() 
    f1 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-47,okX-70, recY-375, "", false) 
    f2 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-2,okX-70, recY-375, "F2", false) 
    f3 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3+43,okX-70, recY-375, "F2", false) 
    guiSetAlpha ( f1, 0 ) 
    guiSetAlpha ( f2, 0 ) 
    guiSetAlpha ( f3, 0 ) 
end 
  
function MouseClick ( button, state )  
    if ( button == "left" ) then  
        if ( source == f1 ) then 
            triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo); 
            ori9 = on; 
        else 
            triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), Garagem); 
            ori9 = off; 
        end 
    end  
end  
addEventHandler ( "onClientGUIClick", root, MouseClick ); 

Link to comment
Ok, so you're looking for something like this, however it's not going to work unless you have the following variables defined somewhere else in the script:

- on

- Ativo

- off

- Garagem

function guiPart() 
    f1 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-47,okX-70, recY-375, "", false) 
    f2 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-2,okX-70, recY-375, "F2", false) 
    f3 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3+43,okX-70, recY-375, "F2", false) 
    guiSetAlpha ( f1, 0 ) 
    guiSetAlpha ( f2, 0 ) 
    guiSetAlpha ( f3, 0 ) 
end 
  
function MouseClick ( button, state )  
    if ( button == "left" ) then  
        if ( source == f1 ) then 
            triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo); 
            ori9 = on; 
        else 
            triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), Garagem); 
            ori9 = off; 
        end 
    end  
end  
addEventHandler ( "onClientGUIClick", root, MouseClick ); 

this way does not work.

I believe it is for an event , "onClientGUIClick" ,

triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo); --Event Give Car 
       triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), Garagem); --Event Destroy Car 
       ori9 = on; --dxDrawImage ON 
       ori9 = off;   -- dxDrawImage OFF 

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