detect if player take photo
#1

how i can verify if a player is using camera, and is take photo on a object? sorry for my english.
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerCameraMode

https://sampwiki.blast.hk/wiki/CameraModes

46 - Camera weapon aiming.
Reply
#3

and how i detect if is aiming an objectid? you can give me a small example code please?
Reply
#4

maybe this will be fine for you
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSED(KEY_FIRE))
	{
		if(GetPlayerCameraMode(playerid) == 46)
		{
			//The player has taken a photo
		}
	}
	return 1;
}
Reply
#5

yes but how i checkif I took a picture of the objectid ==
Reply
#6

I've never worked with theese functions but i think you have to use GetPlayerCameraPos function and check for the distance between the player camera pos and the object pos
Reply
#7

use m4karow's code above and then add another check of
Code:
if(GetPlayerCameraTargetObject(playerid) == /*objectid*/ && IsPlayerInRangeOfPoint(playerid, /*range, object posx, object posy, object posz*/))
{
// then your code to see if they've taken a picture of that object and is in the range of that object you specified.
}
Reply
#8

Remember to loop through all the objects though and break it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)