open.mp forum
[Pawn] GetPlayerCameraAspectRatio - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] GetPlayerCameraAspectRatio (/showthread.php?tid=1801)



GetPlayerCameraAspectRatio - robertocaribbean - 2021-03-23

Hello everyone.

I have read in the open.mp documentation about this function, and if I understand correctly it can only return three values:

Widescreen ON: Should be 1.7764707 but I get 1.000000.
Widescreen OFF: Should be 1.3333334 but I get 1.000000.
5:4 when the LETTERBOX mode is ON: 1.2470589. I don't know how to test this.

Is there something I'm not understanding or is the wiki wrong?

Here is the code:

PHP Code:
public OnPlayerConnect(playerid) {
? ? new 
Float:pAspectRatio;
? ? 
pAspectRatio GetPlayerCameraAspectRatio(playerid);

? ? new 
str[80];
? ? 
format(strsizeof(str), "Your aspect ratio is: %f"pAspectRatio);
? ? print(
str);




RE: GetPlayerCameraAspectRatio - Pinch - 2021-03-24

Try delaying it a bit, 1 server tick i.e.


RE: GetPlayerCameraAspectRatio - robertocaribbean - 2021-03-24

(2021-03-24, 01:31 AM)Pinch Wrote: Try delaying it a bit, 1 server tick i.e.

I just tried putting the code inside a command and it works fine, giving me the results indicated in the wiki. I guess delaying the function invocation in OnPlayerConnect would also work.

Thanks!