detect if player take photo - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: detect if player take photo (
/showthread.php?tid=652890)
detect if player take photo -
ShadowBlack - 21.04.2018
how i can verify if a player is using camera, and is take photo on a object? sorry for my english.
Re: detect if player take photo -
Kane - 21.04.2018
https://sampwiki.blast.hk/wiki/GetPlayerCameraMode
https://sampwiki.blast.hk/wiki/CameraModes
46 - Camera weapon aiming.
Re: detect if player take photo -
ShadowBlack - 21.04.2018
and how i detect if is aiming an objectid? you can give me a small example code please?
Re: detect if player take photo -
m4karow - 21.04.2018
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;
}
Re: detect if player take photo -
ShadowBlack - 21.04.2018
yes but how i checkif I took a picture of the objectid ==
Re: detect if player take photo -
m4karow - 21.04.2018
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
Re: detect if player take photo -
ItsRobinson - 21.04.2018
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.
}
Re: detect if player take photo -
JesterlJoker - 21.04.2018
Remember to loop through all the objects though and break it.