[HELP] Respawn after /loadout JOB

Hello, I would like modified the addon Loadout and to be able to do so that that a player selects a job and well that this spawn/respawn has a specific point

Screenshot of the Script

Now I would like to know quesqu’ it is necessary to make so that that he chooses the job his him teleport at the coordinates

Sry for my english i’m French :smiley:

Yes, you can do that.

In your server script, find the event called loadout:doLoadout

After everything inside that event, but still inside (before the “end)”) put this: TriggerClientEvent("loadout:tpToLoc", player, loadout.pos)

Goto your client script and place this:

RegisterNetEvent("loadout:tpToLoc") AddEventHandler("loadout:tpToLoc", function(pos) SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) end)

I haven’t tested this, and I wrote this up pretty quickly. If there are any issues, let me know and I’ll do some testing.

EDIT: Made error in the TriggerClientEvent. Fixed it.

Hi ^^ Thx for ur Help

but in what file has to I put this code? TriggerClientEvent(“loadout:tpToLoc”, player, loadout.pos)

In that loadout.lua file you have open in the screenshot. Find RegisterServerEvent("loadout:doLoadout") AddEventHandler("loadout:doLoadout", function(player, loadoutName) ... ... ... TriggerClientEvent("loadout:tpToLoc", player, loadout.pos) end)

Put it at the bottom, like that ^ Under all the other code inside there.

It’s good ??

Nope, move it down more. Like this

... for wIdx = 1, #weapons do --print("giving weapon " .. weapons[wIdx] .. " with delay " .. tostring(delay)) TriggerClientEvent("loadout:giveWeapon", player, weapons[wIdx], delay) end end TriggerClientEvent("loadout:tpToLoc", player, loadout.pos) end)

ok thx ^^

and for the client.lua :stuck_out_tongue:

Nope, that’s a little messed up there. Don’t put it inside of the other event. Make it on its own.

https://pastebin.com/FZdw7YK9

Ok thx u are the best :smiley:

1 Like

But it doesnt work i have a error in the console

It looks like you are missing a } somewhere

the addon metiers is loadout (i have rename loadout in french…)

Can you send me both of the files in a paste bin?

client: https://pastebin.com/2vE6MVka

server: https://pastebin.com/zDZAEcsD

Can you send the whole file. I’m trying to run it on my own server to try and find the issue.

Its good :stuck_out_tongue: i have miss the , in my loadount file after the skin… ^^ My bad…

rly thx for ur job dude !

No problem! Does the teleporting work?

1 Like

I will try this :wink: and i prevent u

EDIT:
I have a problem now… i have assigned a pos at all jobs but when i make /job Police he gave the skin of Police but he teleport me to the position { [‘x’] = 0.0, [‘y’] = 0.0, [‘z’] = 0.0 }, and its same for the all jobs :confused:

Just as a heads up, you’re using an older version of the plugin :wink:

As for the teleporting not working, from what I can see the code provided by @Briglair should work.

You are labeling the positions in the loadout file, right?

It would look something like:

LOADOUTS = { 
   ["cop"] = {
      pos = {
        x = 1,
        y = 2.29,
        z = 0.0
      }
   }
}

Thx, it works nickel