[FREE] [ESX] Player Ped

How it works?
You can assign a ped model to a player via /setped command and when they spawn it, they’ll spawn as this specific ped. It saves the ped in database, you don’t need to import .SQL as it automatically creates a column in users table if the column doesn’t exist so you can just drag and drop the script to work.

Usage

  • /setped [playerid] [pedmodel] to assign a ped to a player
  • /setped [playerid] none to un-assign a ped to a player

Requirements

  • es_extended (supports all esx version from 1.1 to legacy)
  • mysql-async
1 Like

Can I use this
With hazmat suit then make hazmat an item basically can I make that slash command an item instead?

Just what i needed! Thanks!
BTW is it locked to admins?

Yes

1 Like

Neat concept and use of local functions. Few things though, should probably do some sort of ped validation because if the ped is wrong they would be invisible especially needed since you allow args to be used for the player so if its wrong the command user may not know and the database will be updated as soon as it’s done. It’s also probably a poor idea to run a query on start without at the very least some sort of error logging since the resource is dependent on that.

You could also do some sort of oop and save the player peds this way (on drop and restart) instead of updating the database every single time a command is invoked. While its perm restricted and its not a lot of data, should just be avoided imo but not a big deal.

Edit: Made a PR with ped model check.

1 Like

Thank you man!

Update by @ ROCKY_southpaw - thank you

  • check if the model is valid
  • add chat message for bad peds

Seems to be failing on finding a valid ped model, even though im directly copy pasting the ped name from the ped.lua and using the correct framework.

1 Like

Every time I type /setped id model I get a server-side error server.lua:53 attempt to call a nil value (global ‘ValidPedModel’) :frowning:

2 Likes

Yup same here.

Probs on my part.

You can change no1-playerped/server.lua at 66774916f66c2ca3c55b5343f572f3e0694e9221 · FingersNo1/no1-playerped · GitHub this to just function ValidPedModel(pedModel) instead of it being a local function.

I made it apparent that I didn’t test my PR with this resource as my core does this on its own. So not sure why OP didn’t test it but :man_shrugging:.

FIXED!! Thank you very much!

Thanks :slight_smile:

Thanks