Add /spawnped command

This commit is contained in:
Jérémie N'gadi
2017-08-26 17:33:04 +02:00
parent 859624e796
commit 5491654979
2 changed files with 33 additions and 0 deletions
@@ -319,6 +319,33 @@ AddEventHandler('esx:pickupWeapon', function(weaponPickup, weaponName)
end)
RegisterNetEvent('esx:spawnPed')
AddEventHandler('esx:spawnPed', function(model)
model = (tonumber(model) ~= nil and tonumber(model) or GetHashKey(model))
local playerPed = GetPlayerPed(-1)
local coords = GetEntityCoords(playerPed)
local forward = GetEntityForwardVector(playerPed)
local x, y, z = table.unpack(coords + forward * 1.0)
Citizen.CreateThread(function()
print(model)
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
print('LOADED')
CreatePed(5, model, x, y, z, 0.0, true, false)
end)
end)
-- Pause menu disable HUD display
Citizen.CreateThread(function()
while true do
@@ -47,6 +47,12 @@ end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end, {help = _U('spawn_car'), params = {{name = "car", help = _U('spawn_car_param')}}})
TriggerEvent('es:addGroupCommand', 'spawnped', 'admin', function(source, args, user)
TriggerClientEvent('esx:spawnPed', source, args[2])
end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end)
TriggerEvent('es:addGroupCommand', 'spawnobject', 'admin', function(source, args, user)
TriggerClientEvent('esx:spawnObject', source, args[2])
end, function(source, args, user)