GetPlayerCameraTargetPlayer
From SA-MP Wiki
(Difference between revisions)
Revision as of 14:25, 28 April 2015 MP2 (Talk | contribs) (GetPlayerCameraTargetActor related func) ← Previous diff |
Current revision MP2 (Talk | contribs) (Added example) |
||
Line 12: | Line 12: | ||
{{note2|Do not confuse this function with [[GetPlayerTargetPlayer]]. GetPlayerTargetPlayer returns the ID of the player playerid is ''aming'' at (with a weapon). GetPlayerCameraTargetPlayer returns the ID of the player playerid is ''looking'' at (reference point is the '''center of the screen''').}} | {{note2|Do not confuse this function with [[GetPlayerTargetPlayer]]. GetPlayerTargetPlayer returns the ID of the player playerid is ''aming'' at (with a weapon). GetPlayerCameraTargetPlayer returns the ID of the player playerid is ''looking'' at (reference point is the '''center of the screen''').}} | ||
+ | |||
+ | {{Example}} | ||
+ | <pawn> | ||
+ | new playerTarget = GetPlayerCameraTargetPlayer(playerid); | ||
+ | |||
+ | if(IsPlayerAdmin(playerTarget)) | ||
+ | { | ||
+ | GameTextForPlayer(playerid, "Looking at an admin", 3000, 3); | ||
+ | } | ||
+ | </pawn> | ||
{{RelatedFunctions}} | {{RelatedFunctions}} |
Current revision
Description:
Allows you to retrieve the ID of the player the playerid is looking at.
Important | This function is disabled by default to save bandwidth. Use EnablePlayerCameraTarget to enable it for each player. |
(playerid)
playerid | The ID of the player to check |
Return Values:
The ID of the player the playerid is looking at
Important | Do not confuse this function with GetPlayerTargetPlayer. GetPlayerTargetPlayer returns the ID of the player playerid is aming at (with a weapon). GetPlayerCameraTargetPlayer returns the ID of the player playerid is looking at (reference point is the center of the screen). |
Example Usage:
new playerTarget = GetPlayerCameraTargetPlayer(playerid); if(IsPlayerAdmin(playerTarget)) { GameTextForPlayer(playerid, "Looking at an admin", 3000, 3); }
[edit]
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerCameraTargetActor: Get the ID of the actor (if any) a player is looking at.
- GetPlayerCameraTargetVehicle: Get the ID of the vehicle a player is looking at.
- GetPlayerCameraTargetObject: Get the ID of the object a player is looking at.
- GetPlayerCameraFrontVector: Get the player's camera front vector