alt.takeScreenshotGameOnly
Will only take a screenshot if screenshot permissions are enabled when the player joins the server. Excludes WebViews.
There is a small caveat with using this function. When a screenshot is created it will be very large and dependent on the user's screen size. When you emit the sreenshot to a server it may be too large. You will need to split the screenshot into multiple strings to get a complete screenshot.
Declaration
alt.takeScreenshotGameOnly(): Promise<string>
Usage
const result = await alt.takeScreenshotGameOnly(true);
Real World Example
async function takeScreenshotGameOnly() {
const base64string = await alt.takeScreenshotGameOnly();
return base64string;
}
takeScreenshotGameOnly().then(res => {
alt.emitServer('screenshot', res);
});
These examples assume you have imported alt
from alt-client
.