SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/05/2020, 12:25 PM   #1
zampa
Little Clucker
 
Join Date: Dec 2019
Posts: 17
Reputation: 0
Default How to detect when a player hits an object that has no collision

Hello, I tried using OnPlayerWeaponShot (for non-dynamic object) and OnPlayerShootDynamicObject (for dynamic object) but none of those two seemed to work. The object ID is 2921, I'm assuming that it's not working because it has no collision. How do I detect when it gets hit? Or is it impossible?
zampa is offline   Reply With Quote
Old 28/05/2020, 01:41 PM   #2
zampa
Little Clucker
 
Join Date: Dec 2019
Posts: 17
Reputation: 0
Default Re: How to detect when a player hits an object that has no collision

bump
zampa is offline   Reply With Quote
Old 28/05/2020, 01:56 PM   #3
Unrea1
Gangsta
 
Unrea1's Avatar
 
Join Date: Oct 2013
Location: Venezuela
Posts: 819
Reputation: 129
Default Re: How to detect when a player hits an object that has no collision

Show your code?
__________________
Unrea1 is online now   Reply With Quote
Old 28/05/2020, 02:13 PM   #4
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,785
Reputation: 635
Default Re: How to detect when a player hits an object that has no collision

If it has no collision, it cannot be hit. You could create a dummy object at the same position that does have collision and make it invisible, then check for that object to get hit. Although I think there is also a camera model that has collision, but I don't know its ID..
NaS is offline   Reply With Quote
Old 28/05/2020, 02:36 PM   #5
zampa
Little Clucker
 
Join Date: Dec 2019
Posts: 17
Reputation: 0
Default Re: How to detect when a player hits an object that has no collision

Thank you, this really helped.
I completly forgot that I can just create an object at the same position and set its material to a invisible one.
zampa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object hits a player / vehicle NeXoR Scripting Help 3 17/11/2016 11:02 AM
How to detect if a player hits a car? alinategh Scripting Help 1 18/07/2014 07:39 PM
How do I detect when a player hits another? ExtendedCarbon Scripting Help 2 14/09/2013 04:32 PM
Is it posible? [Detect object collision with ground] Azazelo Scripting Help 0 03/12/2012 09:06 AM
Detect if an object hits the ground DaneAMattie Help Archive 1 04/03/2011 07:58 PM


All times are GMT. The time now is 07:43 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.