Administrators Lpsd Posted December 10, 2016 Administrators Share Posted December 10, 2016 (edited) Would have edited my other post to include this, but seems the option isn't available. I have the following code: function objSelect ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if clickedElement and getElementType( clickedElement ) == "spawnpoint" then outputChatBox("--element clicked") end end addEventHandler ( "onClientClick", getRootElement( ), objSelect) What this is supposed to do, basically, is output "--element clicked" in the chatbox whenever you click an element with the type of "spawnpoint" This works great when I change the second line to say "object" instead of "spawnpoint", however with spawnpoint it doesn't work. Is this just a problem in MTA? or is something wrong with the code? As far as I know spawnpoints still have collisions, so therefore can be detected by clicking on them with the cursor. Edited December 10, 2016 by LopSided_ Link to comment
iPrestege Posted December 10, 2016 Share Posted December 10, 2016 (edited) In fact maybe it's not a bug or something it's working fine if you clicked on element's which was created using createObject . Function so yeah i'm not sure why it's not output when you click on gta sa default models it works only with the function i post above also not sure if it's working with maps objects so you can also try that also check. onElementClicked . Good luck Edited December 10, 2016 by iPrestege typo Link to comment
LoPollo Posted December 10, 2016 Share Posted December 10, 2016 (edited) I'm not sure if i understand correctly... but spawnpoints aren't physical objects that can be clicked >.> That's why it works with objects but not with spawnpoints, which are also custom elements. Edited December 10, 2016 by LoPollo 1 Link to comment
Administrators Lpsd Posted December 10, 2016 Author Administrators Share Posted December 10, 2016 (edited) 1 hour ago, iPrestege said: In fact maybe it's not a bug or something it's working fine if you clicked on element's which was created using createObject . Function so yeah i'm not sure why it's not output when you click on gta sa default models it works only with the function i post above also not sure if it's working with maps objects so you can also try that also check. onElementClicked . Good luck Tried it, but no luck. As @LoPollo said, 1 hour ago, LoPollo said: spawnpoints aren't physical objects that can be clicked I think the only way to do this would be to float an object near to the spawnpoint when it is created, and somehow associate that object with the spawnpoint, then I could just click the object instead. This is for map editing use, so the object could be destroyed on player spawn, or with a button. If you think there could be an easier way feel free to let me know Edited December 10, 2016 by LopSided_ 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