mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
things
This commit is contained in:
+36
-11
@@ -1,7 +1,13 @@
|
||||
local isPaused, isDead, pickups = false, false, {}
|
||||
|
||||
if Config.UseKashacters then
|
||||
RegisterNetEvent('esx:kashloaded')
|
||||
AddEventHandler('esx:kashloaded', function()
|
||||
TriggerServerEvent('esx:onPlayerJoined')
|
||||
end)
|
||||
else
|
||||
Citizen.CreateThread(function()
|
||||
while not Config.UseKashacters do
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
|
||||
if NetworkIsPlayerActive(PlayerId()) then
|
||||
@@ -10,12 +16,6 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if Config.UseKashacters then
|
||||
RegisterNetEvent('esx:kashloaded')
|
||||
AddEventHandler('esx:kashloaded', function()
|
||||
TriggerServerEvent('esx:onPlayerJoined')
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
@@ -23,8 +23,8 @@ AddEventHandler('esx:playerLoaded', function(playerData)
|
||||
ESX.PlayerLoaded = true
|
||||
ESX.PlayerData = playerData
|
||||
|
||||
if Config.UseKashacters then
|
||||
-- check if player is coming from loading screen
|
||||
if not Config.UseKashacters then
|
||||
|
||||
if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then
|
||||
local defaultModel = GetHashKey('a_m_y_stbla_02')
|
||||
RequestModel(defaultModel)
|
||||
@@ -37,11 +37,11 @@ AddEventHandler('esx:playerLoaded', function(playerData)
|
||||
SetPedDefaultComponentVariation(PlayerPedId())
|
||||
SetPedRandomComponentVariation(PlayerPedId(), true)
|
||||
SetModelAsNoLongerNeeded(defaultModel)
|
||||
end
|
||||
end
|
||||
|
||||
-- freeze the player
|
||||
|
||||
FreezeEntityPosition(PlayerPedId(), true)
|
||||
end
|
||||
|
||||
-- enable PVP
|
||||
if Config.EnablePVP then
|
||||
@@ -525,3 +525,28 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx:tpm")
|
||||
AddEventHandler("esx:tpm", function()
|
||||
local WaypointHandle = GetFirstBlipInfoId(8)
|
||||
if DoesBlipExist(WaypointHandle) then
|
||||
local waypointCoords = GetBlipInfoIdCoord(WaypointHandle)
|
||||
|
||||
for height = 1, 1000 do
|
||||
SetPedCoordsKeepVehicle(PlayerPedId(), waypointCoords["x"], waypointCoords["y"], height + 0.0)
|
||||
|
||||
local foundGround, zPos = GetGroundZFor_3dCoord(waypointCoords["x"], waypointCoords["y"], height + 0.0)
|
||||
|
||||
if foundGround then
|
||||
SetPedCoordsKeepVehicle(PlayerPedId(), waypointCoords["x"], waypointCoords["y"], height + 0.0)
|
||||
|
||||
break
|
||||
end
|
||||
|
||||
Citizen.Wait(5)
|
||||
end
|
||||
TriggerEvent('chatMessage', "Successfully Teleported")
|
||||
else
|
||||
TriggerEvent('chatMessage', "No Waypoint Set")
|
||||
end
|
||||
end)
|
||||
@@ -151,6 +151,37 @@ ESX.RegisterCommand('getcoords', "admin", function(xPlayer, args, showError)
|
||||
print("".. xPlayer.getName().. ": ".. xPlayer.getCoords(true))
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('tpm', "admin", function(xPlayer, args, showError)
|
||||
xPlayer.triggerEvent("esx:tpm")
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('goto', "admin", function(xPlayer, args, showError)
|
||||
local xTarget = ESX.GetPlayerFromId(args.playerId)
|
||||
if xTarget then
|
||||
local targetCoords = xTarget.getCoords()
|
||||
xPlayer.setCoords(targetCoords)
|
||||
xPlayer.TriggerEvent("chatMessage", "Successfully Teleported")
|
||||
else
|
||||
xPlayer.TriggerEvent("chatMessage", "ERROR: Player Not Online!")
|
||||
end
|
||||
end, true, {help = _U('goto'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
ESX.RegisterCommand('bring', "admin", function(xPlayer, args, showError)
|
||||
local xTarget = ESX.GetPlayerFromId(args.playerId)
|
||||
if xTarget then
|
||||
local playerCoords = xPlayer.getCoords()
|
||||
xTarget.setCoords(playerCoords)
|
||||
xPlayer.TriggerEvent("chatMessage", "Successfully Brought Player")
|
||||
else
|
||||
xPlayer.TriggerEvent("chatMessage", "ERROR: Player Not Online!")
|
||||
end
|
||||
end, true, {help = _U('goto'), validate = true, arguments = {
|
||||
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
|
||||
|
||||
ESX.RegisterCommand('getplayers', "admin", function(xPlayer, args, showError)
|
||||
local xAll = ESX.GetPlayers()
|
||||
print("^2"..#xAll.." ^3online player(s)^0")
|
||||
|
||||
+2
-2
@@ -88,8 +88,8 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
identifier = v
|
||||
break
|
||||
else
|
||||
identifier = string.sub(v, 9)
|
||||
break
|
||||
identifier = string.sub(v, 9)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user