mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-02 03:08:52 +00:00
Add /spawnped command
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user