Respuesta: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
nacho_gb1 - 13.01.2012
very good job, good for roleplay servers
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
skaTim - 13.01.2012
Cool, great job!
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
iZN - 13.01.2012
Lovely work, it may get handy
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
Michael@Belgium - 13.01.2012
The fuck xD How ... nah whatevaa ! This is soo pro scripting ! +rep bro
EDIT: god damn it ... i can't give rep -.- I already give too much lol (that says vBulletin)
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
Kaperstone - 13.01.2012
awesome

2 questions:
1. what will happen if the player will look at 2 vehicles?
2. can you make the same but with objects? (mapped objects)
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
iPLEOMAX - 13.01.2012
Thanks Everybody! (:
@Unknownich: mlol xD
@Michael: Hehe Thanks! And It's alright bro.
Quote:
Originally Posted by xkirill
awesome 
2 questions:
1. what will happen if the player will look at 2 vehicles?
2. can you make the same but with objects? (mapped objects)
|
1. The closest vehicle is chosen.
2. Sure, I already had this in mind.
Only difficulty is that, there are different object sizes, to fix it for each and every object, it'll take some effort.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
[DOG]irinel1996 - 13.01.2012
Nice.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
Kaperstone - 13.01.2012
Quote:
Originally Posted by iPLEOMAX
Thanks Everybody! (:
@Unknownich: mlol xD
@Michael: Hehe Thanks! And It's alright bro.
1. The closest vehicle is chosen.
2. Sure, I already had this in mind.
Only difficulty is that, there are different object sizes, to fix it for each and every object, it'll take some effort.
|
yea but if the closest vehicle is 2 NRG's? (that have been spawned in the same pos and stuck in the same pos)
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
TheArcher - 13.01.2012
Quote:
Originally Posted by xkirill
yea but if the closest vehicle is 2 NRG's? (that have been spawned in the same pos and stuck in the same pos)
|
Will detect one NRG, the model is the same :P
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
iPLEOMAX - 13.01.2012
Quote:
Originally Posted by xkirill
yea but if the closest vehicle is 2 NRG's? (that have been spawned in the same pos and stuck in the same pos)
|
In that case, it will select the vehicle with the lowest ID.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
juraska - 14.01.2012
Can't believe it
great job
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
THE_KING$5$ - 14.01.2012
This is Cool Bro i Like it.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
iPLEOMAX - 14.01.2012
Thanks everyone.
Uploaded the V2 with these changes:
Код:
Version 2.0:
- Optimized the code hence increased performance/efficiency.
- Now uses a collection of player's streamed vehicles to check for the 'lookat'. (Thanks to "Kar" for the idea ;))
- Removed "oldvehicle" parameter from the callback since it's useless.
- Added Float:distance parameter to the callback.
- Uses y_hook to hook with the default callbacks.
I made the actual version with foreach, but due to some problems, I had to make the loop system myself.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
iPLEOMAX - 14.01.2012
Quote:
Originally Posted by Mean
Epic release, +6 rep.
|
Thank you Mean
Quote:
Originally Posted by Lorenc_
Would it bug if there were duplicates of a vehicle in a single pos? I'm on my tablet ATM, just asking.
|
It wouldn't I suppose. Instead it will select the vehicle according to it's index in the player's array variable.
(Edit: Eh, didn't mean to double post..)
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
Kar - 14.01.2012
Quote:
Originally Posted by iPLEOMAX
Thank you Mean
It wouldn't I suppose. Instead it will select the vehicle according to it's index in the player's array variable.
(Edit: Eh, didn't mean to double post..)
|
Exactly, and if you check it. Distance is also counted, because the first index should always be the closer vehicle... right? because of how vehicles are streamed.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
TheArcher - 15.01.2012
Quote:
Originally Posted by iPLEOMAX
- Removed "oldvehicle" parameter from the callback since it's useless.
|
Who said that? It's very useful instead. Please re-add it.
Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. -
iPLEOMAX - 28.01.2012
Quote:
Originally Posted by Kar
Exactly, and if you check it. Distance is also counted, because the first index should always be the closer vehicle... right? because of how vehicles are streamed.
|
Yep.
Quote:
Originally Posted by TheArcher
Who said that? It's very useful instead. Please re-add it.
|
If you make a new variable for each player, you can store the current vehicle then use it as an old vehicleid on lookat change. (I hope you understand what i mean

)