Entity Logs, Log when an object, vehicle or ped is spawned

Hey FiveM, for a long time now I have been looking for entity logs, when an entity is spawned such as a vehicle object or ped it sends to a discord webhook with the object name and the player name.
Hope you guys can help me out!

Hello @FuriousFoxGG,

You can either create such a system yourself or you can just check out this topic to install a pre-built system that has the features you’ve mentioned.

If you’d rather build the system yourself, let me know and I will provide further information to aid you in doing this.

2 Likes

I would like to create my own system as that resource only logs when a resource is started and I believe when a player leaves, I know how to create the discord webhook etc but I don’t know how to log when a vehicle object or ped is spawned!

Listen for the entityCreating event, then using GetEntityPopulationType filter for all types except 2, 4, 5, & 6.

Do you know what the code would look like for that?

I assumed you had experience. You just need an event handler for the event, then pass the handle parameter from the event into the native, check it against an array of numbers (as listed above), and then do you Discord logging stuff.

alrighty thank you!

Do you know how I can get the entity name as when I use GetEntity model it only displays the number?

This native perhaps

That is only client sided. I need a server sided one as the script is server sided.

Personally, I use a callback to get a random client to process the model name to a human-readable string.

Could you please send me the code?