Jump to content

Send Ped Headshot to server ?


Recommended Posts

Hi there,

 

I'm currently trying to make a script to send to my server the mugshot/headshot of the player.

 

I started using this very useful topic : http://gtaforums.com/topic/885580-ped-headshotmugshot-txd/

 

Displaying the mugshot onscreen (like in notifications) works great but I don't know how to get the image data of the headshot, I think I need to access this data to be able to send it to my server.

 

(Sending it is not an issue, the format is not an issue either I can convert on the server side)

 

I think I may start with the native GET_TEXTURE_RESOLUTION and then read each pixel value to make a bitmap-like structure I will be able to send to the server ? I don't know if it is possible to read pixel values in a texture

 

If anyone got an idea…

Link to comment
https://gtaforums.com/topic/891299-send-ped-headshot-to-server/
Share on other sites

Why would you even bother to send it over the network?

 

Assuming you're working with FiveM, you need two scripts and at least one event.

  1. client-side -> draw the notification with pedheadshot
  2. server-side -> send the ped network handle to a player with an event

Note : by "all clients", I mean the players you want to have the mugshot created.

 

Follow these steps, if your selected ped is NOT A PLAYER, ignore step 1 & 2 :

  1. Set your ped as a mission entity SET_ENTITY_AS_MISSION_ENTITY, this will stop any unexpected ped behaviour such as disappearing in the middle of the process
  2. Get the network ped ID with NETWORK_GET_NETWORK_ID_FROM_ENTITY
  3. Send the network ped ID to the selected online players (you need to create an event for this, like TriggerEvent("thisScript:sendpedID",source, destination/player, netPedId)
  4. Request ped mugshot/headshot on all clients
  5. Not necessary but better for sync : wait for all clients to have the ped mugshot loaded on all clients.
  6. Call the function where you need to display the mugshot (for example : drawNotification, etc).on all clients.
  7. Eventually, make the ped available for game deletion with SET_ENTITY_AS_NO_LONGER_NEEDED from server-side.

Remember, the mugshot is stored as a string variable and can be used to create a temporary texture file.

This means you can not send the texture to other clients because their game won't know what it means as the texture has not been loaded/created on their own computer.. This is why you use an event to say "Hey, I want you to create a mugshot for this ped for thoses players".

 

In GTA V, there are something like ~34 available ped mugshots that can be requested/created at once (source : scaleforms).

Edited by ins1de

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.