SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 13/01/2012, 09:04 PM   #31
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,251
Reputation: 744
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

Quote:
Originally Posted by xkirill View Post
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.
__________________
Goodbye SA-MP.
iPLEOMAX is offline   Reply With Quote
Old 13/01/2012, 09:13 PM   #32
Kaperstone
Banned
 
Join Date: May 2011
Location: Russia
Posts: 3,012
Reputation: 824
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

yea but this vehicle has the same id. (i said 2 NRG's)
Kaperstone is offline   Reply With Quote
Old 13/01/2012, 09:21 PM   #33
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,251
Reputation: 744
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

Quote:
Originally Posted by xkirill View Post
yea but this vehicle has the same id. (i said 2 NRG's)
I'm talking about the Vehicle ID, not the Vehicle
Model ids. (All vehcles in a server has it's own unique ID like players.)
__________________
Goodbye SA-MP.
iPLEOMAX is offline   Reply With Quote
Old 14/01/2012, 02:22 AM   #34
eеe
Huge Clucker
 
eеe's Avatar
 
Join Date: Oct 2011
Location: pawno.exe :P New Delhi/India
Posts: 326
Reputation: 49
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

Woho...great
__________________
If i have ever helped you please help me back by clicking here.Thank you.
Scripting for $$$ PM me for details.
Developing websites for $$$ for all occasions PM me for details.
Volt-Host 50% OFF use discount coupon - GETBACK
eеe is offline   Reply With Quote
Old 14/01/2012, 04:11 AM   #35
Kar
Banned
 
Join Date: May 2010
Location: Black Asylum
Posts: 2,940
Reputation: 538
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

I have a pretty nice idea to improve this and reduce any lag.

"How it works:
Uses Camera Vector, Position, Streamed Vehicles & your distance between the vehicle to calculate, etc.."

INSTEAD OF LOOPING through ALL VEHICLES.

Actually make a count of streamed vehicles using OnVehicleStreamIn and OnVehicleStreamOut to monitor the streamed vehicles and store them to a variable and LOOP through them.

Speed WILL be improved.
Kar is offline   Reply With Quote
Old 14/01/2012, 04:25 AM   #36
eеe
Huge Clucker
 
eеe's Avatar
 
Join Date: Oct 2011
Location: pawno.exe :P New Delhi/India
Posts: 326
Reputation: 49
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

Quote:
Originally Posted by Kar View Post
I have a pretty nice idea to improve this and reduce any lag.

How it works:
Uses Camera Vector, Position, Streamed Vehicles & your distance between the vehicle to calculate, etc..

INSTEAD OF LOOPING though ALL VEHICLES.

Actually make a count of streamed vehicles using OnVehicleStreamIn and OnVehicleStreamOut to monitor the streamed vehicles and store them to a variable and LOOP through them.

Speed WILL be improved.
Yeah nice idea.
Could be used
__________________
If i have ever helped you please help me back by clicking here.Thank you.
Scripting for $$$ PM me for details.
Developing websites for $$$ for all occasions PM me for details.
Volt-Host 50% OFF use discount coupon - GETBACK
eеe is offline   Reply With Quote
Old 14/01/2012, 07:53 AM   #37
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,251
Reputation: 744
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

@Kar

That's a great idea.

I'll do these changes then:
1) Keep track of Streamed vehicles in a player's variable and loop through them instead of "MAX_VEHICLES".
2) Change some Local Variables into Global and avoid arrays to make it faster.
3) Make the calculation a bit simpler.
4) A foreach + y_hooks version.

V2 coming soon.
__________________
Goodbye SA-MP.
iPLEOMAX is offline   Reply With Quote
Old 14/01/2012, 01:53 PM   #38
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,798
Reputation: 1174
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

Would it bug if there were duplicates of a vehicle in a single pos? I'm on my tablet ATM, just asking.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 14/01/2012, 02:08 PM   #39
Niko_boy
High-roller
 
Niko_boy's Avatar
 
Join Date: Aug 2010
Location: Somewhere i belong
Posts: 1,337
Reputation: 138
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

awesome x1000000000000000000 [infinity]
CANT EVEN COMMENT OF!!
its more to RP stuff though if some one have good idea it can be used else where too!
thanx for great release
__________________
nope[IMG]http://*******/1r0SOkH_[/IMG]
[CLOSED]LCSFreeroamDMStuntsAutoArena [0.3z][No SkinShot][sixtytiger.com]Want a decent Attack Defend Gamemode?
N/A176.31.229.148:7830Get This! Attack-Defend(v2.3.1)
Niko_boy is offline   Reply With Quote
Old 14/01/2012, 02:08 PM   #40
Mean
High-roller
 
Join Date: Jul 2010
Location: 14th annual lemon party
Posts: 2,727
Reputation: 229
Default Re: "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle.

Epic release, +6 rep.
Mean 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
"Slight homing", make a missile "Slightly!" home a vehicle. Donya Help Archive 4 11/06/2011 10:20 PM
Is player talks, use OnePlayAnim(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,0); Ihsan_Cingisiz Help Archive 5 30/05/2010 04:26 PM
Admin script requires "ReturnUser", "strtok" and "IsNumeric" Rubennnnn Help Archive 1 02/12/2009 07:08 PM
"Bots", "AI", "NPCs"... Computer-controlled pedestrians and traffic! ssflsnoob General 2 23/11/2008 07:06 PM


All times are GMT. The time now is 12:35 PM.


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