Jump to content

Execute a command when clicking a button


..:D&G:..

Recommended Posts

Posted

Hello, its me (again :P ) I am starting to flood a bit with posts, sorry about that, but I started working on some scripts and I don't really know all the functions and events and how to write them (some).

So, I want to know how to trigger a command ''/jump for example'' when clicking a button from a gui.

Shall I use this:

function  jumpbabyjump() 
    triggerServerEvent("jump",getLocalPlayer(),getLocalPlayer()) 
end 
addEventHandler ( "onClientGUIClick",bJump,jumpbabyjump, false ) 

or:

executeCommandHandler( "jump",  jumpbabyjump) 

Posted

executeCommandHandler would be lots easier, I'd go for that however you'd have to change the arguments possibly because it might not return the correct arguments. You can still add arguments like executeCommandHandler("jump",jumpbabe,thePlayer,theVehicle) etc etc..

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