12.01.2012, 16:47
(
Последний раз редактировалось iPLEOMAX; 28.01.2012 в 18:35.
)
OnPlayerLookAtVehicle V2*
Info:
Detects if a player is looking at any vehicle and executes a callback on any change.
How it works:
Uses Camera Vector, Position, Streamed Vehicles & your distance between the vehicle to calculate, etc..
Callback & Natives:
Are you looking for IsPlayerLookingAt(vehicle ... object ... player) ?
http://forum.sa-mp.com/showpost.php?...postcount=2946
What can I do with it?
Few ideas:
- Make a showroom featuring TDU2's style. (I have done one)
Don't get it? I mean, if you point at any vehicle, it shows up it's name, price, top speed etc with textdraws. (It's cool TBH).
-Making other such thingies
Video Demonstration:
[ame]http://www.youtube.com/watch?v=LOYfW008PNU[/ame]
Download:
LATEST (V2.0)
"OPLAV.inc" V2 raw - Pastebin
OPLAV.V2.pleomax.rar - MediaFire
Requirement: You need YSI Server Includes to make this work!
OLD:
"vla.inc" raw - Pastebin
VLA Include (RAR) - MediaFire
Changelogs:Info:
Detects if a player is looking at any vehicle and executes a callback on any change.
How it works:
Uses Camera Vector, Position, Streamed Vehicles & your distance between the vehicle to calculate, etc..
Callback & Natives:
pawn Код:
//To Enable this for a player. (If you forget to do this, it won't work!)
EnableVehicleLookAt(playerid);
//The following Callback is called when a player has his camera's point of view towards a vehicle.
public OnPlayerLookAtVehicle(playerid, vehicleid, Float:distance)
{
new message[128];
format(message, sizeof message,
"You are looking at vehicle id %i with a distance of %f meters.", vehicleid, distance);
SendClientMessage(playerid, -1, message);
return true;
}
//To disable the lookat system for a player. (Good thing to put it under OnPlayerDisconnect)
DisableVehicleLookAt(playerid);
http://forum.sa-mp.com/showpost.php?...postcount=2946
What can I do with it?
Few ideas:
- Make a showroom featuring TDU2's style. (I have done one)
Don't get it? I mean, if you point at any vehicle, it shows up it's name, price, top speed etc with textdraws. (It's cool TBH).
-Making other such thingies
Video Demonstration:
[ame]http://www.youtube.com/watch?v=LOYfW008PNU[/ame]
Download:
LATEST (V2.0)
"OPLAV.inc" V2 raw - Pastebin
OPLAV.V2.pleomax.rar - MediaFire
Requirement: You need YSI Server Includes to make this work!
OLD:
"vla.inc" raw - Pastebin
VLA Include (RAR) - MediaFire
Код:
Version 1.0: - Initial Release. 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.