Version 1.0.1
586 downloads
Hey all!
Included in the package are the following files:
1) packages/mugshot.js - include this from within your packages/index.js file such as require("mugshot");
2) client_packages/mugshot.js - include this in your client_packages/index.js such as require("./mugshot.js");
3) client_packages/mugshot (Folder) - upload this directly to your client_packages folder
To take a screen simply call the event: prepareScreenshot
Server side: player.call("prepareScreenshot");
Client side: mp.events.call("prepareScreenshot");
The process of taking a screenshot:
Request the player headshot
Wait 2 seconds for it to load (best result thanks to GTA Forums reference)
Get the Pedheadshot TXD String for Sprite and set Variable to true to display sprite in Render event
Sprite is shown on screen for 1 frame!
On the next call of Render - it will take a screenshot, which takes a screenshot of the previous frame.
It will then stop processing the render event, unregister the pedheadshot and notify that a Headshot has been taken
Client side will now trigger a HTML window to open ready to accept an event
The event will trigger when the domReady is recieved and this event will contain the URL of the screenshot taken and the resolution of the game
The HTML will then take the image, crop out only the mugshot and then convert it to base64 - roughly 50kb per mugshot
The CEF will then notify Client Side to upload the data to the Server
The server will recieve the Mugshot as a Base64 Image string (which can be decoded manually for testing at: https://base64.guru/converter/decode/image)
It will then upload the Image currently to imgur with anonymous setting and provide you back the URL uploaded in console.
To use IMGUR
Go to https://api.imgur.com/oauth2/addclient - Log into your Imgur account and create an Application
Set the type to Anonymous
Set the callback URL to: https://www.getpostman.com/oauth2/callback
Give it a name, email and description
Click submit and you will get your Client ID - add this to packages/mugshot.js
NOTICE: You will see the mugshot appear on screen for a brief 1-2 frames however this is unavoidable no matter what I have tried as this is how the Screenshot tool takes the screenshot in the first place.