I create a peda on the server side, pass it to the client to set the parameters. The ped is being created, but the error in the console is annoying me, thanks in advance for your help
client.lua
RegisterCommand('qwe', function()
local playerPed = PlayerPedId()
local heading = GetEntityHeading(playerPed)
local model = 'csb_cop'
local pedtypes = 1
local hashkey = GetHashKey(model)
local coords = GetEntityCoords(PlayerPedId()) + 3, 3, 0
RequestModel(hashkey)
while not HasModelLoaded(hashkey) do
Wait(100)
end
TriggerServerEvent('spawnPed', pedtypes, hashkey, coords, heading )
end)
RegisterNetEvent('setPedCombatAttributes', function(ped)
while not DoesEntityExist(NetToPed(ped)) do
Wait(100)
end
local new_ped = NetworkGetEntityFromNetworkId(ped)
print("New Ped:", new_ped)
SetPedArmour(new_ped, 100)
print("Armour: ",GetPedArmour(new_ped))
SetPedAccuracy(new_ped, 90)
GiveWeaponToPed(new_ped, GetHashKey("weapon_heavyshotgun"), 10, false, false)
end)
server.lua
RegisterNetEvent('spawnPed', function(pedType, modelHash, coords, heading)
local ped = CreatePed(pedType, modelHash, coords,heading, true, false)
local newPed = NetworkGetNetworkIdFromEntity(ped)
print("Network: ", newPed)
TriggerClientEvent('setPedCombatAttributes', -1, newPed)
end)
Error: