SA-MP Forums Archive
How To Get Camera Pos ? - 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: How To Get Camera Pos ? (/showthread.php?tid=398614)



How To Get Camera Pos ? - Windrush - 10.12.2012

How To Get The Camera Pos, LookAt And, FacingAngle?
In Easy Method?


Код:
SetPlayerFacingAngle
SetPlayerCameraPos
SetPlayerCameraLookAt



Re: How To Get Camera Pos ? - Lordzy - 10.12.2012

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).


Re: How To Get Camera Pos ? - [HK]Ryder[AN] - 10.12.2012

nvm^^^