wiki.sa-mp.com/wiki/GetPlayerCameraPos
wiki.sa-mp.com/wiki/GetPlayerFacingAngle
Here's a small snippet which makes you easier to get camera position. Just set the camera position to where you need and use /getcpos. The output gets saved in Scriptfiles/Camera_coords.txt.
Example: /getcpos sf_area
pawn Код:
CMD:getcpos(playerid, params[])
{
new Float:cxp, Float:cyp, Float:czp, str[256], fName[60];
if(sscanf(params, "s[60]", fName)) return SendClientMessage(playerid, 0xFF0000, "Usage: /getcpos (coordinate_name) {FFFFFF} | Example: /getcpos sf camera point");
if(strlen(fName) < 60) return SendClientMessage(playerid, 0xFF0000FF, "ERROR:Minimum coordinate name character allowed is 60.");
GetPlayerCameraPos(playerid, cxp, cyp, czp);
format(str, sizeof(str), "Camera coordinate name:%s | X:%f | Y:%f |Z:%f | Function: SetPlayerCameraPos(playerid, %f, %f, %f); /***/ \r\n", fName, cxp, cyp, czp, cxp, cyp, czp);
new File:cpos = fopen("Camera_Coords.txt", io_append);
if(cpos)
{
fwrite(cpos, str);
fclose(cpos);
SendClientMessage(playerid, 0xFF0000, "Camera position successfully generated!");
}
return 1;
}
pawn Код:
CMD:getfangle(playerid, params[])
{
new Float:ang, str[256], fName[60];
if(sscanf(params, "s[60]", fName)) return SendClientMessage(playerid, 0xFF0000, "Usage: /getfangle (coordinate_name) {FFFFFF} | Example: /getfangle fangle1 point");
if(strlen(fName) < 60) return SendClientMessage(playerid, 0xFF0000FF, "ERROR:Minimum coordinate name character allowed is 60.");
GetPlayerFacingAngle(playerid, ang);
format(str, sizeof(str), "Facing Angle name:%s | Angle:%f | Function: SetPlayerFacingAngle(playerid, %f); /***/ \r\n", fName, ang, ang);
new File:cpos = fopen("Facing_Angle.txt", io_append);
if(cpos)
{
fwrite(cpos, str);
fclose(cpos);
SendClientMessage(playerid, 0xFF0000, "Facing Angle successfully generated!");
}
return 1;
}
Usage: /getfangle (a name for the angle)
Example: /getfangle (lordz's angle).