Zuqaa
April 9, 2017, 1:30am
1
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
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.
Zuqaa
April 9, 2017, 2:10am
3
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.
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)
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
Zuqaa
April 9, 2017, 2:34am
11
But it doesnt work i have a error in the console
It looks like you are missing a } somewhere
Zuqaa
April 9, 2017, 2:40am
13
the addon metiers is loadout (i have rename loadout in french…)
Can you send me both of the files in a paste bin?
Zuqaa
April 9, 2017, 2:43am
15
Can you send the whole file. I’m trying to run it on my own server to try and find the issue.
Zuqaa
April 9, 2017, 2:50am
17
Its good 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
Zuqaa
April 9, 2017, 2:51am
19
I will try this 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
Havoc
April 9, 2017, 4:38pm
20
Just as a heads up, you’re using an older version of the plugin
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
}
}
}