Jump to content

This part of script wont work


Tomaat

Recommended Posts

Hey everyone,

this part of my script wont work, and the gui wont show anymore...

        -- LEAVE HOUSE -- 
        addEventHandler("onClientGUIClick", Knopf2[5], function() 
            Guivar3 = 0 
            showCursor(false) 
            destroyElement(Fenster2[1]) 
            executeCommandHandler("out", playerSource) 
    end, false) 

Whats wrong ?

Regards, Tomaat

Link to comment
I am not sure but, doesn't executeCommandHandler require to have the resource as Admin in ACL?

Yes, the other command which was standard in the script was working, but indeed it said it wanted ACL rights, i know how to do that

But this one doesnt give any error or debugscript 3 log stuff, the other /in button does

what did i do wrong ?

the gui after wont appear, although the /in command it will appear if you want to let it appear, this one doesnt

//edit

executeCommandHandler("out") 

i will try that

Link to comment
I don't really understand what is your problem.

Theres a command to leave the house, /out, i want a button to execute that command, and it wont work, i used mta wiki to make the executer

destroyElement(Fenster2[1]) 

i guess you are destroying the gui and when you want show it again you using guiSetVisible?

You should note that after destroying the gui, it does not exist anymore that why it won't show anymore.

An other command in the gui does use this exact method it also destroys it, then i go in the house, when i do /out and press F2 again, it will reappear

Link to comment
What you can do is: trigger a server event, then execute the command in the server side.

Server::

addEventHandler("onHouseSystemInfoLeave", getRootElement(), function(id) 
    if(houseData[id]) then 
        executeCommandHandler("out", source) 
    end 
end) 

Client::

        -- LEAVE HOUSE -- 
        addEventHandler("onClientGUIClick", Knopf2[5], function() 
            Guivar3 = 0 
            showCursor(false) 
            destroyElement(Fenster2[1]) 
            triggerServerEvent("onHouseSystemInfoLeave", gMe, id) 
    end, false) 

Client triggered serverside event onHouseSystemInfoLeave but event is not added serverside

Link to comment

Server:

addEvent("onHouseSystemInfoLeave", true) 
addEventHandler("onHouseSystemInfoLeave", getRootElement(), function(id) 
    if(houseData[id]) then 
        executeCommandHandler("out", source) 
    end 
end) 

Client:

        -- LEAVE HOUSE -- 
        addEventHandler("onClientGUIClick", Knopf2[5], function() 
            Guivar3 = 0 
            showCursor(false) 
            destroyElement(Fenster2[1]) 
            triggerServerEvent("onHouseSystemInfoLeave", gMe, id) 
    end, false) 

Link to comment
Server:
addEvent("onHouseSystemInfoLeave", true) 
addEventHandler("onHouseSystemInfoLeave", getRootElement(), function(id) 
    if(houseData[id]) then 
        executeCommandHandler("out", source) 
    end 
end) 

Client:

        -- LEAVE HOUSE -- 
        addEventHandler("onClientGUIClick", Knopf2[5], function() 
            Guivar3 = 0 
            showCursor(false) 
            destroyElement(Fenster2[1]) 
            triggerServerEvent("onHouseSystemInfoLeave", gMe, id) 
    end, false) 

Thanks so much :D:mrgreen:

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