04.08.2014, 23:25
These warning and errors appear because you already have a variable called pX and pY declared as global
I won't tell you how to name your global variables but I advise you to add some indicator like the letter 'g' at the beginning
To fix that without changing any of your code just rename the local variables (from 'p' to 'a')
I won't tell you how to name your global variables but I advise you to add some indicator like the letter 'g' at the beginning
To fix that without changing any of your code just rename the local variables (from 'p' to 'a')
pawn Код:
SetPlayerToFacePlayer(playerid, targetid) {
new
Float: aX,
Float: aY,
Float: tX,
Float: tY
;
return
GetPlayerPos(targetid, tX, tY, Float: targetid) &&
GetPlayerPos(playerid, aX, aY, Float: targetid) &&
SetPlayerFacingAngle(playerid, -atan2(tX - aX, tY - aY))
;
}