kieran Posted December 4, 2017 Share Posted December 4, 2017 I have a script for a job which spawns a marker, but when my player changes team I want to be able to destroy that marker, I know one way is make a command in each resource to set the players team to nil, then if the player is not in the team from that resource, just return the script, but it get's annoying for players because they have to type that command and leave their team all the time... So my question is, does anyone know of a handler that's triggered when a player changes team? If not... is there a way to add a custom event and trigger it across different resources? For example, if I made 2 resources, Resource 1 and Resource 2 and I added a triggerClientEvent in Resource 1 for a custom event in Resource 2, it would be able to find the custom event in resource 2 and execute it... Basically I want to find a way to trigger a custom event outwith the resource. Link to comment
Moderators IIYAMA Posted December 4, 2017 Moderators Share Posted December 4, 2017 There is no triggerEvent for changing team. All triggerEvents are global, so that is already happening. It just depends how and under which element you add the handler. 1 Link to comment
kieran Posted December 4, 2017 Author Share Posted December 4, 2017 (edited) @IIYAMA Thanks so much, I was confused if custom handlers were just used within a script nice to know there's an easy way! Edited December 4, 2017 by kieran 1 Link to comment
Moderators IIYAMA Posted December 4, 2017 Moderators Share Posted December 4, 2017 (edited) @kieran Oh and one last thing: bool addEvent ( string eventName [, bool allowRemoteTrigger = false ] ) If you use the addEvent function, you can allow and disallow triggers from different sides(client/server) TRUE = enabled I recommend you to add this function to the resource where you are also triggering from, because if you trigger an event which isn't added yet, you would receive warnings. Edited December 4, 2017 by IIYAMA 1 Link to comment
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