mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 23:01:30 +00:00
add more commands
This commit is contained in:
@@ -492,6 +492,8 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
----- Admin commnads from esx_adminplus
|
||||
|
||||
RegisterNetEvent("esx:tpm")
|
||||
AddEventHandler("esx:tpm", function()
|
||||
local WaypointHandle = GetFirstBlipInfoId(8)
|
||||
@@ -516,3 +518,90 @@ AddEventHandler("esx:tpm", function()
|
||||
TriggerEvent('chatMessage', "No Waypoint Set")
|
||||
end
|
||||
end)
|
||||
|
||||
local noclip = false
|
||||
RegisterNetEvent("esx:noclip")
|
||||
AddEventHandler("esx:noclip", function(input)
|
||||
local player = PlayerId()
|
||||
local ped = PlayerPedId
|
||||
|
||||
local msg = "disabled"
|
||||
if(noclip == false)then
|
||||
noclip_pos = GetEntityCoords(PlayerPedId(), false)
|
||||
end
|
||||
|
||||
noclip = not noclip
|
||||
|
||||
if(noclip)then
|
||||
msg = "enabled"
|
||||
end
|
||||
|
||||
TriggerEvent("chatMessage", "Noclip has been ^2^*" .. msg)
|
||||
end)
|
||||
|
||||
local heading = 0
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
|
||||
if(noclip)then
|
||||
SetEntityCoordsNoOffset(PlayerPedId(), noclip_pos.x, noclip_pos.y, noclip_pos.z, 0, 0, 0)
|
||||
|
||||
if(IsControlPressed(1, 34))then
|
||||
heading = heading + 1.5
|
||||
if(heading > 360)then
|
||||
heading = 0
|
||||
end
|
||||
|
||||
SetEntityHeading(PlayerPedId(), heading)
|
||||
end
|
||||
|
||||
if(IsControlPressed(1, 9))then
|
||||
heading = heading - 1.5
|
||||
if(heading < 0)then
|
||||
heading = 360
|
||||
end
|
||||
|
||||
SetEntityHeading(PlayerPedId(), heading)
|
||||
end
|
||||
|
||||
if(IsControlPressed(1, 8))then
|
||||
noclip_pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 1.0, 0.0)
|
||||
end
|
||||
|
||||
if(IsControlPressed(1, 32))then
|
||||
noclip_pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, -1.0, 0.0)
|
||||
end
|
||||
|
||||
if(IsControlPressed(1, 27))then
|
||||
noclip_pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 0.0, 1.0)
|
||||
end
|
||||
|
||||
if(IsControlPressed(1, 173))then
|
||||
noclip_pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 0.0, -1.0)
|
||||
end
|
||||
else
|
||||
Citizen.Wait(200)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx:killPlayer")
|
||||
AddEventHandler("esx:killPlayer", function()
|
||||
SetEntityHealth(PlayerPedId(), 0)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx:freezePlayer")
|
||||
AddEventHandler("esx:freezePlayer", function(input)
|
||||
local player = PlayerId()
|
||||
local ped = PlayerPedId()
|
||||
if input == 'freeze' then
|
||||
SetEntityCollision(ped, false)
|
||||
FreezeEntityPosition(ped, true)
|
||||
SetPlayerInvincible(player, true)
|
||||
elseif input == 'unfreeze' then
|
||||
SetEntityCollision(ped, true)
|
||||
FreezeEntityPosition(ped, false)
|
||||
SetPlayerInvincible(player, false)
|
||||
end
|
||||
end)
|
||||
|
||||
+30
-2
@@ -189,10 +189,38 @@ end, true, {help = _U('goto'), validate = true, arguments = {
|
||||
ESX.RegisterCommand('bring', "admin", function(xPlayer, args, showError)
|
||||
local playerCoords = xPlayer.getCoords()
|
||||
args.playerId.setCoords(playerCoords)
|
||||
end, true, {help = _U('goto'), validate = true, arguments = {
|
||||
end, true, {help = _U('bring'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('kill', "admin", function(xPlayer, args, showError)
|
||||
args.playerId.triggerEvent('esx:killPlayer')
|
||||
end, true, {help = _U('kill'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('freeze', "admin", function(xPlayer, args, showError)
|
||||
args.playerId.triggerEvent('esx:freezePlayer', "freeze")
|
||||
end, true, {help = _U('kill'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('unfreeze', "admin", function(xPlayer, args, showError)
|
||||
args.playerId.triggerEvent('esx:freezePlayer', "unfreeze")
|
||||
end, true, {help = _U('kill'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('reviveall', "admin", function(xPlayer, args, showError)
|
||||
for _, playerId in ipairs(GetPlayers()) do
|
||||
TriggerClientEvent('esx_ambulancejob:revive', playerId)
|
||||
end
|
||||
end, false, {help = "reviveall")})
|
||||
|
||||
ESX.RegisterCommand("noclip", 'admin', function(xPlayer, args, showError)
|
||||
xPlayer.triggerEvent('esx:noclip')
|
||||
end, false, {help = "noclip")})
|
||||
|
||||
ESX.RegisterCommand('players', "admin", function(xPlayer, args, showError)
|
||||
local xAll = ESX.GetPlayers()
|
||||
print("^5"..#xAll.." ^2online player(s)^0")
|
||||
@@ -200,4 +228,4 @@ ESX.RegisterCommand('players', "admin", function(xPlayer, args, showError)
|
||||
local xPlayer = ESX.GetPlayerFromId(xAll[i])
|
||||
print("^1[ ^2ID : ^5"..xPlayer.source.." ^0| ^2Name : ^5"..xPlayer.getName().." ^0 | ^2Group : ^5"..xPlayer.getGroup().." ^0 | ^2Identifier : ^5".. xPlayer.identifier .."^1]^0\n")
|
||||
end
|
||||
end, true)
|
||||
end, true)
|
||||
|
||||
Reference in New Issue
Block a user