im trying to build a /Ped command and im getting errors anyone know how to fix this so it will actually spawn
local GiveLoadoutOnRespawn = false -- should players receive the gear when they (re)spawn? (default: false)
local EnableManualButton = false -- Should players be able to use the ManualLoadoutButton (default F7) to get the gear? (default: true)
local ManualLoadoutButton = 168 -- The button to be pressed to receive the loadout (default: 168 (F7))
local ClearPlayerClothes = true -- Should the player's clothes be cleaned? (remove blood etc.) (default: true)
local HealPlayer = false -- Should the player be healed (max health) (default: true)
local GiveMaxArmor = false -- Should the player receive full body armor? (default: true)
local ReceivedLoadoutMessage = '^1Gear equipped, enjoy!' -- the message the player receives after getting the gear.
local LoadoutCommand = "Ped" -- The command that equips the loadout. (Default: "loadout")
local EnableCommand = true -- Should the command be enabled? (true = yes, false = no) (default: false)
-- note for the LoadoutCommand: don't add a / because that's already added in the code!
-- https://wiki.fivem.net/wiki/Weapons
-- {weaponHash, amountOfAmmoToGive} Too much ammo might crash the game, be careful!
local spawnPedList = {
{1581098148}, -- Jerry Can
}
AddEventHandler("playerSpawned", function()
if GiveLoadoutOnRespawn then
GiveLoadout()
end
end)
if EnableCommand then
RegisterCommand(PedCommand, function()
GivePedSkin()
end, false)
end
if EnableManualButton then
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustReleased(0, ManualLoadoutButton) then
GiveLoadout()
end
end
end)
end
function GetPlayerPed()
local ped = GetPlayerPed(-1)
for k, w in pairs(change) do
ChangePlayerPed(GetPlayerPed(-1), w[2], w[3], false, false)
end
if ClearPlayerClothes then
ClearPedBloodDamage(ped)
end
if GiveMaxArmor then
SetPedArmor(ped, 100)
end
if HealPlayer then
SetEntityHealth(ped, 200)
end
TriggerEvent('chatMessage', '', {255,255,255}, ReceivedLoadoutMessage)
end