15.04.2017, 17:58
Quote:
You can compare GetPlayerCameraPos with GetPlayerPos.
https://sampwiki.blast.hk/wiki/GetPlayerCameraPos https://sampwiki.blast.hk/wiki/GetPlayerPos |
I had tried that, but sometimes the position of the camera with that of the player varies a lot.
Would you help me improve it?
PHP код:
new Float:PosPlayer[3], Float:PosCamera[3];
GetPlayerCameraPos(playerid, PosCamera[0], PosCamera[1], PosCamera[2]);
GetPlayerPos(playerid, PosPlayer[0], PosPlayer[1], PosPlayer[2]);
new Float:PosFinal[3];
PosFinal[0] = PosCamera[0]-PosPlayer[0];
PosFinal[1] = PosCamera[1]-PosPlayer[1];
if(PosFinal[0] > 20 || PosFinal[0] < -20)
{
//cheat
}
if(PosFinal[1] > 20 || PosFinal[1] < -20)
{
//cheat
}