greenops011 Posted January 4, 2023 Posted January 4, 2023 Hey guys. I’m working on a TP system based off the owlGaming script that was made opensourced on github. I have a question about using multiple command handlers for the same thing. Basically an alias of a command handler. here is of course what the original is: function openLocationManager(thePlayer) if canViewTPS(thePlayer) then triggerClientEvent(thePlayer, "client:openLocationManager", thePlayer, locs) else return nil end end addEvent("server:openLocationManager", true) addEventHandler("server:openLocationManager", root, openLocationManager) addCommandHandler("tps", openLocationManager) Now, if I wanted to add an alias to “tps” would I have to add a second line, so like this: function openLocationManager(thePlayer) if canViewTPS(thePlayer) then triggerClientEvent(thePlayer, "client:openLocationManager", thePlayer, locs) else return nil end end addEvent("server:openLocationManager", true) addEventHandler("server:openLocationManager", root, openLocationManager) addCommandHandler("tps", openLocationManager) addCommandHandler("places", openLocationManager) Or would I just add it as a second string like this: function openLocationManager(thePlayer) if canViewTPS(thePlayer) then triggerClientEvent(thePlayer, "client:openLocationManager", thePlayer, locs) else return nil end end addEvent("server:openLocationManager", true) addEventHandler("server:openLocationManager", root, openLocationManager) addCommandHandler("tps", "places", openLocationManager) Thanks in advance
mafioz Posted January 4, 2023 Posted January 4, 2023 Hi. The second argument to addCommandHandler must be equal to the bound function. Just add a second addCommandHandler. addCommandHandler("tps", openLocationManager) addCommandHandler("places", openLocationManager)
greenops011 Posted January 4, 2023 Author Posted January 4, 2023 8 hours ago, shishani said: Hi. The second argument to addCommandHandler must be equal to the bound function. Just add a second addCommandHandler. addCommandHandler("tps", openLocationManager) addCommandHandler("places", openLocationManager) Awesome, thanks buddy. Really appreciate it
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now