Jump to content

Question about clicking elements (spawnpoints)


Lpsd

Recommended Posts

  • Administrators

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 by LopSided_
Link to comment

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 by iPrestege
typo
Link to comment
  • Administrators
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 by LopSided_
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...